Skip to content

fix: require approval on L2 for saETH #6463

fix: require approval on L2 for saETH

fix: require approval on L2 for saETH #6463

Workflow file for this run

name: Build, Test
on:
pull_request:
branches: ["master"]
types:
- opened
- edited
- synchronize
push:
branches: ["master"]
workflow_dispatch:
merge_group:
# 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
env:
NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }}
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID }}
NEXT_PUBLIC_CCTP_SUBGRAPH_BASE_URL: ${{ secrets.NEXT_PUBLIC_CCTP_SUBGRAPH_BASE_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_HOTFIX: ${{ contains(github.event.pull_request.title, 'hotfix') }}
jobs:
check-is-hotfix:
name: Check if PR is hotfix
runs-on: ubuntu-latest
outputs:
is_hotfix: ${{ steps.check-is-hotfix.outputs.is_hotfix }}
steps:
- name: Make IS_HOTFIX env var global
id: check-is-hotfix
run: |
echo "is_hotfix=${{ env.IS_HOTFIX }}" >> $GITHUB_OUTPUT
check-files:
name: Check files
outputs:
run_tests: ${{ steps.check-files.outputs.run_tests }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
# run tests only if specific files are changed
- name: Check modified files
id: check-files
run: |
echo "=============== list modified files ==============="
files=`git diff --name-only HEAD^ HEAD`
echo "$files"
for file in $files; do
if [[ $file != packages/* ]] && ! [[ $file =~ .*\.(lock|yml)$ ]]; then
# if not in packages/ and does not end with .lock or .yml
echo "run_tests=false" >> $GITHUB_OUTPUT
elif [[ $file == .github/ISSUE_TEMPLATE/* ]]; then
echo "run_tests=false" >> $GITHUB_OUTPUT
elif [[ $file =~ .*\.(md|svg|png|webp|gif|txt)$ ]]; then
echo "run_tests=false" >> $GITHUB_OUTPUT
else
echo "run_tests=true" >> $GITHUB_OUTPUT
break
fi
done
shell: bash
install:
name: "Install"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
build:
name: "Build"
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore node_modules
uses: OffchainLabs/actions/node-modules/restore@main
- name: Build
run: yarn build
- name: Cache build artifacts
uses: ./.github/actions/build-artifacts/cache
test-ui:
name: "Test UI"
runs-on: ubuntu-latest
needs: [build, check-files]
if: needs.check-files.outputs.run_tests == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore node_modules
uses: OffchainLabs/actions/node-modules/restore@main
- name: Restore build artifacts
uses: ./.github/actions/build-artifacts/restore
- name: Start UI and Test
run: yarn start-server-and-test 'dev' http://localhost:3000 'yarn test:ci'
audit:
name: "Audit"
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore node_modules
uses: OffchainLabs/actions/node-modules/restore@main
- name: Run audit
run: yarn audit:ci
check-formatting:
name: "Check Formatting"
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore node_modules
uses: OffchainLabs/actions/node-modules/restore@main
- name: Check formatting with Prettier
run: yarn prettier:check
- name: Check formatting with ESLint
run: yarn lint
load-e2e-files:
name: "Load e2e files"
runs-on: ubuntu-latest
needs: [install, check-is-hotfix]
if: needs.check-is-hotfix.outputs.is_hotfix == 'false'
outputs:
matrix: ${{ steps.set-matrix.outputs.e2eFiles }}
steps:
- name: Checkout
uses: actions/checkout@v3
- id: set-matrix
run: |
content=`cat packages/arb-token-bridge-ui/tests/e2e/specfiles.json | jq --compact-output .`
echo "e2eFiles=$content" >> $GITHUB_OUTPUT
test-e2e:
name: "Test E2E"
runs-on: ubuntu-latest
needs: [install, check-files, check-is-hotfix, load-e2e-files]
if: needs.check-files.outputs.run_tests == 'true' && needs.check-is-hotfix.outputs.is_hotfix == 'false'
strategy:
fail-fast: false # If one test fails, let the other tests run
matrix:
tests:
${{ fromJson(needs.load-e2e-files.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Chown workspace
run: chown -R $(whoami) .
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # pin@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # pin@v1
- name: Cache Docker layers
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # pin@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-
- name: Make .e2e.env
uses: SpicyPizza/[email protected]
with:
envkey_PRIVATE_KEY_CUSTOM: ${{ secrets.E2E_PRIVATE_KEY }}
envkey_PRIVATE_KEY_USER: ${{ secrets.E2E_PRIVATE_KEY_USER }}
envkey_NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }}
envkey_CYPRESS_RECORD_VIDEO: ${{ matrix.tests.recordVideo }}
envkey_SKIP_METAMASK_SETUP: true
envkey_NEXT_PUBLIC_LOCAL_ETHEREUM_RPC_URL: http://geth:8545
envkey_NEXT_PUBLIC_LOCAL_ARBITRUM_RPC_URL: http://sequencer:8547
envkey_TEST_FILE: ${{ matrix.tests.file }}
envkey_NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID }}
envkey_NEXT_PUBLIC_CCTP_SUBGRAPH_BASE_URL: ${{ secrets.NEXT_PUBLIC_CCTP_SUBGRAPH_BASE_URL }}
directory: ./packages/arb-token-bridge-ui/
file_name: .e2e.env
- name: Make .env
uses: SpicyPizza/[email protected]
with:
envkey_NEXT_PUBLIC_IS_E2E_TEST: true
envkey_NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }}
envkey_NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID }}
envkey_NEXT_PUBLIC_CCTP_SUBGRAPH_BASE_URL: ${{ secrets.NEXT_PUBLIC_CCTP_SUBGRAPH_BASE_URL }}
directory: ./packages/arb-token-bridge-ui/
file_name: .env
- name: Make synpress .env
uses: SpicyPizza/[email protected]
with:
envkey_CYPRESS_GROUP: medium-resolution
envkey_DISPLAY_HEIGHT: 768
envkey_DISPLAY_WIDTH: 1366
envkey_SE_SCREEN_HEIGHT: 768
envkey_SE_SCREEN_WIDTH: 1366
file_name: medium-res.env
- name: Set up the local node
uses: OffchainLabs/actions/run-nitro-test-node@e3b7f5bdfc62cad21026c1d1f424f3fbadc046e0
with:
nitro-testnode-ref: old-release-v2.1.1
- name: Restore node_modules
uses: OffchainLabs/actions/node-modules/restore@main
- name: Run e2e tests
id: e2e-run
run: |
docker-compose -f docker-compose.ci.yml --env-file medium-res.env up --build synpress
exitcode=$(docker wait synpress-test)
if [[ $exitcode -eq 0 ]]; then
echo "status=success" >> $GITHUB_OUTPUT
else
echo "status=failed" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
DOCKER_DEFAULT_PLATFORM: linux/amd64
- name: Create screenshots directory
if: steps.e2e-run.outputs.status == 'failed'
run: mkdir -p packages/arb-token-bridge-ui/tests/e2e/cypress/screenshots
- name: Copy screenshots from docker container volumes
if: steps.e2e-run.outputs.status == 'failed'
run: |
docker cp synpress-test:/app/packages/arb-token-bridge-ui/cypress/screenshots packages/arb-token-bridge-ui/tests/e2e/cypress/screenshots
- name: Upload screenshots results
if: steps.e2e-run.outputs.status == 'failed'
uses: actions/upload-artifact@v4
with:
name: failed-e2e-screenshots-${{ fromJSON(toJSON(matrix.tests)).name }}
path: packages/arb-token-bridge-ui/tests/e2e/cypress/screenshots
- name: Create videos directory
if: matrix.tests.recordVideo == 'true'
run: mkdir -p packages/arb-token-bridge-ui/tests/e2e/cypress/videos
- name: Copy videos from docker container volumes
if: matrix.tests.recordVideo == 'true'
run: |
docker cp synpress-test:/app/packages/arb-token-bridge-ui/cypress/videos packages/arb-token-bridge-ui/tests/e2e/cypress/videos
- name: Upload videos results
if: matrix.tests.recordVideo == 'true'
uses: actions/upload-artifact@v4
with:
name: e2e-videos-${{ fromJSON(toJSON(matrix.tests)).name }}
path: packages/arb-token-bridge-ui/tests/e2e/cypress/videos
compression-level: 0
retention-days: 3
- name: Throw error if tests failed
if: steps.e2e-run.outputs.status == 'failed'
run: exit 1
test-e2e-success:
name: "Test E2E Success"
runs-on: ubuntu-latest
needs: [test-e2e]
if: always()
steps:
- name: E2E Succeeded
if: needs.test-e2e.result == 'success' || needs.test-e2e.result == 'skipped'
run: echo "nice"
- 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
needs: [test-ui]
if: always()
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install gh-actions-cache
run: gh extension install actions/gh-actions-cache
- name: Delete build artifacts
run: |
if gh actions-cache list | grep build-artifacts-${{ github.run_id }}-${{ github.run_attempt }}
then
gh actions-cache delete build-artifacts-${{ github.run_id }}-${{ github.run_attempt }} --confirm
fi
shell: bash