Daily Regression #341
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Daily Regression | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
all-tests: | |
runs-on: ubuntu-latest | |
container: | |
image: cypress/browsers:node-20.11.0-chrome-121.0.6167.184-1-ff-123.0-edge-121.0.2277.128-1 | |
# This is needed so the commit info can be recorded by cypress | |
options: --user 1001 | |
strategy: | |
# when one test fails, DO NOT cancel the other | |
# containers, because this will kill Cypress processes | |
# leaving the Dashboard hanging ... | |
# https://github.com/cypress-io/github-action/issues/48 | |
fail-fast: false | |
matrix: | |
# run 5 copies of the current job in parallel | |
containers: [1, 2, 3, 4, 5, 6, 7] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Install CMS Dependencies | |
working-directory: ./cms | |
run: npm ci | |
- name: Set the browser | |
env: | |
DEFAULT_BROWSER: chrome | |
run: echo "BROWSER=${{ github.event.inputs.browser || env.DEFAULT_BROWSER }}" >> $GITHUB_ENV | |
- name: Run Cypress Tests | |
uses: cypress-io/github-action@v4 | |
with: | |
start: npm start | |
wait-on: 'http://localhost:8080' | |
# wait 10 minutes to start the addition of the CMS required this increase | |
wait-on-timeout: 600 | |
# only record the results to dashboard.cypress.io if CYPRESS_RECORD_KEY is set | |
record: ${{ !!secrets.CYPRESS_RECORD_KEY }} | |
# only do parallel if we have a record key | |
parallel: ${{ !!secrets.CYPRESS_RECORD_KEY }} | |
browser: ${{ env.BROWSER }} | |
spec: cypress/e2e/functional/** | |
env: | |
# pass the Dashboard record key as an environment variable | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# pass GitHub token to allow accurately detecting a build vs a re-run build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# turn on code coverage when running npm start | |
# so far we've been using a webpack coverage-istanbul-loader for this | |
# but there has been work on using the code coverage support in the browser directly, | |
# which should be much faster | |
CODE_COVERAGE: true | |
# Also turn on the code coverage tasks in cypress itself, these are disabled | |
# by default. | |
CYPRESS_coverage: true | |
# Increase memory allocation | |
NODE_OPTIONS: "--max_old_space_size=4096" | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
flags: cypress | |
token: ${{ secrets.CODECOV_TOKEN }} | |
cleanup-tests: | |
runs-on: ubuntu-latest | |
container: cypress/browsers:node-20.11.0-chrome-121.0.6167.184-1-ff-123.0-edge-121.0.2277.128-1 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Install CMS Dependencies | |
working-directory: ./cms | |
run: npm ci | |
- name: Set the browser | |
env: | |
DEFAULT_BROWSER: chrome | |
run: echo "BROWSER=${{ github.event.inputs.browser || env.DEFAULT_BROWSER }}" >> $GITHUB_ENV | |
- name: Cleanup Comments | |
uses: cypress-io/github-action@v4 | |
with: | |
start: npm start | |
wait-on: 'http://localhost:8080' | |
# wait 10 minutes to start the addition of the CMS required this increase | |
wait-on-timeout: 600 | |
# only record the results to dashboard.cypress.io if CYPRESS_RECORD_KEY is set | |
record: ${{ !!secrets.CYPRESS_RECORD_KEY }} | |
browser: ${{ env.BROWSER }} | |
spec: cypress/e2e/cleanup/** | |
env: | |
# pass the Dashboard record key as an environment variable | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# pass GitHub token to allow accurately detecting a build vs a re-run build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# turn on code coverage when running npm start | |
# so far we've been using a webpack coverage-istanbul-loader for this | |
# but there has been work on using the code coverage support in the browser directly, | |
# which should be much faster | |
CODE_COVERAGE: true | |
# Also turn on the code coverage tasks in cypress itself, these are disabled | |
# by default. | |
CYPRESS_coverage: true | |
# Increase memory allocation | |
NODE_OPTIONS: "--max_old_space_size=4096" | |
notify-slack: | |
if: ${{ failure() }} | |
needs: [all-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify Slack the tests failed | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
# This data can be any valid JSON from a previous step in the GitHub Action | |
payload: | | |
{ | |
"ref_name": "${{ github.ref_name }}", | |
"workflow": "${{ github.workflow }}", | |
"run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |