Skip to content

Commit 96d3470

Browse files
authored
Merge pull request #1495 from EliahKagan/profiles
Split `release` profile into `release` and `release-opt`
2 parents 29898e3 + 34b1060 commit 96d3470

File tree

2 files changed

+20
-28
lines changed

2 files changed

+20
-28
lines changed

.github/workflows/release.yml

+7-20
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ jobs:
139139
TARGET: ${{ matrix.target }}
140140
TARGET_FLAGS: --target=${{ matrix.target }}
141141
TARGET_DIR: target/${{ matrix.target }}
142+
PROFILE: release-github
142143

143144
steps:
144145
- name: Checkout repository
@@ -171,23 +172,9 @@ jobs:
171172
echo "target flag is: $TARGET_FLAGS"
172173
echo "target dir is: $TARGET_DIR"
173174
174-
- name: Build release binary
175+
- name: Build release binary (with extra optimizations)
175176
run: |
176-
"$CARGO" build --verbose --release "$TARGET_FLAGS" --no-default-features --features "$FEATURE"
177-
178-
- name: Strip release binary (x86-64 Linux, and all macOS)
179-
if: matrix.target == 'x86_64-unknown-linux-musl' || matrix.os == 'macos-latest'
180-
run: strip "$TARGET_DIR"/release/{ein,gix}
181-
182-
- name: Strip release binary (ARM Linux)
183-
if: matrix.target == 'arm-unknown-linux-gnueabihf'
184-
run: |
185-
docker run --rm -v \
186-
"$PWD/target:/target:Z" \
187-
rustembedded/cross:arm-unknown-linux-gnueabihf \
188-
arm-linux-gnueabihf-strip \
189-
/target/arm-unknown-linux-gnueabihf/release/ein \
190-
/target/arm-unknown-linux-gnueabihf/release/gix
177+
"$CARGO" build --verbose --profile="$PROFILE" "$TARGET_FLAGS" --no-default-features --features="$FEATURE"
191178
192179
- name: Determine archive basename
193180
run: echo "ARCHIVE=gitoxide-$FEATURE-$VERSION-$TARGET" >> "$GITHUB_ENV"
@@ -200,8 +187,8 @@ jobs:
200187
- name: Build archive (Windows)
201188
if: matrix.os == 'windows-latest'
202189
run: |
203-
file -- "$TARGET_DIR"/release/{ein,gix}.exe
204-
cp -- "$TARGET_DIR"/release/{ein,gix}.exe "$ARCHIVE/"
190+
file -- "$TARGET_DIR/$PROFILE"/{ein,gix}.exe
191+
cp -- "$TARGET_DIR/$PROFILE"/{ein,gix}.exe "$ARCHIVE/"
205192
7z a "$ARCHIVE.zip" "$ARCHIVE"
206193
/usr/bin/core_perl/shasum --algorithm=256 --binary "$ARCHIVE.zip" > "$ARCHIVE.zip.sha256"
207194
echo "ASSET=$ARCHIVE.zip" >> "$GITHUB_ENV"
@@ -210,8 +197,8 @@ jobs:
210197
- name: Build archive (Unix)
211198
if: matrix.os != 'windows-latest'
212199
run: |
213-
file -- "$TARGET_DIR"/release/{ein,gix}
214-
cp -- "$TARGET_DIR"/release/{ein,gix} "$ARCHIVE/"
200+
file -- "$TARGET_DIR/$PROFILE"/{ein,gix}
201+
cp -- "$TARGET_DIR/$PROFILE"/{ein,gix} "$ARCHIVE/"
215202
tar czf "$ARCHIVE.tar.gz" "$ARCHIVE"
216203
shasum --algorithm=256 --binary "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256"
217204
echo "ASSET=$ARCHIVE.tar.gz" >> "$GITHUB_ENV"

Cargo.toml

+13-8
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,22 @@ sha1_smol = { opt-level = 3 }
206206

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

217-
# It's not quite worth building dependencies with more optimizations yet. Let's keep it here for later.
218-
#[profile.dev.package."*"]
219-
#opt-level = 2
215+
# This profile is currently used in building releases for GitHub.
216+
# It may be removed at any time and should not otherwise be relied on.
217+
[profile.release-github]
218+
inherits = "release"
219+
overflow-checks = false
220+
panic = "unwind"
221+
lto = "fat"
222+
codegen-units = 1
223+
strip = "symbols"
224+
build-override = { opt-level = 3 }
220225

221226
[workspace]
222227
members = [

0 commit comments

Comments
 (0)