Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split release profile into release and release-opt #1495

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 7 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ jobs:
TARGET: ${{ matrix.target }}
TARGET_FLAGS: --target=${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}
PROFILE: release-opt

steps:
- name: Checkout repository
Expand Down Expand Up @@ -171,23 +172,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="$PROFILE" "$TARGET_FLAGS" --no-default-features --features="$FEATURE"

- name: Determine archive basename
run: echo "ARCHIVE=gitoxide-$FEATURE-$VERSION-$TARGET" >> "$GITHUB_ENV"
Expand All @@ -200,8 +187,8 @@ jobs:
- name: Build archive (Windows)
if: matrix.os == 'windows-latest'
run: |
file -- "$TARGET_DIR"/release/{ein,gix}.exe
cp -- "$TARGET_DIR"/release/{ein,gix}.exe "$ARCHIVE/"
file -- "$TARGET_DIR/$PROFILE"/{ein,gix}.exe
cp -- "$TARGET_DIR/$PROFILE"/{ein,gix}.exe "$ARCHIVE/"
7z a "$ARCHIVE.zip" "$ARCHIVE"
/usr/bin/core_perl/shasum --algorithm=256 --binary "$ARCHIVE.zip" > "$ARCHIVE.zip.sha256"
echo "ASSET=$ARCHIVE.zip" >> "$GITHUB_ENV"
Expand All @@ -210,8 +197,8 @@ jobs:
- name: Build archive (Unix)
if: matrix.os != 'windows-latest'
run: |
file -- "$TARGET_DIR"/release/{ein,gix}
cp -- "$TARGET_DIR"/release/{ein,gix} "$ARCHIVE/"
file -- "$TARGET_DIR/$PROFILE"/{ein,gix}
cp -- "$TARGET_DIR/$PROFILE"/{ein,gix} "$ARCHIVE/"
tar czf "$ARCHIVE.tar.gz" "$ARCHIVE"
shasum --algorithm=256 --binary "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256"
echo "ASSET=$ARCHIVE.tar.gz" >> "$GITHUB_ENV"
Expand Down
17 changes: 10 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,20 @@ 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"
EliahKagan marked this conversation as resolved.
Show resolved Hide resolved
# 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 }
EliahKagan marked this conversation as resolved.
Show resolved Hide resolved

# It's not quite worth building dependencies with more optimizations yet. Let's keep it here for later.
#[profile.dev.package."*"]
#opt-level = 2
# This profile is currently used in building releases for GitHub.
# It may be removed at any time and should not otherwise be relied on.
[profile.release-opt]
inherits = "release"
lto = "fat"
codegen-units = 1
strip = "symbols"

[workspace]
members = [
Expand Down
Loading