bridge-solver 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. bridge_solver-2.1.0/.github/workflows/ci.yml +323 -0
  2. bridge_solver-2.1.0/.github/workflows/pages.yml +128 -0
  3. bridge_solver-2.1.0/.github/workflows/release.yml +306 -0
  4. bridge_solver-2.1.0/.gitignore +35 -0
  5. bridge_solver-2.1.0/CLAUDE.md +190 -0
  6. bridge_solver-2.1.0/Cargo.lock +381 -0
  7. bridge_solver-2.1.0/Cargo.toml +92 -0
  8. bridge_solver-2.1.0/LICENSE-APACHE +202 -0
  9. bridge_solver-2.1.0/LICENSE-MIT +22 -0
  10. bridge_solver-2.1.0/LICENSES/Apache-2.0.txt +202 -0
  11. bridge_solver-2.1.0/LICENSES/MIT.txt +22 -0
  12. bridge_solver-2.1.0/LICENSES/THIRD-PARTY-NOTICES +227 -0
  13. bridge_solver-2.1.0/PKG-INFO +119 -0
  14. bridge_solver-2.1.0/README.md +188 -0
  15. bridge_solver-2.1.0/THIRD-PARTY-NOTICES +275 -0
  16. bridge_solver-2.1.0/bench/README.md +204 -0
  17. bridge_solver-2.1.0/bench/comparison/METHODOLOGY.md +176 -0
  18. bridge_solver-2.1.0/bench/comparison/RESULTS.md +205 -0
  19. bridge_solver-2.1.0/bench/comparison/build-reference.sh +55 -0
  20. bridge_solver-2.1.0/bench/comparison/case1-latency.svg +41 -0
  21. bridge_solver-2.1.0/bench/comparison/case1-latency.tsv +2001 -0
  22. bridge_solver-2.1.0/bench/comparison/case23-throughput.txt +42 -0
  23. bridge_solver-2.1.0/bench/comparison/gen-corpus.py +77 -0
  24. bridge_solver-2.1.0/bench/comparison/latency.sh +65 -0
  25. bridge_solver-2.1.0/bench/comparison/ref-latency.patch +77 -0
  26. bridge_solver-2.1.0/bench/comparison/report.py +162 -0
  27. bridge_solver-2.1.0/bench/comparison/throughput.sh +69 -0
  28. bridge_solver-2.1.0/bench/corpus.json +68 -0
  29. bridge_solver-2.1.0/bench/results/BASELINE.md +83 -0
  30. bridge_solver-2.1.0/bench/results/cache-fix.json +261 -0
  31. bridge_solver-2.1.0/bench/results/cache-fix.md +99 -0
  32. bridge_solver-2.1.0/bench/results/cache-reuse.md +190 -0
  33. bridge_solver-2.1.0/bench/results/mtdf-seed.json +100 -0
  34. bridge_solver-2.1.0/bench/results/mtdf-seed.md +57 -0
  35. bridge_solver-2.1.0/bench/results/node-counter-after.json +261 -0
  36. bridge_solver-2.1.0/bench/results/node-counter-before.json +261 -0
  37. bridge_solver-2.1.0/bench/results/release-profile.json +261 -0
  38. bridge_solver-2.1.0/bench/results/release-profile.md +1297 -0
  39. bridge_solver-2.1.0/bench/results/upstream-node-sweep.txt +30 -0
  40. bridge_solver-2.1.0/bench/results/v1.0.0-17-g2e21c93-dirty.json +19 -0
  41. bridge_solver-2.1.0/bench/results/v1.0.0-31-g4c7a37b-dirty.json +19 -0
  42. bridge_solver-2.1.0/build.rs +41 -0
  43. bridge_solver-2.1.0/dev-build.sh +208 -0
  44. bridge_solver-2.1.0/docs/HANDOFF-phase6.md +319 -0
  45. bridge_solver-2.1.0/docs/ROADMAP.md +438 -0
  46. bridge_solver-2.1.0/docs/claim-checker.md +352 -0
  47. bridge_solver-2.1.0/docs/cli-guide.md +387 -0
  48. bridge_solver-2.1.0/docs/performance-baseline.md +202 -0
  49. bridge_solver-2.1.0/examples/bench_fixtures.rs +307 -0
  50. bridge_solver-2.1.0/examples/time_optimal_line.rs +70 -0
  51. bridge_solver-2.1.0/fixtures/bench-boards.lin +10 -0
  52. bridge_solver-2.1.0/fixtures/bridge-composer/.gitattributes +3 -0
  53. bridge_solver-2.1.0/fixtures/bridge-composer/README.md +116 -0
  54. bridge_solver-2.1.0/fixtures/bridge-composer/pbn-order-test-bc-dd.pbn +421 -0
  55. bridge_solver-2.1.0/fixtures/bridge-composer/pbn-order-test-bc.pbn +421 -0
  56. bridge_solver-2.1.0/fixtures/bridge-composer/pbn-order-test.pbn +355 -0
  57. bridge_solver-2.1.0/fixtures/divergence/README.md +120 -0
  58. bridge_solver-2.1.0/fixtures/divergence/deal.1 +5 -0
  59. bridge_solver-2.1.0/fixtures/divergence/deal.10 +5 -0
  60. bridge_solver-2.1.0/fixtures/divergence/deal.12 +5 -0
  61. bridge_solver-2.1.0/fixtures/divergence/deal.134 +5 -0
  62. bridge_solver-2.1.0/fixtures/divergence/deal.38 +5 -0
  63. bridge_solver-2.1.0/fixtures/divergence/deal.4 +5 -0
  64. bridge_solver-2.1.0/fixtures/divergence/deal.54 +5 -0
  65. bridge_solver-2.1.0/fixtures/divergence/deal.72 +5 -0
  66. bridge_solver-2.1.0/fixtures/divergence/first-divergence.sh +49 -0
  67. bridge_solver-2.1.0/fixtures/divergence/freak.0 +5 -0
  68. bridge_solver-2.1.0/fixtures/divergence/freak.1 +6 -0
  69. bridge_solver-2.1.0/fixtures/divergence/freak.2 +5 -0
  70. bridge_solver-2.1.0/fixtures/divergence/freak.3 +5 -0
  71. bridge_solver-2.1.0/fixtures/divergence/lockstep-200.pbn +200 -0
  72. bridge_solver-2.1.0/fixtures/divergence/manifest.tsv +41 -0
  73. bridge_solver-2.1.0/functions/api/stats.ts +429 -0
  74. bridge_solver-2.1.0/functions/t.ts +161 -0
  75. bridge_solver-2.1.0/pyproject.toml +37 -0
  76. bridge_solver-2.1.0/python/Cargo.lock +316 -0
  77. bridge_solver-2.1.0/python/Cargo.toml +19 -0
  78. bridge_solver-2.1.0/python/LICENSES/Apache-2.0.txt +202 -0
  79. bridge_solver-2.1.0/python/LICENSES/MIT.txt +22 -0
  80. bridge_solver-2.1.0/python/LICENSES/THIRD-PARTY-NOTICES +227 -0
  81. bridge_solver-2.1.0/python/README.md +91 -0
  82. bridge_solver-2.1.0/python/RELEASING.md +82 -0
  83. bridge_solver-2.1.0/python/bridge_solver/__init__.py +220 -0
  84. bridge_solver-2.1.0/python/bridge_solver/py.typed +0 -0
  85. bridge_solver-2.1.0/python/src/lib.rs +125 -0
  86. bridge_solver-2.1.0/python/tests/test_bridge_solver.py +87 -0
  87. bridge_solver-2.1.0/scripts/claim-bench-fixture.sh +28 -0
  88. bridge_solver-2.1.0/scripts/third-party-notices.py +311 -0
  89. bridge_solver-2.1.0/src/analyse_play.rs +1427 -0
  90. bridge_solver-2.1.0/src/bin/bridge-claim/main.rs +420 -0
  91. bridge_solver-2.1.0/src/bin/bridge-solver/main.rs +1516 -0
  92. bridge_solver-2.1.0/src/bin/solver-bench/dds.rs +254 -0
  93. bridge_solver-2.1.0/src/bin/solver-bench/main.rs +1570 -0
  94. bridge_solver-2.1.0/src/bin/solver-diag/main.rs +391 -0
  95. bridge_solver-2.1.0/src/bridge_solver.rs +1118 -0
  96. bridge_solver-2.1.0/src/cache.rs +1 -0
  97. bridge_solver-2.1.0/src/cards.rs +426 -0
  98. bridge_solver-2.1.0/src/claim.rs +1654 -0
  99. bridge_solver-2.1.0/src/claim_bench.rs +391 -0
  100. bridge_solver-2.1.0/src/convert.rs +133 -0
  101. bridge_solver-2.1.0/src/hands.rs +292 -0
  102. bridge_solver-2.1.0/src/json_api.rs +462 -0
  103. bridge_solver-2.1.0/src/lib.rs +71 -0
  104. bridge_solver-2.1.0/src/par.rs +756 -0
  105. bridge_solver-2.1.0/src/pattern.rs +936 -0
  106. bridge_solver-2.1.0/src/pattern_vec.rs +447 -0
  107. bridge_solver-2.1.0/src/play.rs +72 -0
  108. bridge_solver-2.1.0/src/search.rs +2075 -0
  109. bridge_solver-2.1.0/src/tests.rs +1157 -0
  110. bridge_solver-2.1.0/src/types.rs +173 -0
  111. bridge_solver-2.1.0/web/claim-bench.html +158 -0
  112. bridge_solver-2.1.0/web/gallery.html +395 -0
  113. bridge_solver-2.1.0/web/index.html +77 -0
  114. bridge_solver-2.1.0/web/package-lock.json +2089 -0
  115. bridge_solver-2.1.0/web/package.json +23 -0
  116. bridge_solver-2.1.0/web/public/THIRD-PARTY-NOTICES +216 -0
  117. bridge_solver-2.1.0/web/public/_headers +55 -0
  118. bridge_solver-2.1.0/web/public/get.html +227 -0
  119. bridge_solver-2.1.0/web/public/privacy.html +184 -0
  120. bridge_solver-2.1.0/web/public/site-nav.css +74 -0
  121. bridge_solver-2.1.0/web/public/stats.html +323 -0
  122. bridge_solver-2.1.0/web/public/stats.js +897 -0
  123. bridge_solver-2.1.0/web/src/App.vue +1484 -0
  124. bridge_solver-2.1.0/web/src/assets/tokens.css +159 -0
  125. bridge_solver-2.1.0/web/src/claim-bench/main.js +213 -0
  126. bridge_solver-2.1.0/web/src/claim-bench/style.css +143 -0
  127. bridge_solver-2.1.0/web/src/claim-bench/worker.js +44 -0
  128. bridge_solver-2.1.0/web/src/components/AuctionTable.vue +211 -0
  129. bridge_solver-2.1.0/web/src/components/BridgeTable.vue +237 -0
  130. bridge_solver-2.1.0/web/src/components/DebugPanel.vue +209 -0
  131. bridge_solver-2.1.0/web/src/components/DoubleDummyTable.vue +147 -0
  132. bridge_solver-2.1.0/web/src/components/ErrorSummary.vue +454 -0
  133. bridge_solver-2.1.0/web/src/components/HandDisplay.vue +208 -0
  134. bridge_solver-2.1.0/web/src/components/InputPanel.vue +418 -0
  135. bridge_solver-2.1.0/web/src/components/NodePanel.vue +217 -0
  136. bridge_solver-2.1.0/web/src/components/PlayTrace.vue +586 -0
  137. bridge_solver-2.1.0/web/src/components/PlayerErrors.vue +165 -0
  138. bridge_solver-2.1.0/web/src/components/SeatPanel.vue +107 -0
  139. bridge_solver-2.1.0/web/src/components/SolveNote.vue +72 -0
  140. bridge_solver-2.1.0/web/src/components/TrickArea.vue +168 -0
  141. bridge_solver-2.1.0/web/src/lib/benchmark.js +141 -0
  142. bridge_solver-2.1.0/web/src/lib/benchmark.test.js +111 -0
  143. bridge_solver-2.1.0/web/src/lib/cardplay.js +180 -0
  144. bridge_solver-2.1.0/web/src/lib/cardplay.test.js +200 -0
  145. bridge_solver-2.1.0/web/src/lib/cards.js +131 -0
  146. bridge_solver-2.1.0/web/src/lib/cards.test.js +149 -0
  147. bridge_solver-2.1.0/web/src/lib/claimBench.js +120 -0
  148. bridge_solver-2.1.0/web/src/lib/claimBench.test.js +81 -0
  149. bridge_solver-2.1.0/web/src/lib/ddTable.js +106 -0
  150. bridge_solver-2.1.0/web/src/lib/ddTable.test.js +159 -0
  151. bridge_solver-2.1.0/web/src/lib/deal.js +149 -0
  152. bridge_solver-2.1.0/web/src/lib/deal.test.js +146 -0
  153. bridge_solver-2.1.0/web/src/lib/errors.js +148 -0
  154. bridge_solver-2.1.0/web/src/lib/errors.test.js +230 -0
  155. bridge_solver-2.1.0/web/src/lib/example.js +18 -0
  156. bridge_solver-2.1.0/web/src/lib/fixtures/bench-v1.json +17 -0
  157. bridge_solver-2.1.0/web/src/lib/fixtures/bench-v2.json +17 -0
  158. bridge_solver-2.1.0/web/src/lib/fixtures/claim-bench-v1.json +1 -0
  159. bridge_solver-2.1.0/web/src/lib/input.js +215 -0
  160. bridge_solver-2.1.0/web/src/lib/input.test.js +115 -0
  161. bridge_solver-2.1.0/web/src/lib/perf.js +151 -0
  162. bridge_solver-2.1.0/web/src/lib/perf.test.js +103 -0
  163. bridge_solver-2.1.0/web/src/lib/session.js +183 -0
  164. bridge_solver-2.1.0/web/src/lib/session.test.js +149 -0
  165. bridge_solver-2.1.0/web/src/lib/siteNav.test.js +44 -0
  166. bridge_solver-2.1.0/web/src/lib/solver.js +324 -0
  167. bridge_solver-2.1.0/web/src/lib/solver.test.js +63 -0
  168. bridge_solver-2.1.0/web/src/lib/solver.worker.js +82 -0
  169. bridge_solver-2.1.0/web/src/lib/telemetry.js +213 -0
  170. bridge_solver-2.1.0/web/src/lib/telemetry.test.js +129 -0
  171. bridge_solver-2.1.0/web/src/main.js +5 -0
  172. bridge_solver-2.1.0/web/vite.config.js +66 -0
  173. bridge_solver-2.1.0/wrangler.jsonc +46 -0
