Repository navigation
246 lines (236 loc) · 9.45 KB
/
Copy pathfork-ci.yml
File metadata and controls
246 lines (236 loc) · 9.45 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
name: Fork CI
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: fork-ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
changes:
name: Changes
if: github.repository != 'pingdotgg/t3code'
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
build: ${{ steps.detect.outputs.build }}
test: ${{ steps.detect.outputs.test }}
test_packages: ${{ steps.detect.outputs.test_packages }}
test_web: ${{ steps.detect.outputs.test_web }}
test_server: ${{ steps.detect.outputs.test_server }}
rust: ${{ steps.detect.outputs.rust }}
release_smoke: ${{ steps.detect.outputs.release_smoke }}
mobile_native: ${{ steps.detect.outputs.mobile_native }}
steps:
# Manual checkout avoids credential cleanup traversing orphaned vendored gitlinks.
- name: Checkout
env:
GIT_TERMINAL_PROMPT: "0"
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --no-tags --depth=2 origin "$GITHUB_SHA"
git sparse-checkout set --no-cone '/*' '!/.repos/' '!/apps/mobile/modules/t3-terminal/Vendor/**/*.a'
git checkout --detach FETCH_HEAD
- name: Detect affected jobs
id: detect
uses: ./.github/actions/ci-changes
checks:
name: Checks and build
needs: changes
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Checkout
env:
GIT_TERMINAL_PROMPT: "0"
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --no-tags --depth=2 origin "$GITHUB_SHA"
git sparse-checkout set --no-cone '/*' '!/.repos/' '!/apps/mobile/modules/t3-terminal/Vendor/**/*.a'
git checkout --detach FETCH_HEAD
- uses: ./.github/actions/setup-apt-mirrors
- name: Install native build dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential libsecret-1-dev pkg-config
- uses: ./.github/actions/setup-ci-deps
- name: Setup Rust
uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
- name: Ensure Electron
run: vp run --filter @t3tools/desktop ensure:electron
- name: Install Chromium
run: node apps/web/node_modules/playwright/cli.js install --with-deps --only-shell chromium
- name: Validate changed files
if: github.event_name == 'pull_request'
run: vp run check:changed HEAD^1 --serial
- name: Validate full repository
if: github.event_name != 'pull_request'
run: |
vp check
vp run knip:check
vp run --filter t3 generate --check
vp run --filter @t3tools/source-control-github generate --check
vp run -r --cache --concurrency-limit 2 typecheck
- name: Build desktop pipeline
if: needs.changes.outputs.build != 'false'
run: vp run build:desktop
- name: Verify preload bundle
if: needs.changes.outputs.build != 'false'
run: node apps/desktop/scripts/verify-preload-bundle.mjs
- name: Exercise release workflow steps
if: needs.changes.outputs.release_smoke != 'false'
run: node scripts/release-smoke.ts
clients:
name: Client and package tests
needs: changes
if: needs.changes.outputs.test != 'false' || needs.changes.outputs.test_web != 'false'
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Checkout
env:
GIT_TERMINAL_PROMPT: "0"
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --no-tags --depth=2 origin "$GITHUB_SHA"
git sparse-checkout set --no-cone '/*' '!/.repos/' '!/apps/mobile/modules/t3-terminal/Vendor/**/*.a'
git checkout --detach FETCH_HEAD
- uses: ./.github/actions/setup-apt-mirrors
- name: Install native test dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential libsecret-1-dev pkg-config
- uses: ./.github/actions/setup-ci-deps
- name: Ensure Electron
run: vp run --filter @t3tools/desktop ensure:electron
- name: Install Chromium
if: needs.changes.outputs.test_web != 'false'
run: node apps/web/node_modules/playwright/cli.js install --with-deps --only-shell chromium
- name: Test release checks
run: |
python3 -B .github/scripts/stage-preview-bundle.test.py
node --test .github/scripts/check-nightly-release.test.cjs .github/scripts/vercel-deployment-output.test.cjs
- name: Test affected packages
if: needs.changes.outputs.test != 'false'
env:
TEST_PACKAGES: ${{ needs.changes.outputs.test_packages }}
run: |
filters=(--filter '!t3' --filter '!@t3tools/monorepo' --filter '!@t3tools/web')
if [[ -n "$TEST_PACKAGES" ]]; then
filters=()
for package in $TEST_PACKAGES; do filters+=(--filter "$package"); done
fi
vp run --parallel --concurrency-limit 2 "${filters[@]}" test
- name: Test web
if: needs.changes.outputs.test_web != 'false'
run: vp run --filter @t3tools/web test
server:
name: Server tests ${{ matrix.shard }}
needs: changes
if: needs.changes.outputs.test_server != 'false'
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8]
steps:
- name: Checkout
env:
GIT_TERMINAL_PROMPT: "0"
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --no-tags --depth=2 origin "$GITHUB_SHA"
git sparse-checkout set --no-cone '/*' '!/.repos/' '!/apps/mobile/modules/t3-terminal/Vendor/**/*.a'
git checkout --detach FETCH_HEAD
- uses: ./.github/actions/setup-ci-deps
- name: Setup Rust
uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
- name: Install Chromium
run: node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium
- name: Test server shard
run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
rust:
name: Rust
needs: changes
if: needs.changes.outputs.rust != 'false'
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout
env:
GIT_TERMINAL_PROMPT: "0"
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --no-tags --depth=2 origin "$GITHUB_SHA"
git sparse-checkout set --no-cone '/*' '!/.repos/' '!/apps/mobile/modules/t3-terminal/Vendor/**/*.a'
git checkout --detach FETCH_HEAD
- uses: ./.github/actions/setup-ci-deps
- name: Setup Rust
uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
components: rustfmt
- name: Check Rust crates
run: |
for crate in resource-monitor kde-snap-shot hyprland-snap-shot project-memory; do
cargo fmt --manifest-path "native/$crate/Cargo.toml" -- --check
cargo test --locked --manifest-path "native/$crate/Cargo.toml"
done
- name: Test project memory binding
run: |
node native/project-memory/build.mjs
node --test native/project-memory/kernel.test.mjs
mobile_native:
name: Mobile native checks
needs: changes
if: needs.changes.outputs.mobile_native != 'false'
runs-on: macos-26
timeout-minutes: 30
steps:
- name: Checkout
env:
GIT_TERMINAL_PROMPT: "0"
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --no-tags --depth=2 origin "$GITHUB_SHA"
git sparse-checkout set --no-cone '/*' '!/.repos/'
git checkout --detach FETCH_HEAD
- uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
with:
node-version-file: package.json
cache: true
run-install: |
args:
- --filter=@t3tools/scripts...
- name: Install native analysis tools
run: brew bundle install --file apps/mobile/Brewfile
- name: Lint mobile native sources
run: vp run lint:mobile
check:
name: Fork Check
if: ${{ !cancelled() && github.repository != 'pingdotgg/t3code' }}
needs: [changes, checks, clients, server, rust, mobile_native]
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Require every affected job to pass
env:
RESULTS: ${{ toJSON(needs) }}
run: |
echo "$RESULTS" | jq -r 'to_entries[] | "\(.key): \(.value.result)"'
echo "$RESULTS" | jq -e '.changes.outputs as $gates
| {clients: ["test", "test_web"], server: ["test_server"]} as $renamed
| all(to_entries[];
.value.result == "success"
or (.value.result == "skipped"
and (($renamed[.key] // [.key]) | all(.[]; $gates[.] == "false"))))' > /dev/null