diff --git a/.github/actions/build-artifacts/cache/action.yml b/.github/actions/build-artifacts/cache/action.yml deleted file mode 100644 index 985385c5f9..0000000000 --- a/.github/actions/build-artifacts/cache/action.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Cache build artifacts -description: Cache build artifacts - -runs: - using: composite - steps: - - name: Cache build artifacts - uses: actions/cache/save@v4 - with: - path: | - ./packages/arb-token-bridge-ui/build - key: build-artifacts-${{ github.run_id }} diff --git a/.github/actions/build-artifacts/restore/action.yml b/.github/actions/build-artifacts/restore/action.yml deleted file mode 100644 index 43c73f6462..0000000000 --- a/.github/actions/build-artifacts/restore/action.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Restore build artifacts -description: Restore build artifacts - -runs: - using: composite - steps: - - name: Restore build artifacts - uses: actions/cache/restore@v4 - with: - path: | - ./packages/arb-token-bridge-ui/build - key: build-artifacts-${{ github.run_id }} - fail-on-cache-miss: true diff --git a/.github/actions/restore-build-artifacts/action.yml b/.github/actions/restore-build-artifacts/action.yml new file mode 100644 index 0000000000..070f4cdbc6 --- /dev/null +++ b/.github/actions/restore-build-artifacts/action.yml @@ -0,0 +1,13 @@ +name: Restore build artifacts +description: Restore build artifacts + +runs: + using: composite + steps: + - name: Restore build artifacts + uses: actions/cache/restore@v4 + with: + path: | + ./packages/arb-token-bridge-ui/build + key: build-artifacts-${{ github.run_id }} + fail-on-cache-miss: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..435ccf8b20 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +name: Cache build artifacts + +on: + workflow_call: + +env: + NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }} + NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID }} + THE_GRAPH_NETWORK_API_KEY: ${{ secrets.THE_GRAPH_NETWORK_API_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + check-build-cache: + name: Check cache for build artifacts + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check cache for build artifacts + id: cache + uses: actions/cache/restore@v4 + with: + path: | + ./packages/arb-token-bridge-ui/build + key: build-artifacts-${{ github.run_id }} + + - name: Install node_modules + if: steps.cache.outputs.cache-hit != 'true' + uses: OffchainLabs/actions/node-modules/install@main + + - name: Build + if: steps.cache.outputs.cache-hit != 'true' + shell: bash + run: yarn build + env: + NEXT_PUBLIC_IS_E2E_TEST: true + NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }} + NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID }} + THE_GRAPH_NETWORK_API_KEY: ${{ secrets.THE_GRAPH_NETWORK_API_KEY }} + + - name: Cache build artifacts + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + ./packages/arb-token-bridge-ui/build + key: build-artifacts-${{ github.run_id }} diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 0c10ac5227..373f26b16b 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -27,9 +27,14 @@ jobs: - id: set-matrix run: echo "e2eFiles=$(node .github/workflows/formatSpecfiles.js ${{ inputs.test_type }} | jq . --compact-output)" >> $GITHUB_OUTPUT + build: + name: 'Build' + uses: ./.github/workflows/build.yml + secrets: inherit + test-e2e: name: "${{ matrix.test.name }}${{ matrix.test.type == 'orbit-eth' && ' with L3' || matrix.test.type == 'orbit-custom' && ' with custom fee token' || ''}}" - needs: [load-e2e-files] + needs: [build, load-e2e-files] runs-on: ubuntu-latest strategy: fail-fast: false @@ -69,7 +74,7 @@ jobs: uses: OffchainLabs/actions/node-modules/install@main - name: Restore build artifacts - uses: ./.github/actions/build-artifacts/restore + uses: ./.github/actions/restore-build-artifacts - name: Install cypress run: yarn cypress install diff --git a/.github/workflows/run-cctp-tests.yml b/.github/workflows/run-cctp-tests.yml index 0261fa8006..6d65733c06 100644 --- a/.github/workflows/run-cctp-tests.yml +++ b/.github/workflows/run-cctp-tests.yml @@ -15,30 +15,8 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - build: - name: "Build" - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install node_modules - uses: OffchainLabs/actions/node-modules/install@main - - - name: Build - run: yarn build - env: - NEXT_PUBLIC_IS_E2E_TEST: true - NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }} - NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID }} - THE_GRAPH_NETWORK_API_KEY: ${{ secrets.THE_GRAPH_NETWORK_API_KEY }} - - - name: Cache build artifacts - uses: ./.github/actions/build-artifacts/cache - cctp-e2e-tests: name: "CCTP E2E Tests" - needs: [build] uses: ./.github/workflows/e2e-tests.yml with: test_type: 'cctp' diff --git a/.github/workflows/build-test.yml b/.github/workflows/test.yml similarity index 80% rename from .github/workflows/build-test.yml rename to .github/workflows/test.yml index e99b5f4bb6..deaed087a8 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Build, Test +name: Test on: pull_request: @@ -35,26 +35,10 @@ jobs: id: check-files build: - name: "Build" - runs-on: ubuntu-latest - if: needs.check-files.outputs.run_tests == 'true' && ${{ !contains(github.event.pull_request.title, 'hotfix') }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install node_modules - uses: OffchainLabs/actions/node-modules/install@main - - - name: Build - run: yarn build - env: - NEXT_PUBLIC_IS_E2E_TEST: true - NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }} - NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID }} - THE_GRAPH_NETWORK_API_KEY: ${{ secrets.THE_GRAPH_NETWORK_API_KEY }} - - - name: Cache build artifacts - uses: ./.github/actions/build-artifacts/cache + name: 'Build' + needs: [check-files] + uses: ./.github/workflows/build.yml + secrets: inherit test-ui: name: "Test UI" @@ -69,7 +53,7 @@ jobs: uses: OffchainLabs/actions/node-modules/install@main - name: Restore build artifacts - uses: ./.github/actions/build-artifacts/restore + uses: ./.github/actions/restore-build-artifacts - name: Start UI and Test run: yarn start-server-and-test 'start' http://127.0.0.1:3000 'yarn test:ci' @@ -77,7 +61,6 @@ jobs: audit: name: "Audit" runs-on: ubuntu-latest - needs: build steps: - name: Checkout uses: actions/checkout@v4 @@ -91,7 +74,6 @@ jobs: check-formatting: name: "Check Formatting" runs-on: ubuntu-latest - needs: build steps: - name: Checkout uses: actions/checkout@v4