Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consolidate status to get rid of shard-specific ones #33

Merged
merged 14 commits into from
Jan 10, 2024
35 changes: 21 additions & 14 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: acceptance-tests
on:
workflow_dispatch:
workflow_call:
pull_request:
pull_request_review:
types: [submitted]

Expand All @@ -12,6 +11,8 @@ env:
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}}
Expand All @@ -30,21 +31,18 @@ jobs:
repo: context.repo.repo,
ref: RELEVANT_SHA,
});
const unitTested = statuses && statuses.filter(({ context }) => context === 'pre-review');
const failedUnits = unitTested && unitTested.filter(({state}) => state === 'failure' || state === 'pending');
const acceptanceTested = statuses && statuses.filter(({ context }) => context === 'acceptance-tests');
const acceptanceTested = statuses && statuses.filter(({ context }) => context === 'acceptance-tested');
const alreadyRun = acceptanceTested && acceptanceTested.find(({ state }) => state === 'success' || state === 'pending') > 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]' && (failedUnits.length === 0) && (approvingReviews.length > 0);
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("failedUnits = %j", failedUnits.length);
console.log("approvingReviews = %j", approvingReviews.length);

return shouldRun;
Expand All @@ -63,6 +61,7 @@ jobs:
with:
status: pending
sha: ${{ github.event.pull_request.head.sha || github.sha }}
context: acceptance-tested
acceptanceTestEthereum:
runs-on: ubuntu-22.04
needs: pend
Expand Down Expand Up @@ -114,15 +113,9 @@ jobs:
if: failure()
with:
status: ${{ job.status }}
context: acceptance-tests-${{matrix.runner_index}}
context: acceptance-tested
sha: ${{ github.event.pull_request.head.sha || github.sha }}
description: fail acceptance test batch ${{matrix.runner_index}}
- name: flag passed unit tests
uses: myrotvorets/[email protected]
if: success()
with:
status: ${{ job.status }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}
- name: cleanup tempfiles
run: rm testList.txt gradleArgs.txt
- name: Upload Acceptance Test Results
Expand All @@ -135,3 +128,17 @@ jobs:
if: (success() || failure()) # always run even if the build step fails
with:
report_paths: 'acceptance-tests/tests/build/test-results/acceptanceTest/TEST-*.xml'
consolidateStatus:
runs-on: ubuntu-22.04
needs: acceptanceTestEthereum
permissions:
statuses: write
checks: write
steps:
- name: status success
uses: myrotvorets/[email protected]
with:
sha: ${{ github.event.pull_request.head.sha || github.sha }}
status: success
context: acceptance-tested
description: acceptance tests passed
16 changes: 7 additions & 9 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: integration-tests
on:
workflow_dispatch:
workflow_call:
pull_request:
pull_request_review:
types:
- submitted
Expand Down Expand Up @@ -30,21 +29,19 @@ jobs:
repo: context.repo.repo,
ref: RELEVANT_SHA,
});
const unitTested = statuses && statuses.filter(({ context }) => context === 'pre-review');
const failedUnits = unitTested && unitTested.filter(({state}) => state === 'failure' || state === 'pending');
const intTested = statuses && statuses.filter(({ context }) => context === 'integration-tests');

const intTested = statuses && statuses.filter(({ context }) => context === 'integration-tested');
const alreadyRun = intTested && intTested.find(({ state }) => state === 'success' || state === 'pending') > 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]' && (failedUnits.length === 0) && (approvingReviews.length > 0);
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("failedUnits = %j", failedUnits.length);
console.log("approvingReviews = %j", approvingReviews.length);

return shouldRun;
Expand All @@ -60,6 +57,7 @@ jobs:
uses: myrotvorets/[email protected]
with:
status: pending
context: integration-tested
sha: ${{ github.event.pull_request.head.sha || github.sha }}
integrationTest:
runs-on: ubuntu-22.04
Expand All @@ -80,11 +78,11 @@ jobs:
uses: gradle/gradle-build-action@v2
- name: run integration tests
run: ./gradlew integrationTest -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: flag passed unit tests
- name: flag passed integration tests
uses: myrotvorets/[email protected]
if: success()
with:
status: ${{ job.status }}
context: integration-tested
sha: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/pre-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ env:
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true

