From 817e826ee27bf77cf1ab559d4da24fb686c92c10 Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Fri, 7 Aug 2026 20:31:25 +0100 Subject: [PATCH] ci(release): build release candidates with the release profile The RC was built as a debug build to keep logging enabled, back when we were stripping logging from production builds. That reasoning no longer holds: - `logging` is in the crate's default feature set, so the production flags `--release --no-default-features --features logging` resolved to exactly the default feature set. Nothing was being stripped. - Logging is gated at runtime by `--enable-logging` / ANT_ENABLE_LOGGING, not by the build profile at all. So the debug build bought nothing, while giving the RC a different optimisation level and different runtime characteristics from the artifact it is a candidate for. Soak-testing it produced weak evidence about what actually ships, which matters more if the RC goes out on a beta channel on production (V2-843). Drop the profile conditional and build every target with `--release`. `is_prerelease` still gates the crates.io publish and the GitHub pre-release flag; archive asset names are unchanged. Also correct the `logging` feature comment, which documented a stripping behaviour the release workflow did not implement. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/release.yml | 29 +++++++++-------------------- Cargo.toml | 6 +++--- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b49063a5..ce8c27de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,20 +116,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Determine build profile - id: profile - shell: bash - run: | - if [[ "${{ needs.validate.outputs.is_prerelease }}" == "true" ]]; then - echo "build_flags=" >> $GITHUB_OUTPUT - echo "profile_dir=debug" >> $GITHUB_OUTPUT - echo "Building DEBUG (RC pre-release: logging enabled)" - else - echo "build_flags=--release --no-default-features --features logging" >> $GITHUB_OUTPUT - echo "profile_dir=release" >> $GITHUB_OUTPUT - echo "Building RELEASE (logging enabled, other defaults stripped)" - fi - - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: @@ -143,19 +129,22 @@ jobs: if: matrix.cross run: cargo install cross --git https://github.com/cross-rs/cross + # Pre-releases are built exactly like the release they are a candidate for. + # Logging is in the default feature set, so `--release` carries it; there is + # no reason for an RC to differ from the artifact that ships. - name: Build (cross) if: matrix.cross - run: cross build ${{ steps.profile.outputs.build_flags }} --target ${{ matrix.target }} + run: cross build --release --target ${{ matrix.target }} - name: Build (native) if: ${{ !matrix.cross }} - run: cargo build ${{ steps.profile.outputs.build_flags }} --target ${{ matrix.target }} + run: cargo build --release --target ${{ matrix.target }} - name: Create archive (Unix) if: matrix.archive == 'tar.gz' run: | - cp config/bootstrap_peers.toml target/${{ matrix.target }}/${{ steps.profile.outputs.profile_dir }}/ - cd target/${{ matrix.target }}/${{ steps.profile.outputs.profile_dir }} + cp config/bootstrap_peers.toml target/${{ matrix.target }}/release/ + cd target/${{ matrix.target }}/release tar -czvf ../../../ant-node-cli-${{ matrix.friendly_name }}.tar.gz ${{ matrix.binary }} bootstrap_peers.toml cd ../../.. @@ -163,8 +152,8 @@ jobs: if: matrix.archive == 'zip' shell: pwsh run: | - Copy-Item "config/bootstrap_peers.toml" "target/${{ matrix.target }}/${{ steps.profile.outputs.profile_dir }}/bootstrap_peers.toml" - Push-Location "target/${{ matrix.target }}/${{ steps.profile.outputs.profile_dir }}" + Copy-Item "config/bootstrap_peers.toml" "target/${{ matrix.target }}/release/bootstrap_peers.toml" + Push-Location "target/${{ matrix.target }}/release" Compress-Archive -Path "${{ matrix.binary }}", "bootstrap_peers.toml" -DestinationPath "../../../ant-node-cli-${{ matrix.friendly_name }}.zip" Pop-Location diff --git a/Cargo.toml b/Cargo.toml index 5c98105f..7cc75571 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -177,9 +177,9 @@ required-features = ["test-utils"] [features] default = ["logging"] # Enable tracing/logging infrastructure. -# Included in `default` so dev builds (`cargo build`, `cargo test`) get logging -# automatically. Release builds strip it: -# cargo build --release --no-default-features +# Included in `default`, so every build we ship — dev, release candidate and +# release alike — has logging. Opt out only for a bespoke build that needs it +# gone: `cargo build --release --no-default-features`. logging = ["tracing", "tracing-subscriber", "tracing-appender"] # Expose test helpers (cache_insert, payment_verifier accessor) for # integration tests and downstream test harnesses.