diff --git a/.github/workflows/build-distributions.yml b/.github/workflows/build-distributions.yml index 12a3661da..99770a02e 100644 --- a/.github/workflows/build-distributions.yml +++ b/.github/workflows/build-distributions.yml @@ -34,6 +34,11 @@ on: required: false type: number default: 0 + cargo-profile: + description: "Cargo profile of the native builds: dist for released wheels, release for quicker checks" + required: false + type: string + default: dist outputs: sha: description: "Commit the distributions were built from" @@ -88,7 +93,8 @@ jobs: name: Build wheel (${{ matrix.platform.name }}) needs: source runs-on: ${{ matrix.platform.runner }} - timeout-minutes: 75 + # Cold dist builds take up to about 2x the 17-31 minute release-profile jobs on Windows and macOS. + timeout-minutes: 120 strategy: fail-fast: false matrix: @@ -141,7 +147,7 @@ jobs: command: build # One platform records a cargo build timing report for build time work. args: >- - --release --out dist --features extension-module + --profile ${{ inputs.cargo-profile }} --out dist --features extension-module ${{ matrix.platform.name == 'linux-x86_64' && '--timings' || '' }} target: ${{ matrix.platform.target }} manylinux: auto @@ -159,7 +165,7 @@ jobs: with: command: build args: >- - --release --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml --features ui + --profile ${{ inputs.cargo-profile }} --out dist --manifest-path crates/sqlbuild-cli/Cargo.toml --features ui ${{ matrix.platform.name == 'linux-x86_64' && '--timings' || '' }} target: ${{ matrix.platform.target }} manylinux: auto diff --git a/.github/workflows/release-performance.yml b/.github/workflows/release-performance.yml index c9ddef80e..00d27f1f1 100644 --- a/.github/workflows/release-performance.yml +++ b/.github/workflows/release-performance.yml @@ -66,7 +66,10 @@ jobs: run: uv python install 3.12 - name: Install dependencies run: uv sync --locked --all-groups --all-extras + # The candidate uses the released wheels' cargo profile, so both sides of the comparison match. - name: Build candidate wheel + env: + MATURIN_PEP517_ARGS: --profile dist run: | uv build --wheel --out-dir "${RUNNER_TEMP}/candidate" uv build --wheel crates/sqlbuild-cli --out-dir "${RUNNER_TEMP}/candidate" diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 5661db767..114ea51c4 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -1099,6 +1099,8 @@ jobs: sdist: false upload: true retention-days: 3 + # Release Distributions builds and smoke tests the slower dist profile for every release. + cargo-profile: release compose: name: Packaged Compose lifecycle diff --git a/Cargo.toml b/Cargo.toml index bb3bb388e..9ef850601 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -203,8 +203,14 @@ debug = false [profile.release] strip = "symbols" +# Released wheels: one codegen unit per crate keeps one copy of generic code that parallel units +# each instantiate, so the native binaries are about an eighth smaller and build in about 2x time. +[profile.dist] +inherits = "release" +codegen-units = 1 + # Local iteration: release-level optimisation with incremental builds, so rebuilding after a -# focused change does not recompile the whole binding crate. CI and wheels use `release`. +# focused change does not recompile the whole binding crate. CI uses `release`. [profile.fast] inherits = "release" incremental = true