Skip to content

Commit

Permalink
removes checking for approval, runs on pr update
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Florentine <[email protected]>
  • Loading branch information
jflo committed Mar 8, 2024
1 parent 7c39ff3 commit 5c22602
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 82 deletions.
46 changes: 1 addition & 45 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,19 @@ on:
branches:
- main
- release-*
pull_request_review:
types: [submitted]

env:
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.daemon=false"
total-runners: 16

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
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 }}
EVENT_NAME: ${{ github.event_name }}
with:
script: |
const { RELEVANT_SHA } = process.env;
const { EVENT_NAME } = process.env;
if(EVENT_NAME === 'workflow_dispatch') {
return true;
}
const { data: { statuses } } = await github.rest.repos.getCombinedStatusForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: RELEVANT_SHA,
});
const acceptanceTested = statuses && statuses.filter(({ context }) => context === 'accepttests-passed');
const alreadyRun = acceptanceTested && acceptanceTested.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;
acceptanceTestEthereum:
runs-on: ubuntu-22.04
name: "Acceptance Runner"
needs: shouldRun
permissions:
statuses: write
checks: write
if: ${{ needs.shouldRun.outputs.shouldRun == 'true'}}
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -117,6 +72,7 @@ jobs:
report_paths: 'acceptance-tests/tests/build/test-results/**/TEST-*.xml'
annotate_only: true
accepttests-passed:
name: "accepttests-passed"
runs-on: ubuntu-22.04
needs: [ acceptanceTestEthereum ]
permissions:
Expand Down
38 changes: 1 addition & 37 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,10 @@ env:
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.daemon=false"

jobs:
shouldRun:
name: checks to ensure we should run
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 intTested = statuses && statuses.filter(({ context }) => context === 'integration-tests');
const alreadyRun = intTested && intTested.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;
integration-tests:
name: "integration-passed"
runs-on: ubuntu-22.04
needs: shouldRun
if: ${{ needs.shouldRun.outputs.shouldRun == 'true' }}
permissions:
statuses: write
checks: write
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pre-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
report_paths: '**/test-results/**/TEST-*.xml'
annotate_only: true
unittests-passed:
name: "unittests-passed"
runs-on: ubuntu-22.04
needs: [unitTests]
permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reference-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ jobs:
report_paths: '**/build/test-results/referenceTests/TEST-*.xml'
annotate_only: true
reftests-passed:
name: "reftests-passed"
runs-on: ubuntu-22.04
needs: [ referenceTestEthereum ]
permissions:
Expand Down

0 comments on commit 5c22602

Please sign in to comment.