152 lines
5.4 KiB
YAML
Raw Normal View History

2021-01-28 22:39:17 +01:00
name: E2E
2021-01-28 22:36:18 +01:00
2023-07-02 10:03:31 +05:30
on:
push:
branches:
- develop
- master
- release/**
2023-07-02 10:03:31 +05:30
pull_request:
merge_group:
2021-01-28 22:36:18 +01:00
2024-08-24 15:04:14 +05:30
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
2024-01-19 15:50:40 +05:30
env:
2024-03-23 13:25:19 +05:30
# For PRs and MergeQueues, the target commit is used, and for push events to non-develop branches, github.event.previous is used if available. Otherwise, 'develop' is used.
targetHash: >-
${{
github.event.pull_request.base.sha ||
github.event.merge_group.base_sha ||
(
(
(github.event_name == 'push' && github.ref == 'refs/heads/develop') ||
github.event.before == '0000000000000000000000000000000000000000'
) && 'develop'
) ||
github.event.before
}}
2021-01-28 22:36:18 +01:00
jobs:
2024-01-19 12:06:53 +05:30
cache:
runs-on: ubuntu-latest
2024-01-31 11:32:55 +05:30
container:
image: cypress/browsers:node-20.11.0-chrome-121.0.6167.85-1-ff-120.0-edge-121.0.2277.83-1
options: --user 1001
2024-01-19 12:06:53 +05:30
steps:
2024-08-24 09:26:49 +00:00
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
2024-01-19 12:06:53 +05:30
- name: Setup Node.js
2024-08-24 09:26:49 +00:00
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
2024-01-19 12:06:53 +05:30
with:
node-version-file: '.node-version'
2024-01-19 12:06:53 +05:30
- name: Cache snapshots
id: cache-snapshot
2024-08-24 09:26:49 +00:00
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
2024-01-19 12:06:53 +05:30
with:
save-always: true
path: ./cypress/snapshots
2024-01-19 15:50:40 +05:30
key: ${{ runner.os }}-snapshots-${{ env.targetHash }}
2024-01-19 12:06:53 +05:30
2024-01-19 19:04:25 +05:30
# If a snapshot for a given Hash is not found, we checkout that commit, run the tests and cache the snapshots.
2024-01-19 12:06:53 +05:30
- name: Switch to base branch
if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }}
2024-08-24 09:26:49 +00:00
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2024-01-19 12:06:53 +05:30
with:
2024-01-19 15:50:40 +05:30
ref: ${{ env.targetHash }}
2024-01-19 12:17:20 +05:30
- name: Install dependencies
if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }}
2024-08-24 09:26:49 +00:00
uses: cypress-io/github-action@df7484c5ba85def7eef30db301afa688187bc378 # v6.7.2
with:
# just perform install
runTests: false
- name: Calculate bundle size
if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true'}}
run: |
pnpm run build:viz
mkdir -p cypress/snapshots/stats/base
mv stats cypress/snapshots/stats/base
2023-07-02 10:14:35 +05:30
e2e:
2021-01-28 22:36:18 +01:00
runs-on: ubuntu-latest
2024-01-31 11:35:07 +05:30
container:
image: cypress/browsers:node-20.11.0-chrome-121.0.6167.85-1-ff-120.0-edge-121.0.2277.83-1
options: --user 1001
2024-01-19 12:06:53 +05:30
needs: cache
2021-01-28 22:36:18 +01:00
strategy:
2022-09-21 10:36:38 +05:30
fail-fast: false
2021-01-28 22:36:18 +01:00
matrix:
2024-10-04 02:29:43 +05:30
containers: [1, 2, 3, 4, 5]
2021-01-28 22:36:18 +01:00
steps:
2024-08-24 09:26:49 +00:00
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2021-01-28 22:36:18 +01:00
2024-08-24 09:26:49 +00:00
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
# uses version from "packageManager" field in package.json
2022-09-21 10:36:38 +05:30
- name: Setup Node.js
2024-08-24 09:26:49 +00:00
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version-file: '.node-version'
2021-01-28 22:36:18 +01:00
2024-01-19 19:04:25 +05:30
# These cached snapshots are downloaded, providing the reference snapshots.
2024-01-19 12:06:53 +05:30
- name: Cache snapshots
id: cache-snapshot
2024-08-24 09:26:49 +00:00
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
2024-01-19 12:06:53 +05:30
with:
path: ./cypress/snapshots
2024-01-19 15:50:40 +05:30
key: ${{ runner.os }}-snapshots-${{ env.targetHash }}
2024-01-19 12:06:53 +05:30
- name: Install dependencies
2024-08-24 09:26:49 +00:00
uses: cypress-io/github-action@df7484c5ba85def7eef30db301afa688187bc378 # v6.7.2
with:
runTests: false
- name: Output size diff
if: ${{ matrix.containers == 1 }}
run: |
pnpm run build:viz
mv stats cypress/snapshots/stats/head
echo '## Bundle size difference' >> "$GITHUB_STEP_SUMMARY"
echo '' >> "$GITHUB_STEP_SUMMARY"
npx tsx scripts/size.ts >> "$GITHUB_STEP_SUMMARY"
2022-09-21 10:36:38 +05:30
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
2024-08-24 09:26:49 +00:00
uses: cypress-io/github-action@df7484c5ba85def7eef30db301afa688187bc378 # v6.7.2
2023-01-16 01:23:42 +05:30
id: cypress
2022-09-21 10:36:38 +05:30
with:
install: false
2023-06-17 17:54:13 +05:30
start: pnpm run dev:coverage
2022-09-21 10:36:38 +05:30
wait-on: 'http://localhost:9000'
2024-01-19 12:06:53 +05:30
browser: chrome
# Disable recording if we don't have an API key
# e.g. if this action was run from a fork
2024-10-04 01:54:36 +05:30
record: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
env:
2022-09-21 10:36:38 +05:30
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
2023-06-17 17:54:13 +05:30
VITEST_COVERAGE: true
2023-07-07 15:56:30 +05:30
CYPRESS_COMMIT: ${{ github.sha }}
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
2024-10-04 01:54:36 +05:30
ARGOS_PARALLEL: true
ARGOS_PARALLEL_TOTAL: ${{ strategy.job-total }}
ARGOS_PARALLEL_INDEX: ${{ strategy.job-index }}
SPLIT: ${{ strategy.job-total }}
SPLIT_INDEX: ${{ strategy.job-index }}
2024-10-04 02:29:43 +05:30
SPLIT_FILE: 'cypress/timings.json'
2024-01-19 12:06:53 +05:30
2023-06-17 17:54:13 +05:30
- name: Upload Coverage to Codecov
2024-08-24 09:26:49 +00:00
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
# Run step only pushes to develop and pull_requests
if: ${{ steps.cypress.conclusion == 'success' && (github.event_name == 'pull_request' || github.ref == 'refs/heads/develop')}}
2023-06-17 17:34:19 +05:30
with:
2023-06-17 17:44:27 +05:30
files: coverage/cypress/lcov.info
2023-06-17 17:34:19 +05:30
flags: e2e
name: mermaid-codecov
2023-07-02 13:22:00 +05:30
fail_ci_if_error: false
2023-06-17 17:34:19 +05:30
verbose: true
2023-07-03 21:01:04 +05:30
token: 6845cc80-77ee-4e17-85a1-026cd95e0766