Skip to content

Merge pull request #32 from CybercentreCanada/minor-fixes #87

Merge pull request #32 from CybercentreCanada/minor-fixes

Merge pull request #32 from CybercentreCanada/minor-fixes #87

Workflow file for this run

name: Java Test CI with Gradle
on:
push:
# only trigger on branches, not on tags
branches: '**'
jobs:
unit-test:
name: Unit Test Kangooroo Source Code
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4.2
- run: gradle test
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
if: always()
with:
name: test-result
path: build/reports/tests/
retention-days: 5
no-proxy-integration-test:
name: Integration Test Kangooroo without Proxy
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4.2
- run: gradle distZip
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output && mkdir tmp && cp build/distributions/KangoorooStandalone.zip .
- name: Install Kangooroo Java
run: unzip -j KangoorooStandalone.zip KangoorooStandalone/lib/* -d lib && unzip -j KangoorooStandalone.zip KangoorooStandalone/bin/* -d bin
- name: Run Kangooroo with default settings
run: ./bin/kangooroo -mods summary --url https://duckduckgo.com/
- name: Check all output files of Kangooroo is present
run: |
ls --format=commas output/168ce875a2188cce97924a11f6a918df/ > output1.txt
cmp --silent test/integration_test/assert_output_files.txt output1.txt && echo "All expected output files are present." || exit 1
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1
- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
with-proxy-integration-test:
name: Integration Test Kangooroo with Proxy
runs-on: ubuntu-latest
services:
proxypy:
image: abhinavsingh/proxy.py
ports:
- 8899:8899
steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4.2
- run: gradle distZip
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output2 && mkdir tmp && cp build/distributions/KangoorooStandalone.zip .
- name: Install Kangooroo Java
run: unzip -j KangoorooStandalone.zip KangoorooStandalone/lib/* -d lib && unzip -j KangoorooStandalone.zip KangoorooStandalone/bin/* -d bin
- name: Run Kangooroo with Proxy
run: ./bin/kangooroo -cf test/integration_test/test_conf.yml -mods summary --url https://duckduckgo.com/
- name: Check all output files of Kangooroo is present
run: |
ls --format=commas output2/168ce875a2188cce97924a11f6a918df/ > output2.txt
cmp --silent test/integration_test/assert_output_files.txt output2.txt && echo "All expected output files are present." || exit 1
- name: Check if kangooroo connected to the proxy
run: |
sleep 10
docker logs "${{ job.services.proxypy.id }}" >& output3.txt
grep -qe "duckduckgo.com:443" output3.txt
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1
- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
with-proxy-sandbox-integration-test:
name: Integration Test Kangooroo with Proxy
runs-on: ubuntu-latest
services:
proxypy:
image: abhinavsingh/proxy.py
ports:
- 8899:8899
steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4.2
- run: gradle distZip
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output2 && mkdir tmp && cp build/distributions/KangoorooStandalone.zip .
- name: Install Kangooroo Java
run: unzip -j KangoorooStandalone.zip KangoorooStandalone/lib/* -d lib && unzip -j KangoorooStandalone.zip KangoorooStandalone/bin/* -d bin
- name: Run Kangooroo with Proxy and Sandbox
run: ./bin/kangooroo -mods summary --no-sandbox -cf test/integration_test/test_conf.yml --url https://duckduckgo.com/
- name: Check all output files of Kangooroo is present
run: |
ls --format=commas output2/168ce875a2188cce97924a11f6a918df/ > output2.txt
cmp --silent test/integration_test/assert_output_files.txt output2.txt && echo "All expected output files are present." || exit 1
- name: Check if kangooroo connected to the proxy
run: |
sleep 10
docker logs "${{ job.services.proxypy.id }}" >& output3.txt
grep -qe "duckduckgo.com:443" output3.txt
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1
- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1