diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..af8cf60744 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 00e68cc1d5..08e237e9b4 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,6 +1,8 @@ name: E2E tests on: + workflow_run: + workflows: ["Build"] workflow_call: inputs: test_type: @@ -118,4 +120,4 @@ jobs: then gh actions-cache delete build-artifacts-${{ github.run_id }}-${{ github.run_attempt }} --confirm fi - shell: bash \ No newline at end of file + shell: bash diff --git a/.github/workflows/run-cctp-tests.yml b/.github/workflows/run-cctp-tests.yml index f830ce567f..081023d7b1 100644 --- a/.github/workflows/run-cctp-tests.yml +++ b/.github/workflows/run-cctp-tests.yml @@ -1,6 +1,8 @@ name: PR approved workflow on: + workflow_run: + workflows: ["Build"] workflow_dispatch: pull_request_review: types: @@ -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' diff --git a/.github/workflows/build-test.yml b/.github/workflows/test.yml similarity index 74% rename from .github/workflows/build-test.yml rename to .github/workflows/test.yml index 00a3a4f2cd..9fa5f37ce1 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,8 @@ -name: Build, Test +name: Test on: + workflow_run: + workflows: ["Build"] pull_request: branches: ["master"] types: @@ -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 @@ -77,7 +57,6 @@ jobs: audit: name: "Audit" runs-on: ubuntu-latest - needs: build steps: - name: Checkout uses: actions/checkout@v4 @@ -91,7 +70,6 @@ jobs: check-formatting: name: "Check Formatting" runs-on: ubuntu-latest - needs: build steps: - name: Checkout uses: actions/checkout@v4 @@ -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'