From 881394ec49c12ea1ef03043de1dfcd30929aa2d6 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 10:13:33 -0800 Subject: [PATCH 1/9] chore(ci): use newer workflow patterns --- .github/workflows/pr-open.yml | 2 +- .github/workflows/tests.yml | 35 ++++++----------------------------- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 4464caa..e290a4f 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -2,7 +2,7 @@ name: Pull Request on: pull_request: - workflow_dispatch: + merge_group: concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index db22bfe..09f828c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,8 +1,13 @@ -name: Unit Tests and Analysis +name: Analysis on: + push: + branches: [main] + merge_group: pull_request: types: [opened, reopened, synchronize, ready_for_review] + schedule: + - cron: "0 12 * * 0" # 3 AM PST = 12 PM UDT, runs sundays workflow_dispatch: concurrency: @@ -10,34 +15,6 @@ concurrency: cancel-in-progress: true jobs: - # tests: - # name: Unit Tests - # if: github.event_name != 'pull_request' || !github.event.pull_request.draft - # runs-on: ubuntu-22.04 - # strategy: - # matrix: - # dir: [api, frontend] - # include: - # - dir: api - # sonar_projectKey: bcgov_public-code_api - # token: SONAR_TOKEN_BACKEND - # - dir: frontend - # sonar_projectKey: bcgov_public-code_frontend - # token: SONAR_TOKEN_FRONTEND - # steps: - # - uses: bcgov-nr/action-test-and-analyse@v0.0.1 - # with: - # commands: | - # npm ci - # npm run test:cov - # dir: ${{ matrix.dir }} - # sonar_args: > - # -Dsonar.exclusions=**/coverage/**,**/node_modules/** - # -Dsonar.organization=bcgov-sonarcloud - # -Dsonar.project.monorepo.enabled=true - # -Dsonar.projectKey=${{ matrix.sonar_projectKey }} - # sonar_project_token: ${{ secrets[matrix.token] }} - # https://github.com/marketplace/actions/aqua-security-trivy trivy: name: Trivy Security Scan From eaa089bd6ccef8309ad735d9d794d987bbd599b0 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 10:22:55 -0800 Subject: [PATCH 2/9] Consistency and cleanup --- .github/workflows/{tests.yml => analysis.yml} | 0 .../workflows/{merge-main.yml => merge.yml} | 5 +- .github/workflows/pr-open.yml | 21 +--- .github/workflows/schedule-jobs.yml | 4 +- .github/workflows/scheduled.yml | 96 +++++++++++++++++++ 5 files changed, 105 insertions(+), 21 deletions(-) rename .github/workflows/{tests.yml => analysis.yml} (100%) rename .github/workflows/{merge-main.yml => merge.yml} (99%) create mode 100644 .github/workflows/scheduled.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/analysis.yml similarity index 100% rename from .github/workflows/tests.yml rename to .github/workflows/analysis.yml diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge.yml similarity index 99% rename from .github/workflows/merge-main.yml rename to .github/workflows/merge.yml index b12c31c..64d9f3a 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge.yml @@ -95,15 +95,13 @@ jobs: cypress-e2e: name: Cypress end to end test - needs: - - deploys + needs: [deploys] runs-on: ubuntu-22.04 strategy: matrix: browser: [ chrome, firefox, edge ] steps: - uses: actions/checkout@v4 - name: Checkout - uses: cypress-io/github-action@v5 name: Cypress run with: @@ -116,6 +114,7 @@ jobs: name: cypress-screenshots path: ./frontend/cypress/screenshots if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn` + deploys-prod: name: PROD Deployments needs: [semantic-version,cypress-e2e] diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index e290a4f..8ffb49f 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -42,14 +42,6 @@ jobs: strategy: matrix: package: [api, frontend, database] - include: - - package: frontend - triggers: ('frontend/') - - package: api - triggers: ('api/') - - package: database - triggers: ('database/') - steps: - uses: actions/checkout@v4 - uses: bcgov-nr/action-builder-ghcr@v2.0.1 @@ -58,7 +50,7 @@ jobs: tag: ${{ github.sha }} tag_fallback: test token: ${{ secrets.GITHUB_TOKEN }} - triggers: ${{ matrix.triggers }} + triggers: ('${{ matrix.package }}/') - uses: shrink/actions-docker-registry-tag@v3 with: @@ -77,12 +69,11 @@ jobs: - name: Deploy to OpenShift shell: bash run: | - # Allow pipefail, since we could be catching oc create errors + # Expand for deployment steps set +o pipefail - # Login to OpenShift (NOTE: project command is a safeguard) oc login --token=${{ secrets.oc_token }} --server=${{ vars.oc_server }} - oc project ${{ vars.oc_namespace }} + oc project ${{ vars.oc_namespace }} # Safeguard! # Deploy Helm Chart cd charts/pubcode @@ -123,15 +114,13 @@ jobs: cypress-e2e: name: Cypress end to end test - needs: - - deploys + needs: [deploys] runs-on: ubuntu-22.04 strategy: matrix: - browser: [ chrome, edge ] + browser: [chrome, edge] steps: - uses: actions/checkout@v4 - name: Checkout - uses: cypress-io/github-action@v5 name: Cypress run with: diff --git a/.github/workflows/schedule-jobs.yml b/.github/workflows/schedule-jobs.yml index e20643b..de2aa63 100644 --- a/.github/workflows/schedule-jobs.yml +++ b/.github/workflows/schedule-jobs.yml @@ -1,4 +1,4 @@ -name: Schedule Jobs +name: Scheduled on: workflow_dispatch: @@ -10,7 +10,7 @@ on: - cron: "0 8 * * *" concurrency: - group: ${{ github.workflow }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml new file mode 100644 index 0000000..e20643b --- /dev/null +++ b/.github/workflows/scheduled.yml @@ -0,0 +1,96 @@ +name: Schedule Jobs + +on: + workflow_dispatch: + inputs: + REPO_NAMES: + required: false + description: comma separated list of repo names within bcgov org. for one of jobs to run for specific repos. + schedule: # * is a special character in YAML, so you have to quote this string, every day at 8am GMT + - cron: "0 8 * * *" + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + pubcode-crawler: + name: Crawl Git Repos for bcgovpubcode.yml + runs-on: ubuntu-22.04 + environment: prod + defaults: + run: + working-directory: crawler + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Add Node.js + uses: actions/setup-node@v4 + with: + node-version: "20.x" + - name: Install Dependencies + run: npm ci + + - uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Process script + env: + GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO_NAMES: ${{ github.event.inputs.REPO_NAMES }} + run: | + oc login --token=${{ secrets.OC_TOKEN }} --server=${{ vars.OC_SERVER }} + oc project ${{ vars.OC_NAMESPACE }} + + # Get API key + API_KEY=$(oc get secrets/pubcode --template={{.data.API_KEY}} | base64 -d) + API_URL=https://$(oc get route/pubcode-api --template={{.spec.host}}) + API_KEY="${API_KEY}" API_URL="${API_URL}" node src/main.js + + validate-ministry-list: + name: Validate Ministry List in the pubcode schema. + runs-on: ubuntu-22.04 + defaults: + run: + working-directory: schema/script + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Add Node.js + uses: actions/setup-node@v4 + with: + node-version: "20.x" + + - name: Install Dependencies + run: npm ci + + - uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Process script + id: validate-ministry-list + run: node ./index.js + + - name: create a branch, commit and push changes + if: steps.validate-ministry-list.outputs.schemaChanged == 'true' + env: + GH_TOKEN: ${{ github.token }} + run: | + git config --local user.name ${{ github.actor }} + git checkout -b chore/ministry-name-schema + git add ../bcgovpubcode.json + git commit -m "Updating the Schema as changes to ministry names were detected." + git push origin chore/ministry-name-schema + # Create a Pull Request + gh pr create --assignee "mishraomp" --base main --label "chore" --title "Updating the Schema as changes to ministry names were detected." --body "Updating the Schema as changes to ministry names were detected." + From f704c2acdb2c8c676b742a8ff803c6f42fc35b83 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 10:27:41 -0800 Subject: [PATCH 3/9] Move cypress jobs into .tests.yml --- .github/workflows/.tests.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/merge.yml | 21 +++------------------ .github/workflows/pr-open.yml | 21 +++------------------ 3 files changed, 38 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/.tests.yml diff --git a/.github/workflows/.tests.yml b/.github/workflows/.tests.yml new file mode 100644 index 0000000..1c65c82 --- /dev/null +++ b/.github/workflows/.tests.yml @@ -0,0 +1,32 @@ +name: .Tests + +on: + workflow_call: + inputs: + ### Required + target: + description: PR number, test or prod + required: true + type: string + +jobs: + cypress-e2e: + name: Cypress end to end test + runs-on: ubuntu-22.04 + strategy: + matrix: + browser: [chrome, edge] + steps: + - uses: actions/checkout@v4 + - uses: cypress-io/github-action@v5 + name: Cypress run + with: + config: pageLoadTimeout=10000,baseUrl=https://pubcode-${{ inputs.target }}.apps.silver.devops.gov.bc.ca/ + working-directory: ./frontend + browser: ${{ matrix.browser }} + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: cypress-screenshots + path: ./frontend/cypress/screenshots + if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn` diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 64d9f3a..a9351a6 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -96,24 +96,9 @@ jobs: cypress-e2e: name: Cypress end to end test needs: [deploys] - runs-on: ubuntu-22.04 - strategy: - matrix: - browser: [ chrome, firefox, edge ] - steps: - - uses: actions/checkout@v4 - - uses: cypress-io/github-action@v5 - name: Cypress run - with: - config: pageLoadTimeout=10000,baseUrl=https://pubcode-test.apps.silver.devops.gov.bc.ca/ - working-directory: ./frontend - browser: ${{ matrix.browser }} - - uses: actions/upload-artifact@v3 - if: failure() - with: - name: cypress-screenshots - path: ./frontend/cypress/screenshots - if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn` + uses: ./.github/workflows/.tests.yml + with: + target: test deploys-prod: name: PROD Deployments diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 8ffb49f..ec03813 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -115,21 +115,6 @@ jobs: cypress-e2e: name: Cypress end to end test needs: [deploys] - runs-on: ubuntu-22.04 - strategy: - matrix: - browser: [chrome, edge] - steps: - - uses: actions/checkout@v4 - - uses: cypress-io/github-action@v5 - name: Cypress run - with: - config: pageLoadTimeout=10000,baseUrl=https://pubcode-${{ github.event.number }}.apps.silver.devops.gov.bc.ca/ - working-directory: ./frontend - browser: ${{ matrix.browser }} - - uses: actions/upload-artifact@v3 - if: failure() - with: - name: cypress-screenshots - path: ./frontend/cypress/screenshots - if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn` + uses: ./.github/workflows/.tests.yml + with: + target: ${{ github.event.number }} From 80579757fd8d4cb4ba60554b0c7012db06f64774 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 10:44:42 -0800 Subject: [PATCH 4/9] Rename Cypress tests --- .github/workflows/.tests.yml | 2 +- .github/workflows/merge.yml | 6 +++--- .github/workflows/pr-open.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/.tests.yml b/.github/workflows/.tests.yml index 1c65c82..2bd1943 100644 --- a/.github/workflows/.tests.yml +++ b/.github/workflows/.tests.yml @@ -11,7 +11,7 @@ on: jobs: cypress-e2e: - name: Cypress end to end test + name: Cypress E2E runs-on: ubuntu-22.04 strategy: matrix: diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index a9351a6..6a58083 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -93,8 +93,8 @@ jobs: helm dependency update helm upgrade --install --wait --atomic pubcode-test --values values.yaml --set-string global.repository=${{ github.repository }} --set-string api.containers[0].tag="${{ needs.semantic-version.outputs.semanticVersion }}" --set-string frontend.containers[0].tag="${{ needs.semantic-version.outputs.semanticVersion }}" --set-string global.secrets.emailRecipients="${{ secrets.EMAIL_RECIPIENTS }}" --set-string global.secrets.chesTokenURL="${{ secrets.CHES_TOKEN_URL }}" --set-string global.secrets.chesClientID="${{ secrets.CHES_CLIENT_ID }}" --set-string global.secrets.chesClientSecret="${{ secrets.CHES_CLIENT_SECRET }}" --set-string global.secrets.chesAPIURL="${{ secrets.CHES_API_URL }}" --set-string global.secrets.databaseAdminPassword="${{ secrets.DB_PWD }}" --set-string namespace="${{ vars.oc_namespace }}" --timeout 5m . - cypress-e2e: - name: Cypress end to end test + tests: + name: Tests needs: [deploys] uses: ./.github/workflows/.tests.yml with: @@ -102,7 +102,7 @@ jobs: deploys-prod: name: PROD Deployments - needs: [semantic-version,cypress-e2e] + needs: [semantic-version, tests] environment: prod runs-on: ubuntu-22.04 timeout-minutes: 10 diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index ec03813..1152aa7 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -112,8 +112,8 @@ jobs: --set-string global.env.VITE_SCHEMA_BRANCH=${{ github.event.pull_request.head.ref }} \ --set-string namespace="${{ vars.oc_namespace }}" -f values.yaml --timeout 5m . - cypress-e2e: - name: Cypress end to end test + tests: + name: Tests needs: [deploys] uses: ./.github/workflows/.tests.yml with: From 6f829295bd71d0ed74d8c3bc6cbc2b8b60ea60b7 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 10:51:18 -0800 Subject: [PATCH 5/9] Roll deleted pubcode cleanup into scheduled.yml --- .github/workflows/remove-deleted-repos.yaml | 42 --------- .github/workflows/schedule-jobs.yml | 96 --------------------- .github/workflows/scheduled.yml | 34 ++++++++ 3 files changed, 34 insertions(+), 138 deletions(-) delete mode 100644 .github/workflows/remove-deleted-repos.yaml delete mode 100644 .github/workflows/schedule-jobs.yml diff --git a/.github/workflows/remove-deleted-repos.yaml b/.github/workflows/remove-deleted-repos.yaml deleted file mode 100644 index 0a0605f..0000000 --- a/.github/workflows/remove-deleted-repos.yaml +++ /dev/null @@ -1,42 +0,0 @@ -name: Remove Deleted pubcodes from the api - -on: - workflow_dispatch: - #schedule: # * is a special character in YAML, so you have to quote this string, every day at 8am GMT - # - cron: "5 8 * * *" - -jobs: - soft-delete-removed-pubcodes: - name: Soft Delete pubcodes In the Databse which are removed from the repo. - runs-on: ubuntu-22.04 - defaults: - run: - working-directory: utilities/remove-deleted-pubcode - environment: prod - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Add Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.x" - - name: Install Dependencies - run: npm ci - - - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - name: Process script - run: | - oc login --token=${{ secrets.OC_TOKEN }} --server=${{ vars.OC_SERVER }} - oc project ${{ vars.OC_NAMESPACE }} - - # Get API key - API_KEY=$(oc get secrets/pubcode --template={{.data.API_KEY}} | base64 -d) - API_URL=https://$(oc get route/pubcode-api --template={{.spec.host}}) - API_KEY="${API_KEY}" API_URL="${API_URL}" node index.js diff --git a/.github/workflows/schedule-jobs.yml b/.github/workflows/schedule-jobs.yml deleted file mode 100644 index de2aa63..0000000 --- a/.github/workflows/schedule-jobs.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Scheduled - -on: - workflow_dispatch: - inputs: - REPO_NAMES: - required: false - description: comma separated list of repo names within bcgov org. for one of jobs to run for specific repos. - schedule: # * is a special character in YAML, so you have to quote this string, every day at 8am GMT - - cron: "0 8 * * *" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - pubcode-crawler: - name: Crawl Git Repos for bcgovpubcode.yml - runs-on: ubuntu-22.04 - environment: prod - defaults: - run: - working-directory: crawler - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Add Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.x" - - name: Install Dependencies - run: npm ci - - - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - name: Process script - env: - GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_NAMES: ${{ github.event.inputs.REPO_NAMES }} - run: | - oc login --token=${{ secrets.OC_TOKEN }} --server=${{ vars.OC_SERVER }} - oc project ${{ vars.OC_NAMESPACE }} - - # Get API key - API_KEY=$(oc get secrets/pubcode --template={{.data.API_KEY}} | base64 -d) - API_URL=https://$(oc get route/pubcode-api --template={{.spec.host}}) - API_KEY="${API_KEY}" API_URL="${API_URL}" node src/main.js - - validate-ministry-list: - name: Validate Ministry List in the pubcode schema. - runs-on: ubuntu-22.04 - defaults: - run: - working-directory: schema/script - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Add Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.x" - - - name: Install Dependencies - run: npm ci - - - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - name: Process script - id: validate-ministry-list - run: node ./index.js - - - name: create a branch, commit and push changes - if: steps.validate-ministry-list.outputs.schemaChanged == 'true' - env: - GH_TOKEN: ${{ github.token }} - run: | - git config --local user.name ${{ github.actor }} - git checkout -b chore/ministry-name-schema - git add ../bcgovpubcode.json - git commit -m "Updating the Schema as changes to ministry names were detected." - git push origin chore/ministry-name-schema - # Create a Pull Request - gh pr create --assignee "mishraomp" --base main --label "chore" --title "Updating the Schema as changes to ministry names were detected." --body "Updating the Schema as changes to ministry names were detected." - diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index e20643b..ec4362b 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -94,3 +94,37 @@ jobs: # Create a Pull Request gh pr create --assignee "mishraomp" --base main --label "chore" --title "Updating the Schema as changes to ministry names were detected." --body "Updating the Schema as changes to ministry names were detected." + soft-delete-removed-pubcodes: + name: Soft Delete pubcodes In the Databse which are removed from the repo. + runs-on: ubuntu-22.04 + defaults: + run: + working-directory: utilities/remove-deleted-pubcode + environment: prod + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Add Node.js + uses: actions/setup-node@v4 + with: + node-version: "20.x" + - name: Install Dependencies + run: npm ci + + - uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Process script + run: | + oc login --token=${{ secrets.OC_TOKEN }} --server=${{ vars.OC_SERVER }} + oc project ${{ vars.OC_NAMESPACE }} + + # Get API key + API_KEY=$(oc get secrets/pubcode --template={{.data.API_KEY}} | base64 -d) + API_URL=https://$(oc get route/pubcode-api --template={{.spec.host}}) + API_KEY="${API_KEY}" API_URL="${API_URL}" node index.js From 2c197124cf6cfe305f15a2fff495ce77c13113e2 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 10:53:02 -0800 Subject: [PATCH 6/9] Remove old workflow --- .github/workflows/prod.yml | 46 -------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 .github/workflows/prod.yml diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml deleted file mode 100644 index c30ee47..0000000 --- a/.github/workflows/prod.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Prod Deploy - -on: - workflow_dispatch: - inputs: - tag: - description: 'Tag to deploy, it would be the latest tag that went into PROD.' - required: true - default: 'prod' - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true - -jobs: - deploys: - name: PROD Deployments - environment: prod - runs-on: ubuntu-22.04 - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - - name: Deploy - shell: bash - run: | - # Allow pipefail, since we could be catching oc create errors - set +o pipefail - - # Login to OpenShift (NOTE: project command is a safeguard) - oc login --token=${{ secrets.oc_token }} --server=${{ vars.oc_server }} - oc project ${{ vars.oc_namespace }} - - # Deploy Helm Chart - cd charts/pubcode - helm dependency update - helm upgrade --install --wait --atomic pubcode --values values.yaml --set-string global.repository=${{ github.repository }} --set-string api.containers[0].tag="${{ github.event.inputs.tag }}" --set-string frontend.containers[0].tag="${{ github.event.inputs.tag }}" --set-string global.secrets.emailRecipients="${{ secrets.EMAIL_RECIPIENTS }}" --set-string global.secrets.chesTokenURL="${{ secrets.CHES_TOKEN_URL }}" --set-string global.secrets.chesClientID="${{ secrets.CHES_CLIENT_ID }}" --set-string global.secrets.chesClientSecret="${{ secrets.CHES_CLIENT_SECRET }}" --set-string global.secrets.chesAPIURL="${{ secrets.CHES_API_URL }}" --set-string global.secrets.databaseAdminPassword="${{ secrets.DB_PWD }}" --set-string namespace="${{ vars.oc_namespace }}" --timeout 5m . - - - name: Create Release - uses: softprops/action-gh-release@v1 - continue-on-error: true - env: - GITHUB_TOKEN: ${{ github.token }} - with: - token: ${{ github.token }} - tag_name: ${{ github.event.inputs.tag }} - name: Release-${{ github.event.inputs.tag }} From 6e18da58d7efc3d8374cdf1395abf93a43cb13e6 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 11:18:08 -0800 Subject: [PATCH 7/9] Use Firefox instead of Edge in Cypress --- .github/workflows/.tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/.tests.yml b/.github/workflows/.tests.yml index 2bd1943..5264887 100644 --- a/.github/workflows/.tests.yml +++ b/.github/workflows/.tests.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - browser: [chrome, edge] + browser: [chrome, firefox] steps: - uses: actions/checkout@v4 - uses: cypress-io/github-action@v5 From 7b4fb0cccc08c5fdbcf8ab7d80c09786b1728216 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 11:20:45 -0800 Subject: [PATCH 8/9] Adjust Cypress config, bump timeout to 30000 --- .github/workflows/.tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/.tests.yml b/.github/workflows/.tests.yml index 5264887..5e0f287 100644 --- a/.github/workflows/.tests.yml +++ b/.github/workflows/.tests.yml @@ -20,8 +20,10 @@ jobs: - uses: actions/checkout@v4 - uses: cypress-io/github-action@v5 name: Cypress run + env: + pageLoadTimeout: 30000 + baseUrl: https://pubcode-${{ inputs.target }}.apps.silver.devops.gov.bc.ca/ with: - config: pageLoadTimeout=10000,baseUrl=https://pubcode-${{ inputs.target }}.apps.silver.devops.gov.bc.ca/ working-directory: ./frontend browser: ${{ matrix.browser }} - uses: actions/upload-artifact@v3 From bd9bd2760fe051bd59c1f08023b8e41865903a48 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Thu, 18 Jan 2024 11:37:33 -0800 Subject: [PATCH 9/9] Fix Cypress params --- .github/workflows/.tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/.tests.yml b/.github/workflows/.tests.yml index 5e0f287..3c32741 100644 --- a/.github/workflows/.tests.yml +++ b/.github/workflows/.tests.yml @@ -20,10 +20,8 @@ jobs: - uses: actions/checkout@v4 - uses: cypress-io/github-action@v5 name: Cypress run - env: - pageLoadTimeout: 30000 - baseUrl: https://pubcode-${{ inputs.target }}.apps.silver.devops.gov.bc.ca/ with: + config: pageLoadTimeout=30000,baseUrl=https://pubcode-${{ inputs.target }}.apps.silver.devops.gov.bc.ca/ working-directory: ./frontend browser: ${{ matrix.browser }} - uses: actions/upload-artifact@v3