Reduce executable file size #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { target: x86_64-windows-gnu, ext: ".exe", cmake: "-DPacket_ROOT=/tmp/sdk" } | |
- { target: aarch64-linux-musl } | |
- { target: x86_64-linux-musl } | |
- { target: mipsel-linux-musl } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install UPX | |
uses: crazy-max/ghaction-upx@v3 | |
with: | |
install-only: true | |
- name: Download NPCAP SDK | |
if: matrix.target == 'x86_64-windows-gnu' | |
run: | | |
wget https://npcap.com/dist/npcap-sdk-1.13.zip -O /tmp/sdk.zip | |
unzip /tmp/sdk.zip -d /tmp/sdk | |
mkdir -p /tmp/sdk/lib/x64 | |
cp /tmp/sdk/Lib/x64/*lib /tmp/sdk/lib/x64 | |
cp /tmp/sdk/Lib/x64/*lib /tmp/sdk/lib | |
- name: Build executable | |
run: | | |
sudo rm -rf /usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc | |
cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel -DZIG_TARGET=${{ matrix.target }} -DUSE_SYSTEM_PCAP=OFF ${{ matrix.cmake }} | |
cmake --build build -t pppwn -- -j$(nproc) | |
sudo apt-get install llvm --no-install-recommends | |
llvm-strip build/pppwn${{ matrix.ext }} | |
upx --lzma build/pppwn${{ matrix.ext }} | |
tar -czvf pppwn.tar.gz build/pppwn${{ matrix.ext }} | |
- name: Upload result | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: pppwn.tar.gz |