From c5db3e4a4de5c45031f3e41b060eaf4a535a06ee Mon Sep 17 00:00:00 2001 From: Furina de Fontaine Date: Thu, 13 Nov 2025 15:07:00 +0800 Subject: [PATCH] chore(ci): optimize build test workflow - Temporarily commented out build_image since it has no use for now - Add npm run build to test if app builds correctly and skip e2e_tests if it fails --- .github/workflows/build-test.yml | 53 +++++++++++++++++--------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7e82477e2..262ea679b 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -13,32 +13,32 @@ permissions: contents: read jobs: - build_image: - name: Build image - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - # The image is not pushed anywhere at the moment but serves the following purposes: - # (a) performs the npm run build when building the image, and - # (b) acts as a placeholder if we want to deploy as a container in the future. - - name: Build the image - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 - with: - context: . - platforms: linux/amd64 - push: false - build-args: | - HEAD_COMMIT_HASH=${{ github.sha }} - tags: | - ghcr.io/${{ github.repository_owner }}/bettergov:${{github.sha}} - ghcr.io/${{ github.repository_owner }}/bettergov:latest + # build_image: + # name: Build image + # runs-on: ubuntu-latest + + # steps: + # - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + # with: + # persist-credentials: false + + # # The image is not pushed anywhere at the moment but serves the following purposes: + # # (a) performs the npm run build when building the image, and + # # (b) acts as a placeholder if we want to deploy as a container in the future. + # - name: Build the image + # uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + # with: + # context: . + # platforms: linux/amd64 + # push: false + # build-args: | + # HEAD_COMMIT_HASH=${{ github.sha }} + # tags: | + # ghcr.io/${{ github.repository_owner }}/bettergov:${{github.sha}} + # ghcr.io/${{ github.repository_owner }}/bettergov:latest lint_checks: - name: Lint + name: Lint and Build runs-on: ubuntu-latest steps: @@ -59,9 +59,14 @@ jobs: - name: Check Prettier formatting run: npx prettier --check . + - name: Build the project + run: npm run build + e2e_tests: name: Playwright Tests (Shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) runs-on: ubuntu-latest + needs: [lint_checks] + if: ${{ needs.lint_checks.result == 'success' }} container: image: mcr.microsoft.com/playwright:v1.55.0-noble options: --user 1001