Repository navigation
77 lines (66 loc) · 2.25 KB
/
Copy pathci.yml
File metadata and controls
77 lines (66 loc) · 2.25 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
# Runs on every pull request.
#
# Until now nothing did: deploy.yml triggers only on a push to main, so a PR's
# checks were a secrets scan and nothing else, and a regression was found by
# the deploy that followed the merge rather than by the PR that caused it.
#
# Pushes to main stay covered by deploy.yml, which runs the same gate before it
# publishes. Splitting them keeps each run doing one job and avoids testing the
# same commit twice.
name: CI
on:
pull_request:
workflow_dispatch:
# A new push to a PR makes the previous run irrelevant.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
verify:
name: Lint, typecheck, test, build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
# Each step runs even if an earlier one failed, so one push surfaces
# every problem rather than the first one. The job still fails overall.
- name: Lint
id: lint
if: '!cancelled()'
run: yarn lint
- name: Typecheck
id: typecheck
if: '!cancelled()'
run: yarn typecheck
- name: Unit tests
id: test
if: '!cancelled()'
run: yarn test
- name: Build static export
id: build
if: '!cancelled()'
run: yarn build
# Belt and braces: `if: !cancelled()` lets a step run after a failure,
# so without this the job could be green with a red step.
- name: Fail if any step failed
if: '!cancelled()'
run: |
failed=""
[ "${{ steps.lint.outcome }}" = "failure" ] && failed="$failed lint"
[ "${{ steps.typecheck.outcome }}" = "failure" ] && failed="$failed typecheck"
[ "${{ steps.test.outcome }}" = "failure" ] && failed="$failed test"
[ "${{ steps.build.outcome }}" = "failure" ] && failed="$failed build"
if [ -n "$failed" ]; then
echo "::error::Failed:$failed"
exit 1
fi
echo "All checks passed."