name: CI on: push: branches: [ main ] pull_request: workflow_dispatch: jobs: build-and-test: name: Build & integration tests (Windows, MinGW) runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up JDK uses: actions/setup-java@v4 with: distribution: temurin java-version: '25' - name: Set up MinGW-w64 toolchain uses: msys2/setup-msys2@v2 with: msystem: MINGW64 update: false install: >- mingw-w64-x86_64-gcc mingw-w64-x86_64-binutils mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja - name: Configure shell: msys2 {0} run: | # Link the C/C++ runtime statically, like w64devkit (the toolchain the # project is built with locally). Without this the DLLs depend on # libstdc++-6/libgcc_s_seh-1, which can be shadowed by a different # version elsewhere on the machine and fail to load. cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ -DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++" - name: Build shell: msys2 {0} run: | cmake --build build echo "compiler: $(command -v g++)" echo "target: $(gcc -dumpmachine)" echo "--- imports (non-system DLLs) ---" objdump -p build/bin/libagent.dll build/bin/libloader.dll build/bin/libinject.dll \ | grep 'DLL Name:' | sed 's/.*DLL Name:[[:space:]]*//' | sort -u # Bundle whatever non-system DLLs are still imported, taken from the # toolchain that built them, so the tests can load libagent.dll # without depending on PATH. GCC_BIN="$(dirname "$(command -v gcc)")" deps="$(objdump -p build/bin/libagent.dll build/bin/libloader.dll build/bin/libinject.dll \ | grep 'DLL Name:' | sed 's/.*DLL Name:[[:space:]]*//' | sort -u \ | grep -viE '^(kernel32|user32|advapi32|ws2_32|shell32|ole32|gdi32|msvcrt|ucrtbase|ntdll|comdlg32|comctl32|psapi|version|iphlpapi|bcrypt|secur32|crypt32|winmm|imm32|netapi32|userenv|rpcrt4|setupapi|mswsock|dnsapi|normaliz)[.]dll$' \ | grep -viE '^api-ms-win-')" for dll in $deps; do if [ -f "$GCC_BIN/$dll" ]; then cp -f "$GCC_BIN/$dll" build/bin/ echo "bundled $dll" else echo "MISSING $dll (not found in $GCC_BIN)" fi done echo "--- build/bin ---" ls -1 build/bin - name: Run integration tests shell: pwsh run: | # Fallback for any remaining runtime DLLs. $env:PATH = "C:\msys64\mingw64\bin;$env:PATH" ./tests/run-tests.ps1 - name: Package release zip shell: msys2 {0} run: cmake -P script/package.cmake - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: JuiceAgent-windows-x64 path: dist/JuiceAgent_*.zip if-no-files-found: error retention-days: 14 build-linux: name: Build (Linux, GCC) runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install build tools run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ build-essential cmake ninja-build - name: Configure run: | cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release - name: Build run: | cmake --build build echo "compiler: $(command -v g++)" echo "target: $(gcc -dumpmachine)" echo "--- build/bin ---" ls -1 build/bin - name: Package release tarball run: ./script/package.sh - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: JuiceAgent-linux-x64 path: dist/JuiceAgent_*.tar.gz if-no-files-found: error retention-days: 14