-
Notifications
You must be signed in to change notification settings - Fork 13
143 lines (138 loc) · 5.62 KB
/
Copy pathtests-e2e.yml
File metadata and controls
143 lines (138 loc) · 5.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: 'Tests (E2E)'
on:
pull_request:
branches: [main, master]
types: [opened, synchronize, ready_for_review]
paths:
- '.github/workflows/tests-e2e.yml'
- 'package.json'
- 'packages/app/**'
- 'packages/constants/**'
- 'packages/db/**'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'tsconfig.json'
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
component-tests:
name: Component tests
if: ${{ !github.event.pull_request.draft }}
timeout-minutes: 15
runs-on: blacksmith-8vcpu-ubuntu-2404
permissions:
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24'
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
env:
CYPRESS_INSTALL_BINARY: '0'
- name: Cache Cypress binary
uses: useblacksmith/cache@c5fe29eb0efdf1cf4186b9f7fcbbcbc0cf025662 # v5.1.0
with:
path: ~/.cache/Cypress
key: cypress-binary-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
cypress-binary-${{ runner.os }}-${{ runner.arch }}-
- name: Install Cypress binary if missing
working-directory: packages/app
run: pnpm exec cypress verify || pnpm exec cypress install
- name: Run component tests
working-directory: packages/app
run: pnpm exec cypress run --component --browser chrome
env:
CI: true
cypress:
name: E2E (${{ matrix.browser }}, shard ${{ matrix.shard }})
if: ${{ !github.event.pull_request.draft }}
timeout-minutes: 15
runs-on: blacksmith-8vcpu-ubuntu-2404
permissions:
contents: read
strategy:
fail-fast: false
matrix:
browser: [chrome, firefox]
# Cap at four shards per browser. Every shard repeats checkout, dependency
# installation, Cypress setup, and a full app build; beyond four, that
# duplicated fixed cost dominates and yields sharply diminishing returns.
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24'
cache: pnpm
- uses: browser-actions/setup-firefox@0bc507ddf224827e3b1af68e014d5e42ab93e795 # v1.7.2
if: matrix.browser == 'firefox'
with:
firefox-version: latest
# Persist .next/cache between builds (Turbopack compiler cache — enabled
# via turbopackFileSystemCacheForBuild in next.config.ts for CI — plus
# the incremental fetch cache), per
# https://nextjs.org/docs/pages/guides/ci-build-caching#github-actions.
# Runs before `pnpm install` so hashFiles never scans node_modules.
- name: Cache Next.js build
uses: useblacksmith/cache@c5fe29eb0efdf1cf4186b9f7fcbbcbc0cf025662 # v5.1.0
with:
path: packages/app/.next/cache
# New cache whenever packages or source files change; fall back to
# the newest cache for the same lockfile so changed sources still
# start from a warm compiler cache.
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('packages/**/*.js', 'packages/**/*.jsx', 'packages/**/*.ts', 'packages/**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-
${{ runner.os }}-nextjs-
- name: Install dependencies
run: pnpm install --frozen-lockfile
env:
CYPRESS_INSTALL_BINARY: '0'
- name: Cache Cypress binary
uses: useblacksmith/cache@c5fe29eb0efdf1cf4186b9f7fcbbcbc0cf025662 # v5.1.0
with:
path: ~/.cache/Cypress
key: cypress-binary-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
cypress-binary-${{ runner.os }}-${{ runner.arch }}-
- name: Install Cypress binary if missing
working-directory: packages/app
run: pnpm exec cypress verify || pnpm exec cypress install
- name: Build app
run: pnpm build
env:
E2E_FIXTURES: '1'
- name: Run integration tests
uses: cypress-io/github-action@fa4a118725a8f001170d49631ea89e5d66fee626 # v7.4.1
with:
working-directory: packages/app
install: false
start: pnpm start
wait-on: 'http://localhost:3000'
browser: ${{ matrix.browser }}
publish-summary: false
env:
CI: true
E2E_FIXTURES: '1'
# cypress-split picks the subset of specs for this shard.
# SPLIT_INDEX1 is 1-based to match matrix.shard values [1..4].
# SPLIT_FILE seeds the balance from observed timings;
# SPLIT_OUTPUT_FILE redirects on-disk updates to a throwaway path
# so CI never tries to mutate the committed timings.json.
SPLIT: 4
SPLIT_INDEX1: ${{ matrix.shard }}
SPLIT_FILE: timings.json
SPLIT_OUTPUT_FILE: /tmp/cypress-split-out.json
SPLIT_SUMMARY: 'false'