diff --git a/.github/workflows/.tests b/.github/workflows/.tests new file mode 100644 index 0000000..4a5f586 --- /dev/null +++ b/.github/workflows/.tests @@ -0,0 +1,33 @@ +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 + 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-${{ 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 }}