-
Notifications
You must be signed in to change notification settings - Fork 529
160 lines (137 loc) · 4.98 KB
/
Copy pathci.yml
File metadata and controls
160 lines (137 loc) · 4.98 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
# Per-package + per-example check matrix. One job per workspace so a
# regression in (say) wsd's tests doesn't hide a typecheck failure in
# workspace. Each job is self-contained: install at the repo root,
# build siblings whose dist/ this package's typecheck depends on,
# then run biome + typecheck + tests scoped to that package.
#
# Runs on every PR and on every push to main or next, so a merge
# that slipped through (admin override, branch protection off,
# etc.) still gets the same lint/build/typecheck/test signal.
#
# Path filter skips pure documentation changes — they have no
# influence on any package's lint, typecheck, or test surface.
name: CI
on:
pull_request:
paths-ignore:
- "**/*.md"
- "docs/**"
- ".github/**/*.md"
push:
branches: [main, next]
paths-ignore:
- "**/*.md"
- "docs/**"
- ".github/**/*.md"
permissions:
contents: read
concurrency:
# PRs key on the PR number so successive pushes cancel the prior
# run; pushes to main key on the ref so we never cancel a main
# build (those are the historical signal).
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
package:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- name: dofs
workspace: "@cloudflare/dofs"
path: packages/dofs
needs-siblings: false
- name: rpc
workspace: "@cloudflare/workspace-rpc"
path: packages/rpc
needs-siblings: true
- name: workspace
workspace: "@cloudflare/workspace"
path: packages/workspace
needs-siblings: true
- name: wsd
workspace: "@cloudflare/workspace-wsd"
path: packages/wsd
needs-siblings: true
# libfuse2 (libfuse.so.2) is what fuse-native binds to at
# runtime; fuse3 ships /dev/fuse helpers and the
# FUSE_MOUNT=shim tests need it for the userspace mount path.
system-deps: "libfuse2t64 fuse3"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: ./.github/actions/install
- name: Install system dependencies
if: matrix.system-deps
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ${{ matrix.system-deps }}
# Build every workspace's dist/ unconditionally for now. The
# workspace + wsd jobs need dofs + rpc dist, the rpc job needs
# dofs dist, and the cost of an extra `tsc` pass is small
# compared to the test runtime. Revisit per-package once
# @cloudflare/workspace bundles dofs + rpc internally.
- name: Build all workspaces
if: matrix.needs-siblings
run: npm run build --workspaces --if-present
- name: Build this package
if: matrix.needs-siblings == false
run: npm run build --workspace ${{ matrix.workspace }} --if-present
- name: Lint + format check
run: npx biome check ${{ matrix.path }}
- name: Typecheck
run: npm run typecheck --workspace ${{ matrix.workspace }} --if-present
- name: Test
run: npm test --workspace ${{ matrix.workspace }} --if-present
example:
name: example/${{ matrix.name }}
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- name: think
workspace: "@cloudflare/example-think"
path: examples/think
- name: container
workspace: "@example/workspace-container"
path: examples/container
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: ./.github/actions/install
# Examples consume the workspace packages via the
# local symlink, so the workspace's dist/ has to exist before
# the example's typecheck resolves its imports.
- run: npm run build --workspaces --if-present
- name: Generate worker types
run: npx wrangler types
working-directory: ${{ matrix.path }}
- name: Lint + format check
run: npx biome check ${{ matrix.path }}
- name: Typecheck
run: npm run typecheck --workspace ${{ matrix.workspace }} --if-present
# Examples don't ship tests today; --if-present makes this a
# no-op until they do.
- name: Test
run: npm test --workspace ${{ matrix.workspace }} --if-present
preview:
name: preview package
if: github.event_name == 'pull_request'
needs: [package, example]
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
filter: tree:0
- uses: ./.github/actions/install
- run: npm run build --workspaces --if-present
- run: npx pkg-pr-new publish --peerDeps ./packages/workspace