Skip to content

Commit

Permalink
Split release profile into release and release-opt
Browse files Browse the repository at this point in the history
In `Cargo.toml`:

- Add thin LTO to `release` profile.

- Create `release-opt` profile with fat LTO and other slow
  optimizations, as well as stripping all symbols.

- Remove some old commented out configuration that has been
  superseded by more granular configuration (separate from the
  above changes)

In the `release.yml` CI workflow:

- Build `release-opt` rather than `release` workflow.

- Remove explicit stripping of debug symbols, since `release-opt`
  does that.

- Tweak style of how arguments are built to make it more
  consistent across script steps, to avoid deepening a minor
  stylistic inconsistency.

- *Temporarily* disable the step that takes the release from draft
  to published, to avoid publishing more "DO-NOT-USE" releases than
  necessary when testing the workflow (since, for example, it is
  possible for them to appear in users' "Home" feeds on GitHub).
  This change must be undone, so the workflow will really publish.
  • Loading branch information
EliahKagan committed Aug 6, 2024
1 parent 2e00b5e commit ff1ddc2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
21 changes: 4 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,9 @@ jobs:
echo "target flag is: $TARGET_FLAGS"
echo "target dir is: $TARGET_DIR"
- name: Build release binary
- name: Build release binary (with extra optimizations)
run: |
"$CARGO" build --verbose --release "$TARGET_FLAGS" --no-default-features --features "$FEATURE"
- name: Strip release binary (x86-64 Linux, and all macOS)
if: matrix.target == 'x86_64-unknown-linux-musl' || matrix.os == 'macos-latest'
run: strip "$TARGET_DIR"/release/{ein,gix}

- name: Strip release binary (ARM Linux)
if: matrix.target == 'arm-unknown-linux-gnueabihf'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:arm-unknown-linux-gnueabihf \
arm-linux-gnueabihf-strip \
/target/arm-unknown-linux-gnueabihf/release/ein \
/target/arm-unknown-linux-gnueabihf/release/gix
"$CARGO" build --verbose --profile=release-opt "$TARGET_FLAGS" --no-default-features --features="$FEATURE"
- name: Determine archive basename
run: echo "ARCHIVE=gitoxide-$FEATURE-$VERSION-$TARGET" >> "$GITHUB_ENV"
Expand Down Expand Up @@ -346,7 +332,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish the release
- name: Publish the release # FIXME: Reenable this.
if: false
run: gh release --repo="$REPOSITORY" edit "$VERSION" --draft=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,18 @@ sha1_smol = { opt-level = 3 }

[profile.release]
overflow-checks = false
#lto = "fat"
# this bloats files but assures destructors are called, important for tempfiles. One day I hope we
lto = "thin"
# This bloats files but assures destructors are called, important for tempfiles. One day I hope we
# can wire up the 'abrt' signal handler so tempfiles will be removed in case of panics.
panic = 'unwind'
#codegen-units = 1
panic = "unwind"
incremental = false
build-override = { opt-level = 0 }

# It's not quite worth building dependencies with more optimizations yet. Let's keep it here for later.
#[profile.dev.package."*"]
#opt-level = 2
[profile.release-opt]
inherits = "release"
lto = "fat"
codegen-units = 1
strip = "symbols"

[workspace]
members = [
Expand Down

0 comments on commit ff1ddc2

Please sign in to comment.