Repository navigation
217 lines (213 loc) · 7.13 KB
/
Copy pathpull-request.yml
File metadata and controls
217 lines (213 loc) · 7.13 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Pull Request
on: [pull_request]
jobs:
Format:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Install Corepack
run: npm install --global corepack
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js environment
uses: actions/setup-node@v6.3.0
with:
node-version-file: ".node-version"
cache: yarn
- name: Install dependencies
run: yarn
- name: Check formatting (Oxfmt and ReScript)
run: yarn ci:format
Site_Checks:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Install Corepack
run: npm install --global corepack
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js environment
uses: actions/setup-node@v6.3.0
with:
node-version-file: ".node-version"
cache: yarn
- name: Install dependencies
run: yarn
- name: Check generated route types
run: |
yarn check:routes
git diff --exit-code -- packages/shared/src/Path.res
- name: Check committed ReScript output
run: yarn ci:generated
- name: Test examples and hrefs
run: yarn test
- name: Check unused ReScript values and exports
run: yarn check:dead-code
- name: Test dead-code diagnostics
run: node --test scripts/__tests__/check-dead-code.test.mjs
# Check the built Docs Pages routes and the Guide local dev server.
Wrangler:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Setup Node.js environment
uses: actions/setup-node@v6.3.0
with:
node-version-file: ".node-version"
cache: yarn
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: yarn
- name: Build ReScript
run: yarn build:res
- name: Build docs
run: yarn build:vite
- name: Validate Docs Wrangler dev server
working-directory: apps/docs
run: |
yarn wrangler pages dev build/client --port 8788 > wrangler.log 2>&1 &
server_pid=$!
trap 'kill "$server_pid"' EXIT
for _ in {1..15}; do
if curl --max-time 2 --fail --silent http://127.0.0.1:8788/favicon.ico > /dev/null; then
node scripts/test-pages.mjs http://127.0.0.1:8788
exit 0
fi
sleep 1
done
cat wrangler.log
exit 1
- name: Build guide
run: yarn build:guide
- name: Validate Guide Wrangler dev server
working-directory: apps/guide
run: |
yarn wrangler dev --port 8789 > wrangler.log 2>&1 &
server_pid=$!
trap 'kill "$server_pid"' EXIT
for _ in {1..15}; do
if curl --max-time 2 --fail --silent http://127.0.0.1:8789/ > /dev/null; then
curl --max-time 2 --fail --silent http://127.0.0.1:8789/robots.txt | cmp public/robots.txt -
for guide_icon in build/client/assets/*.avif; do
curl --max-time 2 --fail --silent "http://127.0.0.1:8789/${guide_icon#build/client/}" | cmp "$guide_icon" -
done
exit 0
fi
sleep 1
done
cat wrangler.log
exit 1
Vitest:
runs-on: ubuntu-24.04
container:
# Keep this image tag aligned with package.json's playwright version.
image: mcr.microsoft.com/playwright:v1.63.0-noble
env:
# The pinned Playwright image provides Chromium from this browser cache.
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Install Corepack
run: npm install --global corepack
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js environment
uses: actions/setup-node@v6.3.0
with:
node-version-file: ".node-version"
cache: yarn
- name: Install dependencies
run: yarn
- name: Build ReScript
run: yarn build:res
- name: Docs Vitest
run: yarn workspace @rescript-lang/docs ci:test
- name: Docs script tests (Node)
run: yarn workspace @rescript-lang/docs ci:test:scripts
- name: Guide Vitest
run: yarn workspace @rescript-lang/guide ci:test
- name: Guide browser history E2E
env:
# Keep the prerender server and requests on the same localhost address in Docker.
NODE_OPTIONS: --dns-result-order=ipv4first
run: yarn workspace @rescript-lang/guide test:e2e
- name: Upload guide browser test artifacts
if: failure()
uses: actions/upload-artifact@v6
with:
name: guide-browser-test-artifacts
path: apps/guide/test-results
Homepage_E2E:
runs-on: ubuntu-24.04
env:
VITE_ALGOLIA_APP_ID: test-app-id
VITE_ALGOLIA_INDEX_NAME: test-index
VITE_ALGOLIA_SEARCH_API_KEY: test-search-key
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Install Corepack
run: npm install --global corepack
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js environment
uses: actions/setup-node@v6.3.0
with:
node-version-file: ".node-version"
cache: yarn
- name: Install dependencies
run: yarn
- name: Build docs
run: yarn workspace @rescript-lang/docs build
- name: Report homepage asset sizes
run: yarn workspace @rescript-lang/docs ci:homepage-performance
- name: Run homepage Cypress tests
uses: cypress-io/github-action@v7
with:
install: false
working-directory: apps/docs
browser: chrome
config-file: cypress.homepage.config.mjs
start: yarn serve:build
wait-on: http://127.0.0.1:4173
- name: Upload Cypress artifacts
if: failure()
uses: actions/upload-artifact@v6
with:
name: homepage-cypress-artifacts
path: apps/docs/test-results/cypress
Visual_Regression:
runs-on: ubuntu-24.04
container:
# Keep this image tag aligned with package.json's playwright version.
image: mcr.microsoft.com/playwright:v1.63.0-noble
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Install Corepack
run: npm install --global corepack
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js environment
uses: actions/setup-node@v6.3.0
with:
node-version-file: ".node-version"
cache: yarn
- name: Install dependencies
run: yarn
- name: Build ReScript
run: yarn build:res
- name: Visual regression tests
run: yarn ci:test:visual
- name: Upload visual regression artifacts
if: failure()
uses: actions/upload-artifact@v6
with:
name: visual-regression-artifacts
path: |
apps/docs/.vitest-attachments