From 81b1498df2c3257d7ead06e9d23db2dd107e28c8 Mon Sep 17 00:00:00 2001 From: marcellmueller Date: Mon, 10 Jun 2024 08:00:16 -0700 Subject: [PATCH] refactor: ci build jobs --- .github/workflows/build-backend.yaml | 2 - .github/workflows/build-nx-apps.yaml | 99 ------------------- .github/workflows/build-registration.yaml | 19 ++++ .github/workflows/build-registration1.yaml | 19 ++++ .github/workflows/build-reporting.yaml | 19 ++++ .github/workflows/main.yaml | 28 +++--- .../{test-nx-apps.yaml => test-e2e.yaml} | 0 7 files changed, 74 insertions(+), 112 deletions(-) delete mode 100644 .github/workflows/build-nx-apps.yaml create mode 100644 .github/workflows/build-registration.yaml create mode 100644 .github/workflows/build-registration1.yaml create mode 100644 .github/workflows/build-reporting.yaml rename .github/workflows/{test-nx-apps.yaml => test-e2e.yaml} (100%) diff --git a/.github/workflows/build-backend.yaml b/.github/workflows/build-backend.yaml index 8b899be113..932490c997 100644 --- a/.github/workflows/build-backend.yaml +++ b/.github/workflows/build-backend.yaml @@ -3,8 +3,6 @@ name: Build BCIERS backend Docker container on: workflow_call: -## test - jobs: backend-docker-build: runs-on: ubuntu-latest diff --git a/.github/workflows/build-nx-apps.yaml b/.github/workflows/build-nx-apps.yaml deleted file mode 100644 index 5252d06465..0000000000 --- a/.github/workflows/build-nx-apps.yaml +++ /dev/null @@ -1,99 +0,0 @@ -name: Build BCIERS Nx Project containers - -on: - workflow_call: - -## test - -jobs: - nx-docker-build-registration1: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Build registration1 container - uses: ./.github/actions/nx-app-build - with: - project: registration1 - image_url: ghcr.io/bcgov/cas-reg1-frontend - github_token: ${{ secrets.GITHUB_TOKEN }} - - nx-docker-build-reporting: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Build reporting container - uses: ./.github/actions/nx-app-build - with: - project: reporting - image_url: ghcr.io/bcgov/cas-rep-frontend - github_token: ${{ secrets.GITHUB_TOKEN }} - - # nx-docker-build-registration: - # runs-on: ubuntu-latest - # defaults: - # run: - # working-directory: ./bciers - # needs: backend-docker-build - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # - name: Setup Docker Buildx - # uses: docker/setup-buildx-action@v2 - # - name: Docker metadata - # id: meta - # uses: docker/metadata-action@v3 - # with: - # images: ghcr.io/bcgov/cas-reg-frontend - # tags: | - # type=sha,format=long,prefix= - # latest - # type=ref,event=pr - # - name: Login to GitHub Container Registry - # uses: docker/login-action@v2 - # with: - # registry: ghcr.io - # username: ${{ github.repository_owner }} - # password: ${{ secrets.GITHUB_TOKEN }} - # - name: Install dependencies - # run: | - # corepack enable - # yarn install --immutable - # cd ../bciers && yarn install --immutable - # - uses: actions/setup-node@v3 - # - name: Derive appropriate SHAs for base and head for `nx affected` commands - # uses: nrwl/nx-set-shas@v4 - # with: - # # This will need to be updated when giraffe-develop merges with develop - # main-branch-name: "develop" - # - name: Cache Docker layers - # uses: actions/cache@v3 - # with: - # path: /tmp/.buildx-cache - # key: ${{ runner.os }}-buildx-bciers-registration${{ github.sha }} - # restore-keys: | - # ${{ runner.os }}-buildx-bciers-registration - # - name: Build images - # env: - # INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # INPUT_PUSH: true - # INPUT_TAGS: ${{ steps.meta.outputs.tags }} - # INPUT_LABELS: ${{ steps.meta.output.labels }} - # INPUT_CACHE_FROM: type=local,src=/tmp/.buildx-cache - # INPUT_CACHE_TO: type=local,dest=/tmp/.buildx-cache-new - # run: | - # npx nx container registration --skip-nx-cache - # # Temp fix - # # https://github.com/docker/build-push-action/issues/252 - # # https://github.com/moby/buildkit/issues/1896 - # - name: Move cache - # run: | - # rm -rf /tmp/.buildx-cache - # mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/.github/workflows/build-registration.yaml b/.github/workflows/build-registration.yaml new file mode 100644 index 0000000000..094e4baa73 --- /dev/null +++ b/.github/workflows/build-registration.yaml @@ -0,0 +1,19 @@ +name: Build Registration Docker container + +on: + workflow_call: + +jobs: + nx-docker-build-registration: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build registration container + uses: ./.github/actions/nx-app-build + with: + project: registration + image_url: ghcr.io/bcgov/cas-reg-frontend + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-registration1.yaml b/.github/workflows/build-registration1.yaml new file mode 100644 index 0000000000..984df28a58 --- /dev/null +++ b/.github/workflows/build-registration1.yaml @@ -0,0 +1,19 @@ +name: Build Registration1 Docker container + +on: + workflow_call: + +jobs: + nx-docker-build-registration1: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build registration1 container + uses: ./.github/actions/nx-app-build + with: + project: registration1 + image_url: ghcr.io/bcgov/cas-reg1-frontend + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-reporting.yaml b/.github/workflows/build-reporting.yaml new file mode 100644 index 0000000000..4fbb41b432 --- /dev/null +++ b/.github/workflows/build-reporting.yaml @@ -0,0 +1,19 @@ +name: Build Reporting Docker container + +on: + workflow_call: + +jobs: + nx-docker-build-reporting: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build reporting container + uses: ./.github/actions/nx-app-build + with: + project: reporting + image_url: ghcr.io/bcgov/cas-rep-frontend + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 950176119e..067c1b5d7f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -27,21 +27,27 @@ jobs: working-directory: ./bciers build-backend: uses: ./.github/workflows/build-backend.yaml - build-nx-apps: - uses: ./.github/workflows/build-nx-apps.yaml + # build-registration: + # uses: ./.github/workflows/build-registration.yaml + build-registration1: + uses: ./.github/workflows/build-registration1.yaml + build-reporting: + uses: ./.github/workflows/build-reporting.yaml test-code: needs: [install-dev-tools] uses: ./.github/workflows/test-code.yaml - scan-code-trivy: - uses: ./.github/workflows/scan-code-trivy.yaml - codeql-analysis: - uses: ./.github/workflows/codeql.yaml test-backend: - needs: [build-backend, install-dev-tools] + needs: [build-backend, build-registration, install-dev-tools] uses: ./.github/workflows/test-backend.yaml - test-nx-apps: - needs: [build-nx-apps, install-dev-tools] - uses: ./.github/workflows/test-nx-apps.yaml + test-e2e: + needs: [build-registration1, install-dev-tools] + uses: ./.github/workflows/test-e2e.yaml + secrets: inherit zap-owasp: - needs: [build-nx-apps, build-backend, install-dev-tools] + # We will need to set up registration part 2 and reporting to get zap scanned + needs: [build-backend, build-registration1, install-dev-tools] uses: ./.github/workflows/zap-owasp.yaml + scan-code-trivy: + uses: ./.github/workflows/scan-code-trivy.yaml + codeql-analysis: + uses: ./.github/workflows/codeql.yaml diff --git a/.github/workflows/test-nx-apps.yaml b/.github/workflows/test-e2e.yaml similarity index 100% rename from .github/workflows/test-nx-apps.yaml rename to .github/workflows/test-e2e.yaml