name: Build VulkanEngine on: push: branches: - vkguide pull_request: workflow_dispatch: schedule: - cron: "0 3 * * 1" jobs: # --------------------------------------------------------------------------- # 1. Nix build: validates the flake build and produces the SPIR-V shaders # (SPIR-V is OS independent, and slangc is not packaged in Debian). # --------------------------------------------------------------------------- nix: runs-on: ubuntu-latest container: git.alexdelcamp.fr/alexandre_1a/flake-actions:latest steps: - name: Checkout uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Configure run: | nix develop --command cmake -S . -B build \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release - name: Build run: | nix develop --command cmake --build build --parallel 2 - name: Upload shaders uses: actions/upload-artifact@v4 with: name: shaders path: build/engine/shaders - name: Notify progress if: always() run: | curl \ -H "Title: [Routine] Shaders" \ -d "Build finished" \ https://ntfy.alexdelcamp.fr/FlakeBuild # --------------------------------------------------------------------------- # 2. Debian 12 builds: portable (static) and bundle (bin/ + lib/) # Built on glibc 2.36 => runs on Debian 12 and anything newer. # --------------------------------------------------------------------------- release: needs: nix runs-on: ubuntu-latest container: debian:12 strategy: fail-fast: false matrix: variant: [PORTABLE, BUNDLE] steps: # git + nodejs must exist before checkout (JS actions run in the container) - name: Dependencies run: | apt-get update apt-get install -y --no-install-recommends \ git ca-certificates nodejs curl \ build-essential cmake ninja-build pkg-config \ libwayland-dev libwayland-bin wayland-protocols libxkbcommon-dev \ libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev - name: Checkout uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Git safe directory run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Download shaders uses: actions/download-artifact@v4 with: name: shaders path: prebuilt-shaders - name: Configure run: | cmake -S . -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DVULKANENGINE_FETCH_DEPS=ON \ -DVULKANENGINE_${{ matrix.variant }}=ON \ -DVULKANENGINE_PREBUILT_SHADERS="$PWD/prebuilt-shaders" - name: Build run: cmake --build build --parallel 2 - name: Install run: cmake --install build --prefix dist --strip - name: Check binaries shell: bash run: | set -euo pipefail for b in dist/bin/engine dist/bin/server; do echo "========== $b ==========" readelf -l "$b" | grep 'program interpreter' readelf -d "$b" | grep -E 'RPATH|RUNPATH|NEEDED' || true if strings "$b" | grep -q '/nix/store'; then echo "ERROR: $b references /nix/store"; exit 1 fi # The loader must come from volk (dlopen), never from NEEDED if readelf -d "$b" | grep -q 'libvulkan'; then echo "ERROR: $b links libvulkan directly"; exit 1 fi if [ "${{ matrix.variant }}" = "PORTABLE" ]; then if readelf -d "$b" | grep -Eq 'libstdc\+\+|libgcc_s'; then echo "ERROR: $b is not static for libstdc++/libgcc"; exit 1 fi fi max=$(objdump -T "$b" | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -uV | tail -1 || true) echo "Highest GLIBC symbol: ${max:-none}" if [ -n "$max" ] && [ "$(printf '%s\n%s\n' "$max" 2.36 | sort -V | tail -1)" != "2.36" ]; then echo "ERROR: needs glibc $max (> 2.36)"; exit 1 fi if ldd "$b" | grep 'not found'; then echo "ERROR: unresolved libraries in $b"; exit 1 fi done if [ "${{ matrix.variant }}" = "BUNDLE" ]; then echo "========== lib/ ==========" ls -la dist/lib fi # tar keeps permissions and symlinks; artifact zips do not - name: Package run: | tar -C dist -czf VulkanEngine-${{ matrix.variant }}-linux-x86_64.tar.gz . - name: Upload build uses: actions/upload-artifact@v4 with: name: VulkanEngine-${{ matrix.variant }}-linux-x86_64 path: VulkanEngine-${{ matrix.variant }}-linux-x86_64.tar.gz - name: Notify progress if: failure() run: | curl \ -H "Title: [Routine] Engine-${{ matrix.variant }} build" \ -d "Build failed (nix: ${{ needs.nix.result }}, release: ${{ needs.release.result }})" \ https://ntfy.alexdelcamp.fr/FlakeBuild # --------------------------------------------------------------------------- notify: needs: [nix, release] if: always() runs-on: ubuntu-latest steps: - name: Notify routine run: | curl \ -H "Title: [Routine] VulkanEngine build" \ -d "Build finished (nix: ${{ needs.nix.result }}, release: ${{ needs.release.result }})" \ https://ntfy.alexdelcamp.fr/FlakeBuild