-
Notifications
You must be signed in to change notification settings - Fork 119
139 lines (115 loc) · 3.72 KB
/
Copy pathci.yml
File metadata and controls
139 lines (115 loc) · 3.72 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
name: CI
on:
push:
branches:
- main
- staging
pull_request:
branches:
- main
- staging
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Verify pnpm lockfile is the only lockfile
run: |
if [ -f package-lock.json ] || [ -f yarn.lock ] || [ -f npm-shrinkwrap.json ]; then
echo "::error::Found a non-pnpm lockfile. This repo only tracks pnpm-lock.yaml."
exit 1
fi
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Runs `tsc --noEmit` against the same tsconfig.json used by `next
# build` (via the `next` compiler plugin), so a type error here is
# guaranteed to also fail the build step below. This job intentionally
# runs before build/test so type errors fail fast.
- name: Typecheck
run: pnpm run typecheck
unit-tests:
name: Unit tests (Vitest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run unit/component tests
run: pnpm test
e2e-tests:
name: E2E smoke tests (Playwright)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
# The specs drive a `pnpm run dev` server (see playwright.config.ts) and
# only need Chromium. `--with-deps` pulls the OS libraries the browser
# needs on the ubuntu runner.
- name: Install Playwright browser (Chromium)
run: pnpm exec playwright install --with-deps chromium
# NEXT_PUBLIC_API_URL is left empty on purpose: the specs run against the
# in-repo mock `/api/*` routes so they need no live backend or secrets.
- name: Run Playwright e2e smoke tests
run: pnpm run test:e2e
env:
NEXT_PUBLIC_API_URL: ""
build:
name: Build (${{ matrix.network }})
needs: [typecheck, unit-tests]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# `next build` type-checks and statically analyzes every route,
# including the API routes that branch on NEXT_PUBLIC_API_URL
# (see src/app/api/auth/login/route.ts and
# src/lib/api/config.ts::getApiBaseUrl()). Building once with a
# testnet-shaped URL and once with a mainnet-shaped URL catches
# env-specific breakage before it reaches either environment.
network: [testnet, mainnet]
include:
- network: testnet
api_url: https://testnet-api.example.com
- network: mainnet
api_url: https://api.example.com
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
env:
NEXT_PUBLIC_API_URL: ${{ matrix.api_url }}