2021-01-28 22:39:17 +01:00
|
|
|
name: E2E
|
2021-01-28 22:36:18 +01:00
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
2022-04-25 23:38:27 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2021-01-28 22:36:18 +01:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
2022-09-21 10:36:38 +05:30
|
|
|
fail-fast: false
|
2021-01-28 22:36:18 +01:00
|
|
|
matrix:
|
2022-10-10 20:13:50 +08:00
|
|
|
node-version: [18.x]
|
2022-09-21 10:42:27 +05:30
|
|
|
containers: [1, 2, 3, 4]
|
2021-01-28 22:36:18 +01:00
|
|
|
steps:
|
2022-09-14 04:12:45 +01:00
|
|
|
- uses: actions/checkout@v3
|
2021-01-28 22:36:18 +01:00
|
|
|
|
2022-09-25 19:38:47 +01:00
|
|
|
- uses: pnpm/action-setup@v2
|
|
|
|
# uses version from "packageManager" field in package.json
|
2022-09-21 10:36:38 +05:30
|
|
|
|
2022-09-14 04:12:45 +01:00
|
|
|
- name: Setup Node.js ${{ matrix.node-version }}
|
|
|
|
uses: actions/setup-node@v3
|
2022-09-28 20:19:08 +01:00
|
|
|
# Need to skip setup if Cypress run is skipped, otherwise an error
|
|
|
|
# is thrown since the pnpm cache step fails
|
|
|
|
if: ${{ ( env.CYPRESS_RECORD_KEY != '' ) || ( matrix.containers == 1 ) }}
|
2022-09-14 04:12:45 +01:00
|
|
|
with:
|
2022-09-25 19:38:47 +01:00
|
|
|
cache: pnpm
|
2022-09-14 04:12:45 +01:00
|
|
|
node-version: ${{ matrix.node-version }}
|
2021-01-28 22:36:18 +01:00
|
|
|
|
2022-09-21 10:36:38 +05:30
|
|
|
# Install NPM dependencies, cache them correctly
|
|
|
|
# and run all Cypress tests
|
|
|
|
- name: Cypress run
|
2022-09-25 19:38:47 +01:00
|
|
|
uses: cypress-io/github-action@v4
|
2022-09-25 19:56:15 +01:00
|
|
|
# If CYPRESS_RECORD_KEY is set, run in parallel on all containers
|
|
|
|
# Otherwise (e.g. if running from fork), we run on a single container only
|
|
|
|
if: ${{ ( env.CYPRESS_RECORD_KEY != '' ) || ( matrix.containers == 1 ) }}
|
2022-09-21 10:36:38 +05:30
|
|
|
with:
|
2022-09-25 19:38:47 +01:00
|
|
|
start: pnpm run dev
|
2022-09-21 10:36:38 +05:30
|
|
|
wait-on: 'http://localhost:9000'
|
2022-09-25 19:56:15 +01:00
|
|
|
# Disable recording if we don't have an API key
|
|
|
|
# e.g. if this action was run from a fork
|
|
|
|
record: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
|
|
|
|
parallel: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
|
2022-09-14 04:12:45 +01:00
|
|
|
env:
|
2022-09-21 10:36:38 +05:30
|
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|