GitHub ci #25
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: | |
push: | |
branches: [ main ] | |
pull_request: | |
env: | |
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.daemon=false" | |
total-runners: 6 | |
jobs: | |
runner-indexes: | |
runs-on: ubuntu-22.04 | |
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}" | |
prepareReferenceTestEthereum: | |
runs-on: [ self-hosted, Linux, X64 ] | |
timeout-minutes: 30 | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
steps: | |
- name: export runner UID | |
run: echo "runner_uid=$UID" >> $GITHUB_ENV | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
set-safe-directory: true | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 11 | |
cache: gradle | |
- name: Restore classes | |
uses: actions/cache@v3 | |
with: | |
path: "**/*.class" | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
- name: generate ethereum reference tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: ethereum:referencetests:blockchainReferenceTests ethereum:referencetests:generalstateReferenceTests ethereum:referencetests:generalstateRegressionReferenceTests | |
- name: Correct Ownership in GITHUB_WORKSPACE directory | |
uses: peter-murray/reset-workspace-ownership-action@v1 | |
with: | |
user_id: ${{ env.runner_uid }} | |
- name: Cache reference tests | |
uses: actions/cache@v3 | |
with: | |
path: "ethereum/referencetests/build/generated/sources/reference-test/**" | |
key: ${{ runner.os }}-reftests-${{ github.sha }} | |
referenceTestEthereum: | |
runs-on: [ self-hosted, X64, Linux ] | |
needs: | |
- prepareReferenceTestEthereum | |
- runner-indexes | |
timeout-minutes: 30 | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
strategy: | |
matrix: | |
runner-index: ${{ fromjson(needs.runner-indexes.outputs.json) }} | |
steps: | |
- name: export runner UID | |
run: echo "runner_uid=$UID" >> $GITHUB_ENV | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 11 | |
cache: gradle | |
- name: Restore classes | |
uses: actions/cache@v3 | |
with: | |
path: "**/*.class" | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
- name: Restore reference tests | |
uses: actions/cache@v3 | |
with: | |
path: "ethereum/referencetests/build/generated/sources/reference-test/**" | |
key: ${{ runner.os }}-reftests-${{ github.sha }} | |
- name: Split tests | |
id: split-tests | |
uses: chaosaffe/[email protected] | |
with: | |
glob: 'ethereum/referencetests/build/generated/sources/reference-test/**/*.java' | |
split-total: ${{ env.total-runners }} | |
split-index: ${{ matrix.runner-index }} | |
- name: run reference tests | |
run: ./gradlew ethereum:referenceTests:referenceTests $(echo ${{ steps.split-tests.outputs.test-suite }} | sed -e 's/^.*java\///' -e 's@/@.@g' -e 's/\.java//' -e 's/^/--tests /') | |
- name: Correct Ownership in GITHUB_WORKSPACE directory | |
uses: peter-murray/reset-workspace-ownership-action@v1 | |
with: | |
user_id: ${{ env.runner_uid }} | |
- name: Upload Test Report | |
uses: actions/upload-artifact@v3 | |
if: always() # always run even if the previous step fails | |
with: | |
name: junit-reference-${{ matrix.runner-index }}-test-results | |
path: '**/build/test-results/referenceTests/TEST-*.xml' | |
retention-days: 1 | |
referenceTestQbft: | |
runs-on: [ self-hosted, Linux, X64 ] | |
timeout-minutes: 30 | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
steps: | |
- name: export runner UID | |
run: echo "runner_uid=$UID" >> $GITHUB_ENV | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 11 | |
cache: gradle | |
- name: Restore classes | |
uses: actions/cache@v3 | |
with: | |
path: "**/*.class" | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
- name: qbft reference tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: consensus:qbft:referencetests | |
- name: Correct Ownership in GITHUB_WORKSPACE directory | |
uses: peter-murray/reset-workspace-ownership-action@v1 | |
with: | |
user_id: ${{ env.runner_uid }} | |
- name: Upload Test Report | |
uses: actions/upload-artifact@v3 | |
if: always() # always run even if the previous step fails | |
with: | |
name: junit-qbft-reference-test-results | |
path: '**/build/test-results/referenceTests/TEST-*.xml' | |
retention-days: 1 |