Skip to content

Commit

Permalink
ci: move out build run
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan committed Sep 25, 2024
1 parent 4cc23f7 commit d0f15fc
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 52 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build

on:
pull_request:
branches: ["master"]
types:
- opened
- edited
- synchronize
push:
branches: ["master"]
workflow_dispatch:
merge_group:

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:
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
4 changes: 3 additions & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E tests

on:
workflow_run:
workflows: ["Build"]
workflow_call:
inputs:
test_type:
Expand Down Expand Up @@ -118,4 +120,4 @@ jobs:
then
gh actions-cache delete build-artifacts-${{ github.run_id }}-${{ github.run_attempt }} --confirm
fi
shell: bash
shell: bash
27 changes: 3 additions & 24 deletions .github/workflows/run-cctp-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: PR approved workflow

on:
workflow_run:
workflows: ["Build"]
workflow_dispatch:
pull_request_review:
types:
Expand Down Expand Up @@ -49,32 +51,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
32 changes: 5 additions & 27 deletions .github/workflows/build-test.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build, Test
name: Test

on:
workflow_run:
workflows: ["Build"]
pull_request:
branches: ["master"]
types:
Expand Down Expand Up @@ -34,32 +36,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 @@ -77,7 +57,6 @@ jobs:
audit:
name: "Audit"
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -91,7 +70,6 @@ jobs:
check-formatting:
name: "Check Formatting"
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -107,7 +85,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

0 comments on commit d0f15fc

Please sign in to comment.