@@ -0,0 +1,323 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+ RUST_BACKTRACE: 1
12
+
13
+ jobs:
14
+ test:
15
+ name: Test
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ os: [ubuntu-latest, windows-latest, macos-latest]
21
+ rust: [stable]
22
+
23
+ steps:
24
+ - name: Checkout code
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Install Rust toolchain
28
+ uses: dtolnay/rust-toolchain@master
29
+ with:
30
+ toolchain: ${{ matrix.rust }}
31
+
32
+ - name: Cache Rust dependencies
33
+ uses: Swatinem/rust-cache@v2
34
+
35
+ - name: Build library
36
+ run: cargo build --verbose
37
+
38
+ - name: Build CLI binaries
39
+ run: cargo build --features cli --verbose
40
+
41
+ - name: Run tests
42
+ # Not `--all-features`: that switches on the debug features
43
+ # (no_tricks_pruning, no_fast_tricks, ...) which alter solver results.
44
+ run: cargo test --workspace --features cli,play-analysis,json
45
+
46
+ - name: Build release
47
+ run: cargo build --features cli --release --verbose
48
+
49
+ # THIRD-PARTY-NOTICES asserts what a distributed copy contains. A
50
+ # hand-kept one goes stale the moment a dependency moves, and a stale
51
+ # notice is worse than none — so both are generated, and this fails if
52
+ # they no longer match what cargo resolved.
53
+ - name: Check the third-party notices are up to date
54
+ if: runner.os == 'Linux'
55
+ run: scripts/third-party-notices.py --check
56
+
57
+ lint:
58
+ name: Lint
59
+ runs-on: ubuntu-latest
60
+
61
+ steps:
62
+ - name: Checkout code
63
+ uses: actions/checkout@v4
64
+
65
+ - name: Install Rust toolchain
66
+ uses: dtolnay/rust-toolchain@stable
67
+ with:
68
+ components: rustfmt, clippy
69
+
70
+ - name: Cache Rust dependencies
71
+ uses: Swatinem/rust-cache@v2
72
+
73
+ - name: Check formatting
74
+ run: cargo fmt --all -- --check
75
+
76
+ - name: Run clippy (library)
77
+ run: cargo clippy --workspace --all-targets -- -D warnings
78
+
79
+ - name: Run clippy (cli + play-analysis + json)
80
+ run: cargo clippy --workspace --all-targets --features cli,play-analysis,json -- -D warnings
81
+
82
+ # `wasm/` is a separate workspace (it path-depends on this crate), so the jobs
83
+ # above never reach it: `--workspace` here does not include it. Without this
84
+ # job its tests never run and a wasm32 regression — the `Instant` trap class of
85
+ # problem, which compiles fine and only fails at runtime — ships unnoticed.
86
+ wasm:
87
+ name: WebAssembly
88
+ runs-on: ubuntu-latest
89
+
90
+ steps:
91
+ - name: Checkout code
92
+ uses: actions/checkout@v4
93
+
94
+ - name: Install Rust toolchain
95
+ uses: dtolnay/rust-toolchain@stable
96
+ with:
97
+ components: rustfmt, clippy
98
+ targets: wasm32-unknown-unknown
99
+
100
+ - name: Cache Rust dependencies
101
+ uses: Swatinem/rust-cache@v2
102
+ with:
103
+ workspaces: wasm
104
+
105
+ - name: Check formatting
106
+ working-directory: wasm
107
+ run: cargo fmt --all -- --check
108
+
109
+ - name: Run clippy
110
+ working-directory: wasm
111
+ run: cargo clippy --all-targets -- -D warnings
112
+
113
+ # Native, so the LIN-parsing tests actually execute.
114
+ - name: Run tests
115
+ working-directory: wasm
116
+ run: cargo test
117
+
118
+ # The target that matters: everything above can pass while wasm32 fails.
119
+ - name: Build for wasm32
120
+ working-directory: wasm
121
+ run: cargo build --target wasm32-unknown-unknown --release
122
+
123
+ # The Pages site. Its own build runs only on main, so this is what catches a
124
+ # broken site on a pull request.
125
+ web:
126
+ name: Web
127
+ runs-on: ubuntu-latest
128
+
129
+ steps:
130
+ - name: Checkout code
131
+ uses: actions/checkout@v4
132
+
133
+ - name: Install Rust toolchain
134
+ uses: dtolnay/rust-toolchain@stable
135
+ with:
136
+ targets: wasm32-unknown-unknown
137
+
138
+ - name: Cache Rust dependencies
139
+ uses: Swatinem/rust-cache@v2
140
+ with:
141
+ workspaces: wasm
142
+
143
+ - name: Install Node
144
+ uses: actions/setup-node@v4
145
+ with:
146
+ # Vite 7 wants 20.19+ or 22.12+; 22 resolves to the latest 22.x.
147
+ node-version: 22
148
+ cache: npm
149
+ cache-dependency-path: web/package-lock.json
150
+
151
+ # PINNED, not `latest`. This action resolves `latest` by asking the
152
+ # GitHub API, and when that call fails it does not fail the step — it
153
+ # silently falls back to its own default, wasm-pack v0.9.1, whose
154
+ # wasm-opt is too old to parse what wasm-bindgen emits. The build then
155
+ # dies with "Only 1 table definition allowed in MVP", which names
156
+ # nothing relevant. pdf-handouts hit exactly that on 2026-09-01.
157
+ - name: Install wasm-pack
158
+ uses: jetli/wasm-pack-action@v0.4.0
159
+ with:
160
+ version: 'v0.15.0'
161
+
162
+ - name: Install dependencies
163
+ working-directory: web
164
+ run: npm ci
165
+
166
+ - name: Build the WebAssembly bundle
167
+ working-directory: web
168
+ run: npm run wasm
169
+
170
+ - name: Run tests
171
+ working-directory: web
172
+ run: npm test
173
+
174
+ - name: Build the site
175
+ working-directory: web
176
+ run: npm run build
177
+
178
+ # dealer3 builds this crate, for its threaded wasm, with a nightly pinned to
179
+ # 2025-06-01: newer LLVM breaks wasm-bindgen's threading there. Anything this
180
+ # crate uses that is newer than that compiler breaks dealer3's site build, as
181
+ # `u64::isolate_lowest_one` (clippy's suggestion) did on 2026-10-27. Move
182
+ # this pin when dealer3 moves its: THREADED_TOOLCHAIN in dealer3's wasm/build.sh.
183
+ old-toolchain:
184
+ name: dealer3's pinned nightly
185
+ runs-on: ubuntu-latest
186
+
187
+ steps:
188
+ - name: Checkout code
189
+ uses: actions/checkout@v4
190
+
191
+ - name: Install the pinned nightly
192
+ uses: dtolnay/rust-toolchain@master
193
+ with:
194
+ toolchain: nightly-2025-06-01
195
+
196
+ - name: Check the library compiles
197
+ run: |
198
+ cargo check --lib
199
+ cargo check --lib --features play-analysis,json
200
+
201
+ # The C library: libbridgesolver and include/bridge_solver.h.
202
+ ffi:
203
+ name: C library (${{ matrix.os }})
204
+ runs-on: ${{ matrix.os }}
205
+ strategy:
206
+ fail-fast: false
207
+ matrix:
208
+ os: [ubuntu-latest, windows-latest, macos-latest]
209
+
210
+ steps:
211
+ - name: Checkout code
212
+ uses: actions/checkout@v4
213
+
214
+ - name: Install Rust toolchain
215
+ uses: dtolnay/rust-toolchain@stable
216
+ with:
217
+ components: rustfmt, clippy
218
+
219
+ - name: Cache Rust dependencies
220
+ uses: Swatinem/rust-cache@v2
221
+ with:
222
+ workspaces: ffi
223
+
224
+ - name: Check formatting and lint
225
+ working-directory: ffi
226
+ shell: bash
227
+ run: |
228
+ cargo fmt --all -- --check
229
+ cargo clippy --all-targets -- -D warnings
230
+
231
+ - name: Run tests
232
+ working-directory: ffi
233
+ run: cargo test
234
+
235
+ - name: Build the libraries
236
+ working-directory: ffi
237
+ run: cargo build --release
238
+
239
+ # The header is hand-written, so compiling C against it and the built
240
+ # library is what proves the two agree.
241
+ - name: Build and run the C example
242
+ if: matrix.os != 'windows-latest'
243
+ shell: bash
244
+ run: |
245
+ cc -Wall -Wextra -Werror -o example ffi/examples/example.c \
246
+ -Iffi/include -Lffi/target/release -lbridgesolver
247
+ LD_LIBRARY_PATH=ffi/target/release DYLD_LIBRARY_PATH=ffi/target/release ./example
248
+
249
+ # The static library, linked with exactly the flags ffi/README.md gives.
250
+ - name: Link the C example statically
251
+ if: matrix.os == 'ubuntu-latest'
252
+ run: |
253
+ cc -o example-static ffi/examples/example.c -Iffi/include \
254
+ ffi/target/release/libbridgesolver.a -lgcc_s -lutil -lrt -lpthread -lm -ldl -lc
255
+ ./example-static
256
+
257
+ # The Python package (python/), built as a wheel and installed the way a
258
+ # user would, then tested. 3.9 is the oldest the abi3 wheel supports.
259
+ python:
260
+ name: Python ${{ matrix.python }} (${{ matrix.os }})
261
+ runs-on: ${{ matrix.os }}
262
+ strategy:
263
+ fail-fast: false
264
+ matrix:
265
+ os: [ubuntu-latest, windows-latest, macos-latest]
266
+ python: ["3.9", "3.13"]
267
+
268
+ steps:
269
+ - name: Checkout code
270
+ uses: actions/checkout@v4
271
+
272
+ - name: Install Rust toolchain
273
+ uses: dtolnay/rust-toolchain@stable
274
+ with:
275
+ components: rustfmt, clippy
276
+
277
+ - name: Cache Rust dependencies
278
+ uses: Swatinem/rust-cache@v2
279
+ with:
280
+ workspaces: python
281
+
282
+ - uses: actions/setup-python@v5
283
+ with:
284
+ python-version: ${{ matrix.python }}
285
+
286
+ - name: Check formatting and lint
287
+ working-directory: python
288
+ shell: bash
289
+ run: |
290
+ cargo fmt --all -- --check
291
+ cargo clippy --all-targets -- -D warnings
292
+
293
+ - name: Build the wheel and install it
294
+ shell: bash
295
+ run: |
296
+ python -m pip install --upgrade pip maturin pytest
297
+ maturin build --release --manifest-path python/Cargo.toml --out dist
298
+ python -m pip install --no-index --find-links dist bridge-solver
299
+
300
+ # From outside the source tree, so the tests import the installed wheel
301
+ # rather than the source directory.
302
+ - name: Run the tests and the docstring examples
303
+ shell: bash
304
+ run: |
305
+ cd "$RUNNER_TEMP"
306
+ python -m pytest -q "$GITHUB_WORKSPACE/python/tests"
307
+ python -m pytest -q --doctest-modules --pyargs bridge_solver
308
+
309
+ build-summary:
310
+ name: Build Summary
311
+ runs-on: ubuntu-latest
312
+ needs: [test, lint, wasm, web, ffi, python, old-toolchain]
313
+
314
+ steps:
315
+ - name: Summary
316
+ run: |
317
+ echo "All tests passed"
318
+ echo "All platforms (Linux, Windows, macOS) built successfully"
319
+ echo "WebAssembly target built and its tests passed"
320
+ echo "The Pages site built and its tests passed"
321
+ echo "The C library built, and the C example ran against it"
322
+ echo "The Python package built, installed and passed its tests"
323
+ echo "Code formatting and linting passed"
@@ -0,0 +1,128 @@
1
+ name: Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - 'src/**'
8
+ - 'wasm/**'
9
+ - 'web/**'
10
+ - 'Cargo.toml'
11
+ - 'Cargo.lock'
12
+ - '.github/workflows/pages.yml'
13
+ # The Cloudflare half of the deploy: a change to the ingest Function or to
14
+ # the bindings has to redeploy too, and without these it silently would
15
+ # not — the site would keep serving while the Function went stale.
16
+ - 'functions/**'
17
+ - 'wrangler.jsonc'
18
+ # Lets the site be redeployed without a code change.
19
+ workflow_dispatch:
20
+
21
+ permissions:
22
+ contents: read
23
+ pages: write
24
+ id-token: write
25
+
26
+ # Latest wins: a superseded deploy has nothing worth finishing.
27
+ concurrency:
28
+ group: pages
29
+ cancel-in-progress: true
30
+
31
+ env:
32
+ CARGO_TERM_COLOR: always
33
+ # Read here rather than inside the step so the step's `if` can test them: a
34
+ # fork, or this repo before the secrets are set, should still build and deploy
35
+ # to GitHub Pages rather than failing on a credential it was never given.
36
+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
37
+ CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
38
+
39
+ jobs:
40
+ build:
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+
45
+ - uses: dtolnay/rust-toolchain@stable
46
+ with:
47
+ targets: wasm32-unknown-unknown
48
+ - uses: Swatinem/rust-cache@v2
49
+ with:
50
+ workspaces: wasm
51
+
52
+ - uses: actions/setup-node@v4
53
+ with:
54
+ # Vite 7 wants 20.19+ or 22.12+; 22 resolves to the latest 22.x.
55
+ node-version: 22
56
+ cache: npm
57
+ cache-dependency-path: web/package-lock.json
58
+
59
+ # PINNED, not `latest`. This action resolves `latest` by asking the
60
+ # GitHub API, and when that call fails it does not fail the step — it
61
+ # silently falls back to its own default, wasm-pack v0.9.1, whose
62
+ # wasm-opt is too old to parse what wasm-bindgen emits. The build then
63
+ # dies with "Only 1 table definition allowed in MVP", which names
64
+ # nothing relevant. pdf-handouts hit exactly that on 2026-09-01.
65
+ - name: Install wasm-pack
66
+ uses: jetli/wasm-pack-action@v0.4.0
67
+ with:
68
+ version: 'v0.15.0'
69
+
70
+ - name: Install dependencies
71
+ working-directory: web
72
+ run: npm ci
73
+
74
+ # Before the site build: Vite bundles the generated module as an asset, so
75
+ # it has to exist on disk first.
76
+ - name: Build the WebAssembly bundle
77
+ working-directory: web
78
+ run: npm run wasm
79
+
80
+ - name: Run the site tests
81
+ working-directory: web
82
+ run: npm test
83
+
84
+ - name: Build the site
85
+ working-directory: web
86
+ run: npm run build
87
+
88
+ # A missing wasm asset produces a page that loads and then quietly fails to
89
+ # analyse anything, so fail here instead.
90
+ - name: Check the bundle landed
91
+ working-directory: web
92
+ run: |
93
+ test -f dist/index.html
94
+ # The gallery is a second entry point; a rollupOptions mistake would drop
95
+ # it silently rather than fail the build.
96
+ test -f dist/gallery.html
97
+ ls dist/assets/*.wasm
98
+ ls dist/assets/*.js
99
+ du -sh dist
100
+
101
+ # Cloudflare, from the same build that GitHub Pages is about to get, so the
102
+ # two hosts cannot drift. Only Cloudflare has the `/t` ingest Function and
103
+ # the KV and Analytics Engine bindings; GitHub Pages serves the same static
104
+ # site with the beacon inert against it.
105
+ #
106
+ # Skipped when the token is absent so a fork still builds. `--commit-dirty`
107
+ # because the checkout carries the generated wasm module, which wrangler
108
+ # would otherwise refuse to deploy from as an unclean tree.
109
+ - name: Deploy to Cloudflare Pages
110
+ if: env.CLOUDFLARE_API_TOKEN != ''
111
+ run: npx --yes wrangler@4 pages deploy --commit-dirty=true
112
+
113
+ - uses: actions/configure-pages@v5
114
+ - uses: actions/upload-pages-artifact@v3
115
+ with:
116
+ path: web/dist
117
+
118
+ deploy:
119
+ needs: build
120
+ runs-on: ubuntu-latest
121
+ environment:
122
+ name: github-pages
123
+ url: ${{ steps.deployment.outputs.page_url }}
124
+ steps:
125
+ # `deploy-pages` caps its own timeout at the 600000 ms default; a larger
126
+ # `with: timeout` is silently clamped rather than honoured.
127
+ - id: deployment
128
+ uses: actions/deploy-pages@v4