name: Build binaries on: push: branches: - "**" pull_request: types: - opened - reopened - synchronize workflow_dispatch: permissions: contents: read env: CONFIG_WIN: RelWithDebInfo CONFIG_LINUX: Release jobs: # ============================================================ # Windows / MSVC # ============================================================ windows: name: Windows x64 / MSVC runs-on: windows-2022 steps: - name: Checkout repository uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: fetch-depth: 0 submodules: recursive - name: Setup Python 3.14 id: python uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: "3.14" architecture: "x64" - name: Show environment shell: pwsh run: | python --version cmake --version Write-Host "Python:" Get-Command python Write-Host "MSVC:" & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` -latest ` -products * ` -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` -property installationPath # README: bootstrap vcpkg + install DirectX DXC - name: Prepare Windows dependencies shell: cmd run: | call setup.bat - name: Configure shell: pwsh run: | $pythonExe = "${{ steps.python.outputs.python-path }}" $pythonRoot = Split-Path $pythonExe Write-Host "Python root: $pythonRoot" cmake -S . -B build ` -G "Visual Studio 17 2022" ` -A x64 ` "-DPython3_ROOT_DIR=$pythonRoot" - name: Build shell: pwsh run: | cmake --build build ` --config $env:CONFIG_WIN ` --parallel - name: Copy shaders and translations shell: pwsh run: | $output = "build/bin/$env:CONFIG_WIN" New-Item ` -ItemType Directory ` -Force ` -Path "$output/shaders" | Out-Null Copy-Item ` -Path "shaders/*" ` -Destination "$output/shaders" ` -Recurse ` -Force New-Item ` -ItemType Directory ` -Force ` -Path "$output/lang" | Out-Null Copy-Item ` -Path "lang/*" ` -Destination "$output/lang" ` -Recurse ` -Force - name: Upload Windows build uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: maszyna-windows-x64-${{ env.CONFIG_WIN }} path: | build/bin/${{ env.CONFIG_WIN }}/ if-no-files-found: error retention-days: 14 - name: Upload Windows debug symbols uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: maszyna-windows-x64-symbols-${{ env.CONFIG_WIN }} path: | build/pdb/${{ env.CONFIG_WIN }}/*.pdb build/bin/${{ env.CONFIG_WIN }}/*.map if-no-files-found: warn retention-days: 14 # ============================================================ # Linux / GCC # ============================================================ linux: name: Linux x64 / GCC runs-on: ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: fetch-depth: 0 submodules: recursive - name: Setup Python 3.14 id: python uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: "3.14" - name: Install Linux dependencies run: | sudo apt-get update sudo apt-get install -y \ build-essential \ libgl1-mesa-dev \ libglew-dev \ libglfw3-dev \ libpng-dev \ libopenal-dev \ libluajit-5.1-dev \ libserialport-dev \ libsndfile1-dev \ xorg-dev \ libxkbcommon-dev \ libwayland-dev \ wayland-protocols # # Existing MaSzyna CI already builds OpenAL Soft 1.24.2, # so retain that instead of relying only on Ubuntu's package. # - name: Build OpenAL Soft run: | git clone \ --depth 1 \ --branch 1.24.2 \ https://github.com/kcat/openal-soft.git \ /tmp/openal-soft cmake \ -S /tmp/openal-soft \ -B /tmp/openal-soft/build \ -DCMAKE_BUILD_TYPE=Release \ -DALSOFT_EXAMPLES=OFF \ -DALSOFT_UTILS=OFF cmake \ --build /tmp/openal-soft/build \ --parallel "$(nproc)" sudo cmake \ --install /tmp/openal-soft/build sudo ldconfig - name: Show environment run: | gcc --version g++ --version cmake --version python --version - name: Configure run: | cmake \ -S . \ -B build \ -DCMAKE_BUILD_TYPE="${CONFIG_LINUX}" \ -DWITH_BETTER_RENDERER=OFF \ -DWITH_ZMQ=OFF \ -DWITH_OPENVR=OFF \ -DUSE_LTO=OFF \ -DPython3_EXECUTABLE="${{ steps.python.outputs.python-path }}" \ -DCMAKE_CXX_FLAGS="-Wno-attributes -fno-inline-functions-called-once" - name: Build run: | cmake \ --build build \ --parallel "$(nproc)" - name: Prepare Linux Python environment run: | PYTHON_ROOT="$(python -c 'import sys; print(sys.base_prefix)')" PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" PYTHON_HOME="$GITHUB_WORKSPACE/build/bin/linuxpython64" echo "Python root: $PYTHON_ROOT" echo "Python version: $PYTHON_VERSION" echo "Embedded Python home: $PYTHON_HOME" python -m venv --copies "$PYTHON_HOME" cp -a \ "$PYTHON_ROOT/lib/python${PYTHON_VERSION}/." \ "$PYTHON_HOME/lib/python${PYTHON_VERSION}/" "$PYTHON_HOME/bin/python" -m pip install --upgrade pip "$PYTHON_HOME/bin/python" -m pip install --no-cache-dir Pillow "$PYTHON_HOME/bin/python" -c "from PIL import Image; print('Pillow:', Image.__version__)" - name: Copy shaders and translations run: | mkdir -p build/bin/shaders build/bin/lang cp -R shaders/. build/bin/shaders/ cp -R lang/. build/bin/lang/ - name: Upload Linux build uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: maszyna-linux-x64-${{ env.CONFIG_LINUX }} path: | build/bin/ if-no-files-found: error retention-days: 14 # ============================================================ # Public download: release assets need no GitHub account # ============================================================ publish: name: Publish public download needs: [windows, linux] if: github.event_name != 'pull_request' runs-on: ubuntu-24.04 permissions: contents: write concurrency: group: publish-${{ github.ref }} cancel-in-progress: false steps: - name: Download Windows build uses: actions/download-artifact@v4 with: name: maszyna-windows-x64-${{ env.CONFIG_WIN }} path: dist/maszyna-windows-x64 - name: Download Linux build uses: actions/download-artifact@v4 with: name: maszyna-linux-x64-${{ env.CONFIG_LINUX }} path: dist/maszyna-linux-x64 - name: Pack run: | cd dist find maszyna-linux-x64 -type f -exec sh -c 'file -b "$1" | grep -q "^ELF" && chmod +x "$1"' _ {} \; if [ -d maszyna-linux-x64/linuxpython64/bin ]; then chmod +x maszyna-linux-x64/linuxpython64/bin/* fi (cd maszyna-windows-x64 && zip -qr9 ../maszyna-windows-x64.zip .) tar -czf maszyna-linux-x64.tar.gz -C maszyna-linux-x64 . ls -la - name: Publish rolling release of the branch env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} BRANCH: ${{ github.ref_name }} SHA: ${{ github.sha }} RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} run: | slug="$(printf '%s' "$BRANCH" | tr '/ ' '--' | tr -cd '[:alnum:]._-')" tag="build-$slug" base="${{ github.server_url }}/${{ github.repository }}/releases/download/$tag" notes="$(printf '%s\n' \ "Automatic build of branch \`$BRANCH\`, commit $SHA, replaced by every push to the branch." \ "" \ "Download without a GitHub account:" \ "- Windows: $base/maszyna-windows-x64.zip" \ "- Linux: $base/maszyna-linux-x64.tar.gz" \ "" \ "Unpack over a MaSzyna installation (the game data isn't included). Build log: $RUN_URL")" gh release delete "$tag" --yes --cleanup-tag || true gh release create "$tag" \ dist/maszyna-windows-x64.zip \ dist/maszyna-linux-x64.tar.gz \ --target "$SHA" \ --prerelease \ --latest=false \ --title "Build: $BRANCH" \ --notes "$notes" echo "### Public download" >> "$GITHUB_STEP_SUMMARY" echo "- Windows: $base/maszyna-windows-x64.zip" >> "$GITHUB_STEP_SUMMARY" echo "- Linux: $base/maszyna-linux-x64.tar.gz" >> "$GITHUB_STEP_SUMMARY"