Apply Reference tests v13.1 #398
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: reference-tests | |
on: | |
pull_request_target: | |
branches: | |
- main | |
- release-* | |
pull_request_review: | |
types: [ submitted ] | |
env: | |
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.daemon=false" | |
total-runners: 6 | |
jobs: | |
shouldRun: | |
name: checks to ensure we should run | |
# necessary because there is no single PR approved event, need to check all comments/approvals/denials | |
# might also be a job running, and additional approvals | |
runs-on: ubuntu-22.04 | |
outputs: | |
shouldRun: ${{steps.shouldRun.outputs.result}} | |
steps: | |
- name: required check | |
id: shouldRun | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea | |
env: | |
# fun fact, this changes based on incoming event, it will be different when we run this on pushes to main | |
RELEVANT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
with: | |
script: | | |
const { RELEVANT_SHA } = process.env; | |
const { data: { statuses } } = await github.rest.repos.getCombinedStatusForRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: RELEVANT_SHA, | |
}); | |
const refTested = statuses && statuses.filter(({ context }) => context === 'reference-tests'); | |
const alreadyRun = refTested && refTested.find(({ state }) => state === 'success') > 0; | |
const { data: reviews } = await github.rest.pulls.listReviews({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number, | |
}); | |
const approvingReviews = reviews && reviews.filter(review => review.state === 'APPROVED'); | |
const shouldRun = !alreadyRun && github.actor != 'dependabot[bot]' && (approvingReviews.length > 0); | |
console.log("tests should be run = %j", shouldRun); | |
console.log("alreadyRun = %j", alreadyRun); | |
console.log("approvingReviews = %j", approvingReviews.length); | |
return shouldRun; | |
referenceTestEthereum: | |
runs-on: ubuntu-22.04 | |
permissions: | |
statuses: write | |
checks: write | |
packages: read | |
needs: | |
- shouldRun | |
if: ${{ needs.shouldRun.outputs.shouldRun == 'true' }} | |
strategy: | |
fail-fast: true | |
matrix: | |
runner_index: [0,1,2,3,4,5] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
submodules: recursive | |
- name: Set up Java | |
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 | |
with: | |
distribution: adopt-openj9 | |
java-version: 17 | |
- name: get reference test report | |
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d | |
with: | |
branch: main | |
name_is_regexp: true | |
name: 'reference-test-node-\d*\d-results' | |
path: tmp/ref-xml-reports-downloaded | |
if_no_artifact_found: true | |
- name: setup gradle | |
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa | |
#shame the test generation isn't less redundant, we used to do this in a dependent job, but artifact downloading broke | |
- name: execute generate reference tests | |
run: ./gradlew ethereum:referencetests:blockchainReferenceTests ethereum:referencetests:generalstateReferenceTests ethereum:referencetests:generalstateRegressionReferenceTests -Dorg.gradle.parallel=true -Dorg.gradle.caching=true | |
- name: Split tests | |
id: split-tests | |
uses: r7kamura/split-tests-by-timings@9322bd292d9423e2bc5a65bec548901801341e3f | |
with: | |
reports: tmp/ref-xml-reports-downloaded | |
glob: 'ethereum/referencetests/build/generated/sources/reference-test/**/*.java' | |
total: ${{env.total-runners}} | |
index: ${{ matrix.runner_index }} | |
- name: compose gradle args | |
run: echo ${{ steps.split-tests.outputs.paths }} | sed -e 's/^.*java\///' -e 's@/@.@g' -e 's/\.java//' -e 's/^/--tests /' > refTestArgs.txt | |
- name: run reference tests | |
run: ./gradlew ethereum:referenceTests:referenceTests `cat refTestArgs.txt` -Dorg.gradle.parallel=true -Dorg.gradle.caching=true | |
- name: Upload Test Report | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 | |
if: always() # always run even if the previous step fails | |
with: | |
name: reference-test-node-${{matrix.runner_index}}-results | |
path: '**/build/test-results/referenceTests/TEST-*.xml' | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 | |
if: success() || failure() # always run even if the build step fails | |
with: | |
report_paths: '**/build/test-results/referenceTest/TEST-*.xml' | |
annotate_only: true | |
reference-tests: | |
runs-on: ubuntu-22.04 | |
needs: [ referenceTestEthereum ] | |
permissions: | |
checks: write | |
statuses: write | |
steps: | |
- name: consolidation | |
run: echo "consolidating statuses" | |