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

ci: move out build run #1926

Merged
merged 23 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions .github/actions/build-artifacts/cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,55 @@
name: Cache build artifacts
description: Cache build artifacts

runs:
using: composite
steps:
on:
workflow_call:
secrets:
NEXT_PUBLIC_INFURA_KEY:
description: 'Infura key'
required: true
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID:
description: 'WalletConnect project id'
required: true
THE_GRAPH_NETWORK_API_KEY:
description: 'The Graph network API key'
required: true
GITHUB_TOKEN:
description: 'GitHub token'
required: true

jobs:
check-build-cache:
name: Check cache for build artifacts
runs-on: ubuntu-latest
secrets: inherit
steps:
- 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: Checkout
uses: actions/checkout@v4

- 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: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main

- name: Restore build artifacts
uses: ./.github/actions/build-artifacts/restore
- name: Create build or restore build artifacts
uses: ./.github/actions/build-artifacts/cache

- name: Install cypress
run: yarn cypress install
Expand Down Expand Up @@ -118,4 +118,4 @@ jobs:
then
gh actions-cache delete build-artifacts-${{ github.run_id }}-${{ github.run_attempt }} --confirm
fi
shell: bash
shell: bash
25 changes: 1 addition & 24 deletions .github/workflows/run-cctp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,9 @@ jobs:
echo "should_run=false" >> $GITHUB_OUTPUT
fi

build:
name: "Build"
runs-on: ubuntu-latest
needs: [should-run-tests]
if: needs.should-run-tests.outputs.should_run == 'true'
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, check-files]
needs: [check-files]
uses: ./.github/workflows/e2e-tests.yml
with:
test_type: 'cctp'
Expand Down
37 changes: 7 additions & 30 deletions .github/workflows/build-test.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build, Test
name: Test

on:
pull_request:
Expand Down Expand Up @@ -34,32 +34,10 @@ jobs:
- uses: ./.github/actions/check-files
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

test-ui:
name: "Test UI"
runs-on: ubuntu-latest
needs: [build, check-files]
needs: [check-files]
if: needs.check-files.outputs.run_tests == 'true'
steps:
- name: Checkout
Expand All @@ -68,16 +46,16 @@ jobs:
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main

- name: Restore build artifacts
uses: ./.github/actions/build-artifacts/restore

- name: Create build or restore build artifacts

uses: ./.github/actions/build-artifacts/cache

chrstph-dvx marked this conversation as resolved.
Show resolved Hide resolved
- name: Start UI and Test
run: yarn start-server-and-test 'start' http://127.0.0.1:3000 'yarn test:ci'

audit:
name: "Audit"
runs-on: ubuntu-latest
needs: build
steps:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it never needed the build files

- name: Checkout
uses: actions/checkout@v4
Expand All @@ -91,7 +69,6 @@ jobs:
check-formatting:
name: "Check Formatting"
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -107,7 +84,7 @@ jobs:

e2e-tests:
name: "E2E Tests"
needs: [build, check-files]
needs: [check-files]
uses: ./.github/workflows/e2e-tests.yml
with:
test_type: 'regular'
Expand Down
Loading