Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
47 changes: 39 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,42 @@ jobs:
archive: tar.gz
rustflags: ""
linux: true
pkg_config_libdir: ""
multilib: false
- runner: windows-latest
target: x86_64-pc-windows-msvc
archive: zip
rustflags: ""
linux: false
pkg_config_libdir: ""
multilib: false
- runner: ubuntu-latest
target: i686-unknown-linux-gnu
archive: tar.gz
rustflags: ""
linux: true
pkg_config_libdir: "/usr/lib/i386-linux-gnu/pkgconfig"
multilib: true
- runner: windows-latest
target: i686-pc-windows-msvc
archive: zip
rustflags: ""
linux: false
pkg_config_libdir: ""
multilib: false
runs-on: ${{ matrix.runner }}
env:
TARGET: ${{ matrix.target }}
RUSTFLAGS: ${{ matrix.rustflags }}
PKG_CONFIG_LIBDIR: ${{ matrix.pkg_config_libdir }}
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set safe ref name
shell: bash
run: echo "SAFE_REF=${GITHUB_REF_NAME//\//-}" >> "$GITHUB_ENV"

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a
with:
Expand All @@ -90,6 +113,17 @@ jobs:
libgl1-mesa-dev libasound2-dev libudev-dev \
libwayland-dev libxkbcommon-dev

- name: Install 32-bit Linux deps
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y \
gcc-multilib g++-multilib pkg-config \
libx11-dev:i386 libxcursor-dev:i386 libxrandr-dev:i386 libxi-dev:i386 \
libgl1-mesa-dev:i386 libasound2-dev:i386 libudev-dev:i386 \
libwayland-dev:i386 libxkbcommon-dev:i386

- name: Cache cargo
uses: actions/cache@v4
with:
Expand All @@ -104,10 +138,6 @@ jobs:
- name: Build release
run: cargo build --release --target ${{ matrix.target }}

- name: Strip binary (Linux)
if: matrix.linux
run: strip --strip-unneeded target/$TARGET/release/elnpack

- name: Package artifact (Linux)
if: matrix.archive == 'tar.gz'
run: |
Expand All @@ -116,7 +146,7 @@ jobs:
mkdir -p "$pkg_dir"
cp "$bin_path" "$pkg_dir/"
cp README.md LICENSE "$pkg_dir/"
tar -czf elnpack-${{ github.ref_name }}-$TARGET.tar.gz -C "$pkg_dir" .
tar -czf "elnpack-$SAFE_REF-$TARGET.tar.gz" -C "$pkg_dir" .

- name: Package artifact (Windows)
if: matrix.archive == 'zip'
Expand All @@ -127,14 +157,15 @@ jobs:
New-Item -ItemType Directory -Force -Path $pkgDir | Out-Null
Copy-Item $binPath "$pkgDir/"
Copy-Item "README.md","LICENSE" "$pkgDir/"
Compress-Archive -Path "$pkgDir/*" -DestinationPath "elnpack-${{ github.ref_name }}-${env:TARGET}.zip"
$safeRef = $env:SAFE_REF
Compress-Archive -Path "$pkgDir/*" -DestinationPath "elnpack-$safeRef-${env:TARGET}.zip"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: elnpack-${{ github.ref_name }}-${{ matrix.target }}
name: elnpack-${{ env.SAFE_REF }}-${{ matrix.target }}
path: |
elnpack-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.archive }}
elnpack-${{ env.SAFE_REF }}-${{ matrix.target }}.${{ matrix.archive }}

publish:
name: Publish Release
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ deunicode = "1.6"
tempfile = "3.14"

[profile.release]
lto = true
lto = "thin"
panic = "abort"
strip = "debuginfo"
strip = "symbols"
Comment on lines 32 to +35
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Rust Cargo profile.release lto "thin" string syntax stable version

💡 Result:

Yes — Cargo accepts the string form lto = "thin" in [profile.*] on stable Rust. The Cargo reference lists "thin" as a valid lto value (alongside true/"fat", false, and "off"). [1][2]

Example:
[profile.release]
lto = "thin"

Sources:
[1] Cargo Book — Profiles (official reference).
[2] Rust/Cargo docs showing LTO enum/values.


🌐 Web query:

Rust Cargo profile strip "symbols" setting stable version

💡 Result:

The Cargo profile strip option (so you can use values like "symbols") was stabilized in Rust 1.59.0. [1][2]

Sources:

  • Cargo documentation (unstable/features listing showing stabilization in 1.59). [1]
  • Rust 1.59.0 changelog (Cargo: "Stabilize the strip profile option"). [2]

Optimize release profile with thin LTO and symbol stripping—verify toolchain version.

The changes employ thin LTO and full symbol stripping, which represent a sensible tradeoff: reduced build time and smaller binaries at the cost of diminished post-mortem debuggability. Both lto = "thin" and strip = "symbols" are stable Rust features, though they require a sufficiently recent toolchain. Ensure your Rust version is 1.59 or later to support these profile settings.

Consider whether the transition from strip = "debuginfo" to strip = "symbols" aligns with your production support posture. Full symbol stripping will complicate crash analysis and customer support scenarios.

🤖 Prompt for AI Agents
In Cargo.toml around lines 32-35, the release profile enables thin LTO and full
symbol stripping but may require Rust toolchain >= 1.59 and could hinder
post-mortem debugging; verify the CI/build toolchain version and update it to >=
1.59 (or the minimum Rust version that supports lto="thin" and strip="symbols"),
and if you need to retain some debuginfo for production support change strip
back to "debuginfo" (or document the decision) to balance binary size vs.
supportability.