-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 2.29 KB
/
Copy pathci.yml
File metadata and controls
58 lines (50 loc) · 2.29 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
name: ci
on:
push:
branches: [main]
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
# Off because it probes `yarn cache dir` inside this step, which is before corepack is on
# -- so it runs the runner's global yarn 1 against a `packageManager` field it refuses.
package-manager-cache: false
# yarn comes from `packageManager`, so corepack has to be on before any yarn command.
- run: corepack enable
- run: yarn install --immutable
# Both builds. `__DEV__` guards whole branches here, and `itDev` / `itProd` pin cases to one
# of them, so a single pass leaves part of the suite unrun.
- run: yarn test
- run: yarn test:prod
# Also typechecks: `build` is `yarn typecheck && bob build`.
#
# Retried because bob builds its targets with Promise.all, and the commonjs target validates
# the `main` field -- which points into lib/module -- so it fails whenever it happens to
# finish before the module target has written that file. Nothing to fix on our side short of
# repointing `main` at the commonjs output, which would change what bundlers resolve.
- name: build
run: |
for attempt in 1 2 3; do
if yarn build; then exit 0; fi
echo "::warning::build attempt $attempt failed; retrying (known bob target race)"
done
exit 1
# `lib/` is committed and nothing rebuilds it on the consumer's side: `prepublishOnly` never
# fires for a git dependency, and `package.json` points main/module at `./lib/module`. A tag
# cut from a stale `lib/` ships the old code while every source-level check above still
# passes, so the build output has to be diffed too.
- name: lib/ matches src/
run: |
# --intent-to-add so a brand new source file's missing output counts as a difference;
# plain `git diff` says nothing about untracked files.
git add --intent-to-add -A lib
if ! git diff --quiet -- lib; then
echo "::error::lib/ does not match src/. Run 'yarn build' and commit the result."
git diff --stat -- lib
exit 1
fi