-
Notifications
You must be signed in to change notification settings - Fork 203
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
test: Run cctp tests on approval #1890
Changes from 8 commits
a84b47a
139647b
c74849f
8a41e8b
3c6db03
6c52ed5
7460b6e
8f9cfad
21a648b
9ce3b0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
name: Build, Test | ||
|
||
run-name: CI check | ||
on: | ||
pull_request_review: | ||
types: | ||
- submitted | ||
Comment on lines
+4
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
issue_comment: | ||
types: | ||
- created | ||
pull_request: | ||
branches: ["master"] | ||
types: | ||
|
@@ -14,8 +20,6 @@ on: | |
|
||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency | ||
concurrency: | ||
# github.workflow: name of the workflow | ||
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
|
@@ -142,25 +146,64 @@ jobs: | |
- name: Check formatting with ESLint | ||
run: yarn lint | ||
|
||
dismiss-previous-e2e-check: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we already have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This serve something different. We don't want to remove it from the checks display when a PR is approved so we don't have duplicate |
||
name: "Dismiss Previous E2E Check" | ||
runs-on: ubuntu-latest | ||
if: github.event.review.state == 'approved' | ||
steps: | ||
- name: Dismiss previous E2E check run | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const sha = context.payload.pull_request.head.sha; | ||
|
||
const checkRuns = await github.rest.checks.listForRef({ | ||
owner, | ||
repo, | ||
ref: sha, | ||
check_name: 'Test E2E' | ||
}); | ||
|
||
for (const checkRun of checkRuns.data.check_runs) { | ||
await github.rest.checks.update({ | ||
owner, | ||
repo, | ||
check_run_id: checkRun.id, | ||
status: 'completed', | ||
conclusion: 'cancelled', | ||
output: { | ||
title: 'Previous E2E Check Dismissed', | ||
summary: 'This E2E check was dismissed due to PR approval. A new E2E check will be initiated.' | ||
} | ||
}); | ||
} | ||
|
||
load-e2e-files: | ||
name: "Load e2e files" | ||
runs-on: ubuntu-latest | ||
needs: [check-is-hotfix] | ||
if: needs.check-is-hotfix.outputs.is_hotfix == 'false' | ||
if: | | ||
needs.check-is-hotfix.outputs.is_hotfix == 'false' && | ||
(github.event_name != 'pull_request_review' || github.event.review.state == 'approved') | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.e2eFiles }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- id: set-matrix | ||
run: echo "e2eFiles=$(node .github/workflows/formatSpecfiles.js | jq . --compact-output)" >> $GITHUB_OUTPUT | ||
run: echo "e2eFiles=$(node .github/workflows/formatSpecfiles.js ${{ (github.event.review.state == 'approved' || github.event.comment.body == '/cctp') && 'includeCctp' || '' }} | jq . --compact-output)" >> $GITHUB_OUTPUT | ||
|
||
test-e2e: | ||
name: "Test E2E ${{ (matrix.test.type == 'cctp' && 'CCTP') || (matrix.test.orbitTest == '1' && 'with L3') || '' }} - ${{ matrix.test.name }}" | ||
runs-on: ubuntu-latest | ||
needs: [build, check-files, check-is-hotfix, load-e2e-files] | ||
if: needs.check-files.outputs.run_tests == 'true' && needs.check-is-hotfix.outputs.is_hotfix == 'false' | ||
if: | | ||
needs.check-files.outputs.run_tests == 'true' && | ||
needs.check-is-hotfix.outputs.is_hotfix == 'false' && | ||
(github.event_name != 'pull_request_review' || github.event.review.state == 'approved') | ||
strategy: | ||
fail-fast: false # If one test fails, let the other tests run | ||
matrix: | ||
|
@@ -256,15 +299,42 @@ jobs: | |
name: "Test E2E Success" | ||
runs-on: ubuntu-latest | ||
needs: [test-e2e] | ||
if: always() | ||
if: | | ||
always() && | ||
(github.event_name != 'pull_request_review' || github.event.review.state == 'approved') | ||
steps: | ||
- name: Update E2E check run | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const sha = context.payload.pull_request ? context.payload.pull_request.head.sha : context.sha; | ||
|
||
const conclusion = '${{ needs.test-e2e.result }}' === 'success' ? 'success' : 'failure'; | ||
|
||
await github.rest.checks.create({ | ||
owner, | ||
repo, | ||
head_sha: sha, | ||
name: 'Test E2E', | ||
status: 'completed', | ||
conclusion: conclusion, | ||
output: { | ||
title: 'E2E Test Results', | ||
summary: `The E2E tests have ${conclusion === 'success' ? 'passed' : 'failed'}.` | ||
} | ||
}); | ||
|
||
- name: E2E Succeeded | ||
if: needs.test-e2e.result == 'success' || needs.test-e2e.result == 'skipped' | ||
run: echo "nice" | ||
run: echo "E2E tests passed" | ||
|
||
- name: E2E Failed | ||
if: needs.test-e2e.result != 'success' && needs.test-e2e.result != 'skipped' | ||
run: exit 1 | ||
|
||
|
||
clean-up: | ||
name: "Clean Up" | ||
runs-on: ubuntu-latest | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
#!/usr/bin/env node | ||
const specFiles = require('../../packages/arb-token-bridge-ui/tests/e2e/specfiles.json') | ||
const cctpFiles = require('../../packages/arb-token-bridge-ui/tests/e2e/cctp.json') | ||
const specFiles = require("../../packages/arb-token-bridge-ui/tests/e2e/specfiles.json"); | ||
const cctpFiles = require("../../packages/arb-token-bridge-ui/tests/e2e/cctp.json"); | ||
|
||
// For each test in specFiles, add an orbit test | ||
const tests = [] | ||
specFiles.forEach(spec => { | ||
tests.push({ | ||
...spec, | ||
type: 'regular', | ||
orbitTest: '0', | ||
}) | ||
tests.push({ | ||
...spec, | ||
type: 'regular', | ||
orbitTest: '1', | ||
}) | ||
}) | ||
const tests = []; | ||
specFiles.forEach((spec) => { | ||
tests.push({ | ||
...spec, | ||
type: "regular", | ||
orbitTest: "0", | ||
}); | ||
tests.push({ | ||
...spec, | ||
type: "regular", | ||
orbitTest: "1", | ||
}); | ||
}); | ||
|
||
cctpFiles.forEach(spec => { | ||
const includeCctp = Boolean(process.argv[2] === "includeCctp" || false); | ||
if (includeCctp) { | ||
cctpFiles.forEach((spec) => { | ||
tests.push({ | ||
...spec, | ||
type: 'cctp', | ||
orbitTest: null, | ||
}) | ||
}) | ||
...spec, | ||
type: "cctp", | ||
orbitTest: null, | ||
}); | ||
}); | ||
} | ||
|
||
console.log(JSON.stringify(tests)) | ||
console.log(JSON.stringify(tests)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this added? now "Build, Test" is changed to "CI check"
https://github.com/OffchainLabs/arbitrum-token-bridge/actions/workflows/build-test.yml