Skip to content

Commit 85348ed

Browse files
committed
build: optimize binary size (4.0M → 3.0M)
- Add opt-level = "z" to release profile (size-optimized codegen) - Remove redundant strip/editbin steps from CI (strip = true in Cargo.toml already handles all targets) - Remove redundant --features "ntds.dit" (already in default features)
1 parent d616a62 commit 85348ed

2 files changed

Lines changed: 2 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,18 @@ jobs:
1717
- target: x86_64-unknown-linux-gnu
1818
os: ubuntu-latest
1919
name: linux-x86_64
20-
strip: strip
2120
- target: x86_64-unknown-linux-musl
2221
os: ubuntu-latest
2322
name: esxi-x86_64
24-
strip: strip
2523
- target: x86_64-pc-windows-msvc
2624
os: windows-latest
2725
name: windows-x86_64
28-
strip: ""
2926
- target: x86_64-apple-darwin
3027
os: macos-latest
3128
name: macos-x86_64
32-
strip: strip
3329
- target: aarch64-apple-darwin
3430
os: macos-latest
3531
name: macos-aarch64
36-
strip: strip
3732

3833
runs-on: ${{ matrix.os }}
3934

@@ -51,21 +46,7 @@ jobs:
5146
run: sudo apt-get update && sudo apt-get install -y musl-tools
5247

5348
- name: Build
54-
run: cargo build --release --target ${{ matrix.target }} --features "ntds.dit"
55-
56-
- name: Strip binary (Unix)
57-
if: matrix.strip != '' && runner.os != 'Windows'
58-
run: ${{ matrix.strip }} target/${{ matrix.target }}/release/vmkatz
59-
60-
- name: Strip binary (Windows)
61-
if: runner.os == 'Windows'
62-
shell: pwsh
63-
run: |
64-
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
65-
$vcToolsPath = & $vsWhere -latest -find "VC\Tools\MSVC\*\bin\Hostx64\x64" | Select-Object -First 1
66-
& "$vcToolsPath\dumpbin.exe" /HEADERS target\${{ matrix.target }}\release\vmkatz.exe | Out-Null
67-
# Use editbin to strip debug info
68-
& "$vcToolsPath\editbin.exe" /RELEASE target\${{ matrix.target }}\release\vmkatz.exe
49+
run: cargo build --release --target ${{ matrix.target }}
6950

7051
- name: Archive (Unix)
7152
if: runner.os != 'Windows'

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ carve = []
1616
dump = []
1717

1818
[profile.release]
19+
opt-level = "z"
1920
strip = true
2021
lto = true
2122
codegen-units = 1

0 commit comments

Comments
 (0)