Skip to content

acceptance-tests

acceptance-tests #3

name: acceptance-tests
on:
pull_request_review:
types: [ submitted ]
env:
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.daemon=false"
total-runners: 6
jobs:
runner-indexes:
runs-on: [ besu-research-ubuntu-16, besu-research-ubuntu-8 ]
name: Generate runner indexes
outputs:
json: ${{ steps.generate-index-list.outputs.json }}
steps:
- id: generate-index-list
run: |
MAX_INDEX=$((${{ env.total-runners }}-1))
INDEX_LIST=$(seq 0 ${MAX_INDEX})
INDEX_JSON=$(jq --null-input --compact-output '. |= [inputs]' <<< ${INDEX_LIST})
echo "::set-output name=json::${INDEX_JSON}"
acceptanceTestEthereum:
runs-on: [ besu-research-ubuntu-16, besu-research-ubuntu-8 ]
name: "Acceptance Runner #${{ matrix.runner-index }}: Run acceptance tests in parallel"
needs:
- runner-indexes
if: ${{ github.actor != 'dependabot[bot]'}}
strategy:
fail-fast: false
matrix:
runner-index: ${{ fromjson(needs.runner-indexes.outputs.json) }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
cache: gradle
- name: Compile
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
cache-read-only: false
arguments: compileJava compileTestJava -Dorg.gradle.parallel=true
- name: Split tests
id: split-tests
uses: chaosaffe/[email protected]
with:
glob: 'acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/**/*Test.java'
split-total: ${{ env.total-runners }}
split-index: ${{ matrix.runner-index }}
- name: write out test list
run: echo "${{ steps.split-tests.outputs.test-suite }}" >> testList.txt
- name: format gradle args
#regex means: first truncate file paths to align with package name, then swap path delimiter with package delimiter,
#then drop file extension, then insert --tests option between each.
run: cat testList.txt | sed -e 's@acceptance-tests/tests/src/test/java/@@g' -e 's@/@.@g' -e 's/\.java//g' -e 's/\ /\ --tests\ /g' >> gradleArgs.txt
- name: list keystores
run: find . -name "*.jks"
- name: run acceptance tests
run: ./gradlew acceptanceTest --tests `cat gradleArgs.txt`
- name: cleanup tempfiles
run: rm testList.txt gradleArgs.txt
- name: Upload Test Report
uses: actions/upload-artifact@v3
if: always() # always run even if the previous step fails
with:
name: junit-acceptance-${{ matrix.runner-index }}-test-results
path: 'acceptance-tests/tests/build/test-results/acceptanceTest/TEST-*.xml'
retention-days: 1
- name: Acceptance Test Report html
uses: actions/upload-artifact@v3
if: always() # always run even if the previous step fails
with:
name: html-acceptance-${{ matrix.runner-index }}-test-results
path: 'acceptance-tests/tests/build/reports/tests/acceptanceTest/**'
retention-days: 1