@@ -141,8 +141,13 @@ jobs:
141141 run : |
142142 npm ci
143143 npm run build
144- - uses : PyO3/maturin-action@v1
144+ # maturin-action downloads maturin from GitHub releases, which can fail on its own. Each
145+ # build retries once; macOS and Windows then fall back to the same maturin from PyPI. Linux
146+ # builds need the action's manylinux container, so they have no fallback.
147+ - id : extension
148+ uses : PyO3/maturin-action@v1
145149 if : inputs.prebuilt-run-id == ''
150+ continue-on-error : true
146151 with :
147152 command : build
148153 # One platform records a cargo build timing report for build time work.
@@ -151,8 +156,33 @@ jobs:
151156 ${{ matrix.platform.name == 'linux-x86_64' && '--timings' || '' }}
152157 target : ${{ matrix.platform.target }}
153158 manylinux : auto
154- - uses : PyO3/maturin-action@v1
159+ - id : extension-retry
160+ name : Retry the extension build
161+ uses : PyO3/maturin-action@v1
162+ if : inputs.prebuilt-run-id == '' && steps.extension.outcome == 'failure'
163+ continue-on-error : ${{ runner.os != 'Linux' }}
164+ with :
165+ command : build
166+ # One platform records a cargo build timing report for build time work.
167+ args : >-
168+ --profile ${{ inputs.cargo-profile }} --out dist --features extension-module
169+ ${{ matrix.platform.name == 'linux-x86_64' && '--timings' || '' }}
170+ target : ${{ matrix.platform.target }}
171+ manylinux : auto
172+ - name : Build the extension with maturin from PyPI
173+ if : >-
174+ inputs.prebuilt-run-id == '' && runner.os != 'Linux'
175+ && steps.extension.outcome == 'failure' && steps.extension-retry.outcome == 'failure'
176+ shell : bash
177+ env :
178+ MATURIN_ARGS : >-
179+ --profile ${{ inputs.cargo-profile }} --out dist --features extension-module
180+ TARGET : ${{ matrix.platform.target }}
181+ run : scripts/maturin_from_pypi.sh build ${MATURIN_ARGS}
182+ - id : cli
183+ uses : PyO3/maturin-action@v1
155184 if : inputs.prebuilt-run-id == ''
185+ continue-on-error : true
156186 # On macOS maturin links the extension with these flags for every crate, which changes
157187 # their build hash. Passing the same flags here lets sqb reuse the crates the extension
158188 # build just compiled instead of compiling them again; sqb has no undefined symbols, and
@@ -169,6 +199,37 @@ jobs:
169199 ${{ matrix.platform.name == 'linux-x86_64' && '--timings' || '' }}
170200 target : ${{ matrix.platform.target }}
171201 manylinux : auto
202+ - id : cli-retry
203+ name : Retry the sqb build
204+ uses : PyO3/maturin-action@v1
205+ if : inputs.prebuilt-run-id == '' && steps.cli.outcome == 'failure'
206+ continue-on-error : ${{ runner.os != 'Linux' }}
207+ env :
208+ RUSTFLAGS : >-
209+ ${{ runner.os == 'macOS' && '-C link-arg=-undefined -C link-arg=dynamic_lookup' || '' }}
210+ # A wheel must never ship a sqb server without its UI.
211+ SQLBUILD_UI_REQUIRED : " 1"
212+ with :
213+ command : build
214+ args : >-
215+ --profile ${{ inputs.cargo-profile }} --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml --features ui
216+ ${{ matrix.platform.name == 'linux-x86_64' && '--timings' || '' }}
217+ target : ${{ matrix.platform.target }}
218+ manylinux : auto
219+ - name : Build sqb with maturin from PyPI
220+ if : >-
221+ inputs.prebuilt-run-id == '' && runner.os != 'Linux'
222+ && steps.cli.outcome == 'failure' && steps.cli-retry.outcome == 'failure'
223+ shell : bash
224+ env :
225+ RUSTFLAGS : >-
226+ ${{ runner.os == 'macOS' && '-C link-arg=-undefined -C link-arg=dynamic_lookup' || '' }}
227+ # A wheel must never ship a sqb server without its UI.
228+ SQLBUILD_UI_REQUIRED : " 1"
229+ MATURIN_ARGS : >-
230+ --profile ${{ inputs.cargo-profile }} --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml --features ui
231+ TARGET : ${{ matrix.platform.target }}
232+ run : scripts/maturin_from_pypi.sh build ${MATURIN_ARGS}
172233 - name : Upload the cargo build timing reports
173234 if : inputs.prebuilt-run-id == '' && matrix.platform.name == 'linux-x86_64'
174235 uses : actions/upload-artifact@v4
@@ -286,16 +347,46 @@ jobs:
286347 if : inputs.prebuilt-run-id == ''
287348 with :
288349 toolchain : stable
289- - uses : PyO3/maturin-action@v1
350+ - id : sdist
351+ uses : PyO3/maturin-action@v1
290352 if : inputs.prebuilt-run-id == ''
353+ continue-on-error : true
291354 with :
292355 command : sdist
293356 args : --out dist
294- - uses : PyO3/maturin-action@v1
357+ - id : sdist-retry
358+ name : Retry the source distribution
359+ uses : PyO3/maturin-action@v1
360+ if : inputs.prebuilt-run-id == '' && steps.sdist.outcome == 'failure'
361+ continue-on-error : true
362+ with :
363+ command : sdist
364+ args : --out dist
365+ - name : Build the source distribution with maturin from PyPI
366+ if : >-
367+ inputs.prebuilt-run-id == '' && steps.sdist.outcome == 'failure'
368+ && steps.sdist-retry.outcome == 'failure'
369+ run : scripts/maturin_from_pypi.sh sdist --out dist
370+ - id : sdist-cli
371+ uses : PyO3/maturin-action@v1
295372 if : inputs.prebuilt-run-id == ''
373+ continue-on-error : true
374+ with :
375+ command : sdist
376+ args : --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml
377+ - id : sdist-cli-retry
378+ name : Retry the sqb source distribution
379+ uses : PyO3/maturin-action@v1
380+ if : inputs.prebuilt-run-id == '' && steps.sdist-cli.outcome == 'failure'
381+ continue-on-error : true
296382 with :
297383 command : sdist
298384 args : --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml
385+ - name : Build the sqb source distribution with maturin from PyPI
386+ if : >-
387+ inputs.prebuilt-run-id == '' && steps.sdist-cli.outcome == 'failure'
388+ && steps.sdist-cli-retry.outcome == 'failure'
389+ run : scripts/maturin_from_pypi.sh sdist --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml
299390 - name : Download prebuilt source distributions
300391 if : inputs.prebuilt-run-id != ''
301392 uses : actions/download-artifact@v4
0 commit comments