Skip to content
Source
Sign inSign up

check.yml

258 lines8.4 KB

1name: Check
2on:
3 workflow_dispatch:
4 pull_request:
5 branches: [main, v4/next-minor, v4/next-major]
6 push:
7 branches: [main, v4/next-minor, v4/next-major]
8​
9concurrency:
10 group: ${{ github.workflow }}-${{ github.ref }}
11 cancel-in-progress: true
12​
13permissions: {}
14​
15jobs:
16 static-checks:
17 name: Static
18 runs-on: ubuntu-latest
19 permissions:
20 contents: read
21 timeout-minutes: 10
22 steps:
23 - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
24 - name: Install dependencies
25 uses: ./.github/actions/setup
26 - name: Lint
27 run: pnpm lint
28 - name: Check JSDoc
29 run: pnpm jsdocs --check
30 - name: Check circular dependencies
31 run: pnpm circular
32 - name: Generate AI documentation
33 run: pnpm ai-docgen
34 - name: Verify AI documentation is up-to-date
35 run: |
36 if [ -n "$(git status --short)" ]; then
37 git status --short
38 echo "Run 'pnpm ai-docgen' and commit generated changes."
39 exit 1
40 fi
41​
42 # Each type check takes several minutes on a slow runner, so they run in
43 # parallel instead of sharing one job's timeout.
44 types-matrix:
45 name: Types (${{ matrix.name }})
46 runs-on: namespace-profile-linux-small
47 permissions:
48 contents: read
49 timeout-minutes: 10
50 strategy:
51 fail-fast: false
52 matrix:
53 include:
54 - name: Check
55 deno: ""
56 command: pnpm check
57 - name: Deno
58 deno: v2.9.6
59 command: deno check .
60 - name: Tests
61 deno: ""
62 command: pnpm test-types --target '>=5.9'
63 steps:
64 - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
65 - name: Install dependencies
66 uses: ./.github/actions/setup
67 with:
68 deno-version: ${{ matrix.deno }}
69 - run: ${{ matrix.command }}
70 env:
71 # Leave memory headroom for the runner by collecting the Go heap earlier.
72 GOMEMLIMIT: 4GiB
73 TSTYCHE_FETCH_TIMEOUT: "120"
74​
75 # Keeps the required `Types` status check covering every job above.
76 types:
77 name: Types
78 needs: types-matrix
79 if: always()
80 runs-on: ubuntu-latest
81 permissions: {}
82 timeout-minutes: 5
83 steps:
84 - name: Check type jobs
85 if: needs.types-matrix.result != 'success'
86 run: |
87 echo "Type checks finished with result: ${{ needs.types-matrix.result }}"
88 exit 1
89​
90 build:
91 name: Build
92 if: github.event_name == 'pull_request'
93 runs-on: ubuntu-latest
94 permissions:
95 contents: read
96 timeout-minutes: 10
97 steps:
98 - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
99 - name: Install dependencies
100 uses: ./.github/actions/setup
101 - name: Set strip internals config
102 run: |
103 sed -i 's/"stripInternal": false/"stripInternal": true/' tsconfig.base.json
104 - run: pnpm build
105 - run: pnpm check-dist-types
106​
107 bundle:
108 name: Bundle
109 if: github.event_name == 'pull_request'
110 runs-on: ubuntu-latest
111 permissions:
112 contents: read
113 timeout-minutes: 10
114 steps:
115 - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
116 - name: Install dependencies
117 uses: ./.github/actions/setup
118 - name: Clone base ref
119 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
120 with:
121 path: base
122 ref: ${{ github.event.pull_request.base.ref }}
123 - name: Set strip internals config
124 run: |
125 sed -i 's/"stripInternal": false/"stripInternal": true/' tsconfig.base.json
126 sed -i 's/"stripInternal": false/"stripInternal": true/' base/tsconfig.base.json
127 - name: Build
128 run: |
129 pnpm build
130 cd base
131 pnpm install
132 pnpm build
133 - name: Compare bundle size
134 run: node ./packages/tools/bundle/src/bin.ts compare --base-dir base/packages/tools/bundle/fixtures
135 - name: Upload stats artifact
136 if: github.event_name == 'pull_request'
137 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
138 with:
139 name: bundle-stats
140 path: stats.txt
141 if-no-files-found: error
142​
143 test:
144 name: Test (${{ matrix.runtime }})
145 runs-on: namespace-profile-linux-default
146 env:
147 EFFECT_INTEGRATION_TESTS: "1"
148 # MSSQL integration tests are too flaky for CI; run them locally instead.
149 EFFECT_MSSQL_INTEGRATION_TESTS: "0"
150 # The ephemeral runner provides cleanup without a Ryuk sidecar.
151 TESTCONTAINERS_RYUK_DISABLED: "true"
152 permissions:
153 contents: read
154 timeout-minutes: 15
155 strategy:
156 fail-fast: false
157 matrix:
158 include:
159 - runtime: Node
160 node: ""
161 deno: ""
162 bun: ""
163 command: pnpm test --max-concurrency=10
164 # Node 25 and older handle upgrade request bodies differently.
165 - runtime: Node 24 (platform-node)
166 node: 24
167 deno: ""
168 bun: ""
169 command: pnpm vitest run --project @effect/platform-node --max-concurrency=10
170 - runtime: Deno
171 deno: v2.9.6
172 bun: ""
173 command: deno task test --max-concurrency=10
174 - runtime: Bun
175 deno: ""
176 bun: 1.4.0
177 command: bun run --bun vitest run --max-concurrency=10
178 steps:
179 - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
180​
181 - name: Pre-pull test container images
182 run: |
183 docker pull ghcr.io/tursodatabase/libsql-server:main &
184 docker pull postgres:14-alpine &
185 docker pull mysql:lts &
186 docker pull vitess/vttestserver:mysql80 &
187 docker pull redis:alpine &
188 docker pull coredns/coredns:1.14.7 &
189 wait
190​
191 - name: Install dependencies
192 uses: ./.github/actions/setup
193 with:
194 node-version: ${{ matrix.node }}
195 deno-version: ${{ matrix.deno }}
196 bun-version: ${{ matrix.bun }}
197 - name: Test
198 if: matrix.runtime != 'Deno'
199 run: ${{ matrix.command }}
200 - name: Test with PostgreSQL lifecycle capture
201 if: matrix.runtime == 'Deno'
202 shell: bash
203 env:
204 PG_LIFECYCLE_DIAGNOSTICS: "1"
205 PG_LIFECYCLE_LOG: ${{ runner.temp }}/pg-lifecycle/lifecycle.log
206 run: |
207 capture_dir="${{ runner.temp }}/pg-lifecycle"
208 mkdir -p "$capture_dir"
209 started_at=$(date --iso-8601=seconds)
210 docker events --since "$started_at" --format '{{json .}}' > "$capture_dir/docker-events.jsonl" 2> "$capture_dir/docker-events.stderr" &
211 events_pid=$!
212 cleanup() {
213 # Reap only the capture process started here; preserve the test exit code.
214 kill "$events_pid" 2>/dev/null || true
215 wait "$events_pid" 2>/dev/null || true
216 # The runner owns the output file; only journal access needs sudo.
217 # shellcheck disable=SC2024
218 sudo -n journalctl -u docker.service --since "$started_at" --no-pager -o short-iso-precise > "$capture_dir/docker-journal.log" 2>&1 || true
219 }
220 trap cleanup EXIT
221 trap 'exit 130' INT
222 trap 'exit 143' TERM
223 ${{ matrix.command }} 2>&1 | tee "$capture_dir/tests.log"
224 - name: Upload PostgreSQL lifecycle diagnostics
225 if: always() && matrix.runtime == 'Deno' && (failure() || cancelled())
226 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
227 with:
228 name: deno-pg-lifecycle-${{ github.run_attempt }}
229 path: ${{ runner.temp }}/pg-lifecycle
230 if-no-files-found: warn
231​
232 test-node-minimum:
233 name: Test (Node 22.19.0 minimum)
234 runs-on: namespace-profile-linux-default
235 permissions:
236 contents: read
237 timeout-minutes: 15
238 steps:
239 - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
240 - name: Install dependencies
241 uses: ./.github/actions/setup
242 with:
243 node-version: 22.19.0
244 - name: Test
245 run: pnpm vitest run --project @effect/platform-node --max-concurrency=10
246​
247 doctest:
248 name: Test (Documentation)
249 runs-on: namespace-profile-linux-small
250 permissions:
251 contents: read
252 timeout-minutes: 10
253 steps:
254 - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
255 - name: Install dependencies
256 uses: ./.github/actions/setup
257 - name: Test Documentation
258 run: pnpm doctest