Repository navigation
291 lines (238 loc) · 8.81 KB
/
Copy pathpr-ci.yml
File metadata and controls
291 lines (238 loc) · 8.81 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
name: CI
on:
pull_request:
env:
SKIP_INSTALL_SIMPLE_GIT_HOOKS: "1"
concurrency:
group: pr-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect code changes
runs-on: ubuntu-latest
outputs:
code: ${{ steps.detect.outputs.code_changed }}
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Detect code changes
id: detect
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
run: .github/scripts/detect-code-changes.sh "$BASE_SHA" "$HEAD_SHA"
changeset-status:
name: Release-note changeset
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.2
- name: Verify release-note changeset
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
run: bun run ./scripts/release/verify-pr-release-notes.ts "$BASE_SHA" "$HEAD_SHA"
windows-compat:
name: Windows compatibility
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: windows-latest
steps:
- name: Disable automatic CRLF conversion
run: git config --global core.autocrlf false
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.2
- name: Set up Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
- name: Install Jujutsu
uses: taiki-e/install-action@76c2e6406e52637deed7160d77bded76bd83e06e # v2.87.14
with:
tool: jj-cli
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Format check
run: bun run format:check
- name: Lint
run: bun run lint
- name: Typecheck
run: bun run typecheck
- name: Module boundary check
run: bun run deps:check
- name: Theme contrast check
run: bun run test:theme-contrast
- name: Windows platform test suite
run: bun run test:windows
compiled-headless-portability:
name: Compiled headless portability (${{ matrix.os }})
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
executable: dist/hunk
- os: windows-latest
executable: dist/hunk.exe
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build binary
run: bun run build:bin
- name: Verify compiled headless commands skip OpenTUI
run: bun test ./test/cli/compiled-headless-native-lib.test.ts
env:
HUNK_TEST_EXECUTABLE: ${{ github.workspace }}/${{ matrix.executable }}
linux-validate:
name: Linux validation and packaging
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.2
- name: Set up Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
- name: Install Jujutsu
uses: taiki-e/install-action@76c2e6406e52637deed7160d77bded76bd83e06e # v2.87.14
with:
tool: jj-cli
- name: Install Sapling
run: |
sudo apt-get install -y xz-utils
sudo mkdir -p /opt/sapling
SAPLING_URL="https://github.com/facebook/sapling/releases/download/0.2.20260317-201835%2B0234c21f/sapling-0.2.20260317-201835%2B0234c21f-linux-x64.tar.xz"
SAPLING_SHA256="2dca0b964a2f3e2e3ad3f4f01794dc7e829de4aedddb2798a7bae883ce6cd71f"
curl -fsSL "$SAPLING_URL" -o /tmp/sapling.tar.xz
echo "$SAPLING_SHA256 /tmp/sapling.tar.xz" | sha256sum --check
sudo tar -xJf /tmp/sapling.tar.xz -C /opt/sapling
sudo ln -s /opt/sapling/sl /usr/local/bin/sl
sl version
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Format check
run: bun run format:check
- name: Lint
run: bun run lint
- name: Typecheck
run: bun run typecheck
- name: Module boundary check
run: bun run deps:check
- name: Theme contrast check
run: bun run test:theme-contrast
- name: Test suite
run: bun run test
- name: Real Node broker adapter tests
run: bun run test:session-broker-node
- name: TTY smoke tests
run: bun run test:tty-smoke
- name: Build npm runtime bundle
run: bun run build:npm
- name: Verify npm pack output
run: bun run check:pack
- name: Simulate global npm install
run: |
pkg_dir="$(mktemp -d)"
install_dir="$(mktemp -d)"
node_dir="$(dirname "$(command -v node)")"
npm pack ./packages/hunk --ignore-scripts --pack-destination "$pkg_dir" >/dev/null
pkg="$(find "$pkg_dir" -maxdepth 1 -name 'hunkdiff-*.tgz' | head -n1)"
npm install -g --prefix "$install_dir" "$pkg"
PATH="$install_dir/bin:$node_dir:/usr/bin:/bin"
if command -v bun >/dev/null 2>&1; then
echo "bun unexpectedly available on the sanitized PATH" >&2
exit 1
fi
hunk --help | grep 'Usage: hunk'
- name: Stage prebuilt npm packages
# Reuse the runtime bundle built and packed above; only the native binary
# and prebuilt package layout remain for this validation pass.
run: bun run build:bin && bun run ./scripts/packaging/stage-prebuilt-npm.ts
- name: Verify compiled headless commands skip OpenTUI
run: bun test ./test/cli/compiled-headless-native-lib.test.ts
env:
HUNK_TEST_EXECUTABLE: ${{ github.workspace }}/dist/hunk
- name: Verify compiled binary watch mode
run: bun test ./test/pty/watch.test.ts
env:
HUNK_TEST_EXECUTABLE: ${{ github.workspace }}/dist/hunk
- name: Verify staged prebuilt packs
run: bun run check:prebuilt-pack
- name: Smoke test prebuilt global install
run: bun run smoke:prebuilt-install
pty-integration:
name: PTY integration tests
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Verify terminal tools
run: |
command -v script
command -v timeout
- name: PTY integration tests
run: bun run test:integration
pr-validate:
name: Typecheck + Test + Smoke
needs:
- changes
- linux-validate
- pty-integration
if: always()
runs-on: ubuntu-latest
steps:
- name: Verify validation jobs
env:
CHANGES_RESULT: ${{ needs.changes.result }}
CODE_CHANGED: ${{ needs.changes.outputs.code }}
LINUX_RESULT: ${{ needs.linux-validate.result }}
PTY_RESULT: ${{ needs.pty-integration.result }}
run: |
if [[ "$CHANGES_RESULT" != "success" ]]; then
echo "Change detection: $CHANGES_RESULT" >&2
exit 1
fi
if [[ "$CODE_CHANGED" != "true" ]]; then
echo "No code changes require validation."
exit 0
fi
if [[ "$LINUX_RESULT" != "success" || "$PTY_RESULT" != "success" ]]; then
echo "Linux validation: $LINUX_RESULT" >&2
echo "PTY integration: $PTY_RESULT" >&2
exit 1
fi