4040 sudo apt-get install -y musl-tools
4141 rustup target add x86_64-unknown-linux-musl
4242 - uses : Swatinem/rust-cache@v2
43- - name : Test
43+ - name : Test CLI
4444 run : cargo test -p ii --locked
45- - name : Build Linux static release
45+ - name : Build Linux static CLI
4646 if : runner.os == 'Linux'
4747 shell : bash
4848 env :
5353 if : runner.os == 'Linux'
5454 shell : bash
5555 run : file "${{ matrix.binary }}" | grep -Eq 'statically linked|static-pie linked'
56- - name : Build release
56+ - name : Build CLI
5757 if : runner.os != 'Linux'
5858 run : cargo build -p ii --release --locked
5959 - name : Install UPX 5.1.0 (Windows)
6868 run : |
6969 curl --fail --location --silent --show-error https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-amd64_linux.tar.xz -o upx.tar.xz
7070 tar -xJf upx.tar.xz
71- printf 'UPX =%s\n' "$PWD/upx-5.1.0-amd64_linux/upx" >> "$GITHUB_ENV"
71+ printf 'UPX_BIN =%s\n' "$PWD/upx-5.1.0-amd64_linux/upx" >> "$GITHUB_ENV"
7272 - name : Install UPX 5.1.0 (macOS)
7373 if : runner.os == 'macOS'
7474 shell : bash
@@ -77,17 +77,16 @@ jobs:
7777 tar -xJf upx.tar.xz
7878 cmake -S upx-5.1.0-src -B upx-build -DCMAKE_BUILD_TYPE=Release
7979 cmake --build upx-build --parallel 2
80- printf 'UPX =%s\n' "$PWD/upx-build/upx" >> "$GITHUB_ENV"
80+ printf 'UPX_BIN =%s\n' "$PWD/upx-build/upx" >> "$GITHUB_ENV"
8181 - name : Compress, verify, and enforce CLI budget
82- id : size
8382 shell : bash
8483 run : |
8584 set -eux
8685 binary='${{ matrix.binary }}'
8786 if [ "$RUNNER_OS" = Windows ]; then
8887 upx='./upx-5.1.0-win64/upx.exe'
8988 else
90- upx="$UPX "
89+ upx="$UPX_BIN "
9190 fi
9291 unpacked_bytes=$(wc -c < "$binary")
9392 "$upx" --best --lzma "$binary"
@@ -109,137 +108,9 @@ jobs:
109108 name : cli-${{ matrix.name }}
110109 path : ${{ matrix.artifact }}
111110
112- build-gui-windows :
113- name : GUI windows-x86_64
114- runs-on : windows-latest
115- outputs :
116- unpacked_bytes : ${{ steps.size.outputs.unpacked_bytes }}
117- packed_bytes : ${{ steps.size.outputs.packed_bytes }}
118- steps :
119- - uses : actions/checkout@v4
120- - uses : dtolnay/rust-toolchain@stable
121- - uses : Swatinem/rust-cache@v2
122- - name : Install UPX 5.1.0
123- shell : pwsh
124- run : |
125- Invoke-WebRequest https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-win64.zip -OutFile upx.zip
126- Expand-Archive -Path upx.zip -DestinationPath .
127- - name : Test GUI
128- run : cargo test -p ii-gui --locked
129- - name : Build GUI
130- run : cargo build -p ii-gui --release --locked
131- - name : Compress and verify GUI
132- id : size
133- shell : pwsh
134- run : |
135- $source = 'target/release/ii-gui.exe'
136- $before = (Get-Item $source).Length
137- .\upx-5.1.0-win64\upx.exe --best --lzma $source
138- .\upx-5.1.0-win64\upx.exe -t $source
139- $after = (Get-Item $source).Length
140- "ii-gui Windows: $before -> $after bytes" | Out-File -Append -FilePath $env:GITHUB_STEP_SUMMARY
141- "unpacked_bytes=$before" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
142- "packed_bytes=$after" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
143- Copy-Item $source 'ii-gui-windows-x86_64.exe'
144- - uses : actions/upload-artifact@v4
145- with :
146- name : gui-windows-x86_64
147- path : ii-gui-windows-x86_64.exe
148-
149- build-gui-linux :
150- name : GUI linux-x86_64
151- runs-on : ubuntu-latest
152- outputs :
153- unpacked_bytes : ${{ steps.package.outputs.unpacked_bytes }}
154- packed_bytes : ${{ steps.package.outputs.packed_bytes }}
155- artifact_bytes : ${{ steps.package.outputs.artifact_bytes }}
156- steps :
157- - uses : actions/checkout@v4
158- - uses : dtolnay/rust-toolchain@stable
159- - uses : Swatinem/rust-cache@v2
160- - name : Install AppImage build tools
161- shell : bash
162- run : |
163- sudo apt-get update
164- sudo apt-get install -y wget
165- wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
166- chmod +x appimagetool
167- wget -q https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-amd64_linux.tar.xz -O upx.tar.xz
168- tar -xf upx.tar.xz
169- - name : Test GUI
170- run : cargo test -p ii-gui --locked
171- - name : Build GUI
172- run : cargo build -p ii-gui --release --locked
173- - name : Package AppImage
174- id : package
175- shell : bash
176- run : |
177- set -eux
178- UPX="$(find . -type f -path '*upx*/upx' -print -quit)"
179- unpacked_bytes=$(stat -c '%s' target/release/ii-gui)
180- "$UPX" --best --lzma target/release/ii-gui
181- "$UPX" -t target/release/ii-gui
182- packed_bytes=$(stat -c '%s' target/release/ii-gui)
183- mkdir -p AppDir/usr/bin AppDir/usr/share/applications AppDir/usr/share/icons/hicolor/256x256/apps
184- cp target/release/ii-gui AppDir/usr/bin/ii-gui
185- cp gui/assets/ii-gui.desktop AppDir/usr/share/applications/ii-gui.desktop
186- cp gui/assets/ii-gui.desktop AppDir/ii-gui.desktop
187- cp gui/assets/AppRun AppDir/AppRun
188- chmod +x AppDir/AppRun
189- cp gui/assets/ii-gui.png AppDir/usr/share/icons/hicolor/256x256/apps/ii-gui.png
190- cp AppDir/usr/share/icons/hicolor/256x256/apps/ii-gui.png AppDir/ii-gui.png
191- ARCH=x86_64 ./appimagetool --appimage-extract-and-run AppDir ii-gui-linux-x86_64.AppImage
192- test -x ii-gui-linux-x86_64.AppImage
193- test -s ii-gui-linux-x86_64.AppImage
194- artifact_bytes=$(stat -c '%s' ii-gui-linux-x86_64.AppImage)
195- printf 'unpacked_bytes=%s\npacked_bytes=%s\nartifact_bytes=%s\n' "$unpacked_bytes" "$packed_bytes" "$artifact_bytes" >> "$GITHUB_OUTPUT"
196- - uses : actions/upload-artifact@v4
197- with :
198- name : gui-linux-x86_64
199- path : ii-gui-linux-x86_64.AppImage
200-
201- build-gui-macos :
202- name : GUI macos-aarch64
203- runs-on : macos-14
204- steps :
205- - uses : actions/checkout@v4
206- - uses : dtolnay/rust-toolchain@stable
207- - uses : Swatinem/rust-cache@v2
208- - name : Test GUI
209- run : cargo test -p ii-gui --locked
210- - name : Build GUI
211- run : cargo build -p ii-gui --release --locked
212- - name : Package unsigned app
213- shell : bash
214- run : |
215- set -eux
216- APP='ii.app'
217- mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources/ii-gui.iconset"
218- cp target/release/ii-gui "$APP/Contents/MacOS/ii-gui"
219- chmod +x "$APP/Contents/MacOS/ii-gui"
220- sed "s/__VERSION__/${GITHUB_REF_NAME#v}/g" gui/assets/Info.plist > "$APP/Contents/Info.plist"
221- for size in 16 32 128 256 512; do
222- sips -s format png -z "$size" "$size" gui/assets/ii-gui.png --out "$APP/Contents/Resources/ii-gui.iconset/icon_${size}x${size}.png"
223- done
224- sips -s format png -z 32 32 gui/assets/ii-gui.png --out "$APP/Contents/Resources/ii-gui.iconset/icon_16x16@2x.png"
225- sips -s format png -z 64 64 gui/assets/ii-gui.png --out "$APP/Contents/Resources/ii-gui.iconset/icon_32x32@2x.png"
226- sips -s format png -z 256 256 gui/assets/ii-gui.png --out "$APP/Contents/Resources/ii-gui.iconset/icon_128x128@2x.png"
227- sips -s format png -z 512 512 gui/assets/ii-gui.png --out "$APP/Contents/Resources/ii-gui.iconset/icon_256x256@2x.png"
228- sips -s format png -z 1024 1024 gui/assets/ii-gui.png --out "$APP/Contents/Resources/ii-gui.iconset/icon_512x512@2x.png"
229- iconutil -c icns "$APP/Contents/Resources/ii-gui.iconset" -o "$APP/Contents/Resources/ii-gui.icns"
230- rm -rf "$APP/Contents/Resources/ii-gui.iconset"
231- test -f "$APP/Contents/Info.plist"
232- test -x "$APP/Contents/MacOS/ii-gui"
233- test -s "$APP/Contents/Resources/ii-gui.icns"
234- ditto -c -k --sequesterRsrc --keepParent "$APP" ii-gui-macos-aarch64.app.zip
235- - uses : actions/upload-artifact@v4
236- with :
237- name : gui-macos-aarch64
238- path : ii-gui-macos-aarch64.app.zip
239-
240111 release :
241112 name : Publish GitHub Release
242- needs : [ build-cli, build-gui-windows, build-gui-linux, build-gui-macos]
113+ needs : build-cli
243114 runs-on : ubuntu-latest
244115 steps :
245116 - name : Download artifacts
@@ -258,18 +129,6 @@ jobs:
258129 for artifact in artifacts/*; do
259130 echo "| $(basename "$artifact") | $(stat -c '%s' "$artifact") |"
260131 done
261- echo
262- echo '## GUI compression'
263- echo
264- echo '| Target | Unpacked bytes | UPX bytes | Saved | Final artifact bytes |'
265- echo '| --- | ---: | ---: | ---: | ---: |'
266- windows_unpacked='${{ needs.build-gui-windows.outputs.unpacked_bytes }}'
267- windows_packed='${{ needs.build-gui-windows.outputs.packed_bytes }}'
268- linux_unpacked='${{ needs.build-gui-linux.outputs.unpacked_bytes }}'
269- linux_packed='${{ needs.build-gui-linux.outputs.packed_bytes }}'
270- linux_artifact='${{ needs.build-gui-linux.outputs.artifact_bytes }}'
271- echo "| Windows x86_64 | $windows_unpacked | $windows_packed | $((windows_unpacked - windows_packed)) | $windows_packed |"
272- echo "| Linux x86_64 | $linux_unpacked | $linux_packed | $((linux_unpacked - linux_packed)) | $linux_artifact |"
273132 } >> "$GITHUB_STEP_SUMMARY"
274133 - name : Publish release
275134 uses : softprops/action-gh-release@v2
0 commit comments