jobs:
pend:
name: unit testing pending
runs-on: ubuntu-22.04
steps:
- name: pending
uses: myrotvorets/[email protected]
with:
status: pending
repolint:
name: "Repository Linting"
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -97,31 +89,9 @@ jobs:
- name: run unit tests
id: unitTest
run: ./gradlew $GRADLEW_UNIT_TEST_ARGS -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: flag failed unit tests
uses: myrotvorets/[email protected]
if: failure()
with:
status: ${{ job.status }}
context: unit-tests-${{matrix.gradle_args}}
description: ${{matrix.gradle_args}}
- name: flag passed unit tests
uses: myrotvorets/[email protected]
if: success()
with:
status: ${{ job.status }}

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the build step fails
with:
report_paths: '**/test-results/test/TEST-*.xml'
annotate_only: true
acceptanceTest:
needs: unitTests
uses: ./.github/workflows/acceptance-tests.yml
integrationTest:
needs: unitTests
uses: ./.github/workflows/integration-tests.yml
referenceTest:
needs: unitTests
uses: ./.github/workflows/reference-tests.yml
44 changes: 33 additions & 11 deletions .github/workflows/reference-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: reference-tests
on:
workflow_dispatch:
workflow_call:
pull_request:
pull_request_review:
types:
- submitted
Expand All @@ -13,6 +12,8 @@ env:
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}}
Expand All @@ -31,21 +32,20 @@ jobs:
repo: context.repo.repo,
ref: RELEVANT_SHA,
});
const unitTested = statuses && statuses.filter(({ context }) => context === 'pre-review');
const failedUnits = unitTested && unitTested.filter(({state}) => state === 'failure' || state === 'pending');
const refTested = statuses && statuses.filter(({ context }) => context === 'reference-tests');


const refTested = statuses && statuses.filter(({ context }) => context === 'reference-tested');
const alreadyRun = refTested && refTested.find(({ state }) => state === 'success' || state === 'pending') > 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]' && (failedUnits.length === 0) && (approvingReviews.length > 0);
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("failedUnits = %j", failedUnits.length);
console.log("approvingReviews = %j", approvingReviews.length);

return shouldRun;
Expand All @@ -62,6 +62,7 @@ jobs:
with:
status: pending
sha: ${{ github.event.pull_request.head.sha || github.sha }}
context: reference-tested
prepareReferenceTestEthereum:
runs-on: ubuntu-22.04
needs: shouldRun
Expand Down Expand Up @@ -98,7 +99,7 @@ jobs:
strategy:
fail-fast: false
matrix:
runner-index: [0,1,2,3,4,5]
runner_index: [0,1,2,3,4,5]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
Expand Down Expand Up @@ -131,21 +132,42 @@ jobs:
reports: tmp/ref-xml-reports-downloaded
glob: 'ethereum/referencetests/build/generated/sources/reference-test/**/*.java'
total: ${{env.total-runners}}
index: ${{ matrix.runner-index }}
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: flag failed reference tests
uses: myrotvorets/[email protected]
if: failure()
with:
status: ${{ job.status }}
context: reference-tested
sha: ${{ github.event.pull_request.head.sha || github.sha }}
description: fail reference test batch ${{matrix.runner_index}}
- name: Upload Test Report
uses: actions/upload-artifact@v3
if: always() # always run even if the previous step fails
with:
name: reference-test-node-${{matrix.runner-index}}-results
name: reference-test-node-${{matrix.runner_index}}-results
path: '**/build/test-results/referenceTests/TEST-*.xml'
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the build step fails
with:
report_paths: '**/build/test-results/referenceTest/TEST-*.xml'

consolidateStatus:
runs-on: ubuntu-22.04
needs: referenceTestEthereum
permissions:
statuses: write
checks: write
steps:
- name: status success
uses: myrotvorets/[email protected]
with:
sha: ${{ github.event.pull_request.head.sha || github.sha }}
status: success
context: reference-tested
description: reference tests passed