mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 10:24:58 +01:00
Merge branch 'master' into feat/renderers-cleanup
This commit is contained in:
160
.github/workflows/build_bin.yml
vendored
160
.github/workflows/build_bin.yml
vendored
@@ -27,9 +27,31 @@ jobs:
|
||||
# Windows / MSVC
|
||||
# ============================================================
|
||||
|
||||
# A newer push to the same branch or pull request cancels the build of the older commit. The
|
||||
# groups are set on the build jobs rather than on the workflow, so a publish job that is already
|
||||
# running is left to finish; with a build cancelled the publish job of that run is skipped. A push
|
||||
# to master gets a group of its own, its commit, so the builds of master are never cancelled.
|
||||
|
||||
# Windows is built twice: with AVX2 (the default of ENABLE_AVX2) and without it, for CPUs older
|
||||
# than Haswell (2013). Each variant has its own concurrency group, or one would cancel the other.
|
||||
|
||||
windows:
|
||||
name: Windows x64 / MSVC
|
||||
name: Windows x64 / MSVC / ${{ matrix.variant.name }}
|
||||
runs-on: windows-2022
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-windows-${{ matrix.variant.suffix }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
variant:
|
||||
- name: "AVX2"
|
||||
suffix: "avx2"
|
||||
cmake_flags: "-DENABLE_AVX2=ON"
|
||||
- name: "No AVX2"
|
||||
suffix: "noavx2"
|
||||
cmake_flags: "-DENABLE_AVX2=OFF"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -76,6 +98,27 @@ jobs:
|
||||
run: |
|
||||
call setup.bat
|
||||
|
||||
# the unit tests run at the end of the build and load lua51.dll (the Lua screens), but ref/luajit has only its import
|
||||
# library. LuaJIT of the same 2.0 line is built here and put on PATH for them; it doesn't go into the uploaded build
|
||||
- name: Build lua51.dll for the unit tests
|
||||
shell: cmd
|
||||
run: |
|
||||
for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSDIR=%%i"
|
||||
call "%VSDIR%\VC\Auxiliary\Build\vcvars64.bat" || exit /b 1
|
||||
git init -q "%RUNNER_TEMP%\LuaJIT" || exit /b 1
|
||||
cd /d "%RUNNER_TEMP%\LuaJIT"
|
||||
rem the v2.0 branch of LuaJIT, pinned
|
||||
git fetch -q --depth 1 https://github.com/LuaJIT/LuaJIT.git b83bcba6ea300d4eb16e8257ddf80bcdef1f938b || exit /b 1
|
||||
git checkout -q FETCH_HEAD || exit /b 1
|
||||
cd src
|
||||
rem msvcbuild.bat runs the tools it builds (minilua, buildvm) from the current folder
|
||||
set NoDefaultCurrentDirectoryInExePath=
|
||||
call .\msvcbuild.bat || exit /b 1
|
||||
if not exist lua51.dll exit /b 1
|
||||
mkdir "%RUNNER_TEMP%\lua51"
|
||||
copy /y lua51.dll "%RUNNER_TEMP%\lua51\" || exit /b 1
|
||||
echo %RUNNER_TEMP%\lua51>> "%GITHUB_PATH%"
|
||||
|
||||
- name: Configure
|
||||
shell: pwsh
|
||||
run: |
|
||||
@@ -83,11 +126,13 @@ jobs:
|
||||
$pythonRoot = Split-Path $pythonExe
|
||||
|
||||
Write-Host "Python root: $pythonRoot"
|
||||
Write-Host "Extra CMake flags: ${{ matrix.variant.cmake_flags }}"
|
||||
|
||||
cmake -S . -B build `
|
||||
-G "Visual Studio 17 2022" `
|
||||
-A x64 `
|
||||
"-DPython3_ROOT_DIR=$pythonRoot"
|
||||
"-DPython3_ROOT_DIR=$pythonRoot" `
|
||||
${{ matrix.variant.cmake_flags }}
|
||||
|
||||
- name: Build
|
||||
shell: pwsh
|
||||
@@ -138,7 +183,7 @@ jobs:
|
||||
- name: Upload Windows build
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: maszyna-windows-x64-${{ env.CONFIG_WIN }}
|
||||
name: maszyna-windows-x64-${{ matrix.variant.suffix }}-${{ env.CONFIG_WIN }}
|
||||
path: |
|
||||
build/bin/${{ env.CONFIG_WIN }}/
|
||||
if-no-files-found: error
|
||||
@@ -147,7 +192,7 @@ jobs:
|
||||
- name: Upload Windows debug symbols
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: maszyna-windows-x64-symbols-${{ env.CONFIG_WIN }}
|
||||
name: maszyna-windows-x64-symbols-${{ matrix.variant.suffix }}-${{ env.CONFIG_WIN }}
|
||||
path: |
|
||||
build/pdb/${{ env.CONFIG_WIN }}/*.pdb
|
||||
build/bin/${{ env.CONFIG_WIN }}/*.map
|
||||
@@ -160,8 +205,23 @@ jobs:
|
||||
# ============================================================
|
||||
|
||||
linux:
|
||||
name: Linux x64 / GCC
|
||||
name: Linux x64 / GCC / ${{ matrix.variant.name }}
|
||||
runs-on: ubuntu-24.04
|
||||
# see the notes above the windows job: two variants, each with a concurrency group of its own
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-linux-${{ matrix.variant.suffix }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
variant:
|
||||
- name: "AVX2"
|
||||
suffix: "avx2"
|
||||
cmake_flags: "-DENABLE_AVX2=ON"
|
||||
- name: "No AVX2"
|
||||
suffix: "noavx2"
|
||||
cmake_flags: "-DENABLE_AVX2=OFF"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -176,12 +236,25 @@ jobs:
|
||||
with:
|
||||
python-version: "3.14"
|
||||
|
||||
# A mirror that stops answering used to hold this step for over an hour.
|
||||
# Time out each download, retry it, and give up on the whole step early.
|
||||
- name: Install Linux dependencies
|
||||
timeout-minutes: 15
|
||||
run: |
|
||||
printf '%s\n' \
|
||||
'Acquire::Retries "3";' \
|
||||
'Acquire::http::Timeout "60";' \
|
||||
'Acquire::https::Timeout "60";' \
|
||||
| sudo tee /etc/apt/apt.conf.d/80-ci-retries > /dev/null
|
||||
sudo apt-get update
|
||||
|
||||
# libasound2-dev, libpulse-dev and libpipewire-0.3-dev: the headers of OpenAL Soft's audio backends (built below).
|
||||
# Without them it builds with OSS only, which modern distributions and the Steam Linux Runtime don't have: no sound.
|
||||
sudo apt-get install -y \
|
||||
build-essential \
|
||||
libasound2-dev \
|
||||
libpulse-dev \
|
||||
libpipewire-0.3-dev \
|
||||
libgl1-mesa-dev \
|
||||
libglew-dev \
|
||||
libglfw3-dev \
|
||||
@@ -190,6 +263,7 @@ jobs:
|
||||
libluajit-5.1-dev \
|
||||
libserialport-dev \
|
||||
libsndfile1-dev \
|
||||
libcurl4-openssl-dev \
|
||||
xorg-dev \
|
||||
libxkbcommon-dev \
|
||||
libwayland-dev \
|
||||
@@ -207,12 +281,17 @@ jobs:
|
||||
https://github.com/kcat/openal-soft.git \
|
||||
/tmp/openal-soft
|
||||
|
||||
# the backends are loaded with dlopen at run time (ALSOFT_DLOPEN), so the bundled library needs none of them;
|
||||
# REQUIRE makes a missing header fail the build instead of shipping a library without sound
|
||||
cmake \
|
||||
-S /tmp/openal-soft \
|
||||
-B /tmp/openal-soft/build \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DALSOFT_EXAMPLES=OFF \
|
||||
-DALSOFT_UTILS=OFF
|
||||
-DALSOFT_UTILS=OFF \
|
||||
-DALSOFT_REQUIRE_PIPEWIRE=ON \
|
||||
-DALSOFT_REQUIRE_PULSEAUDIO=ON \
|
||||
-DALSOFT_REQUIRE_ALSA=ON
|
||||
|
||||
cmake \
|
||||
--build /tmp/openal-soft/build \
|
||||
@@ -239,6 +318,7 @@ jobs:
|
||||
-DWITH_ZMQ=OFF \
|
||||
-DWITH_OPENVR=OFF \
|
||||
-DUSE_LTO=OFF \
|
||||
${{ matrix.variant.cmake_flags }} \
|
||||
-DPython3_EXECUTABLE="${{ steps.python.outputs.python-path }}" \
|
||||
-DCMAKE_CXX_FLAGS="-Wno-attributes -fno-inline-functions-called-once"
|
||||
|
||||
@@ -247,7 +327,31 @@ jobs:
|
||||
cmake \
|
||||
--build build \
|
||||
--parallel "$(nproc)"
|
||||
|
||||
|
||||
# the build copies the shared libraries next to the game (CMake_modules/bundle_runtime_libs.cmake) and the
|
||||
# game looks for them there first ($ORIGIN): each one it loads from outside build/bin has to be one of the system
|
||||
- name: Check the bundled libraries
|
||||
run: |
|
||||
GAME="$(find build/bin -maxdepth 1 -type f -name 'eu07*' -perm -u+x | head -n 1)"
|
||||
test -n "$GAME"
|
||||
echo "Game: $GAME"
|
||||
readelf -d "$GAME" | grep -E 'R(UN)?PATH'
|
||||
readelf -d "$GAME" | grep -q 'Library rpath: \[\$ORIGIN\]'
|
||||
cat build/bin/bundled_libs.txt
|
||||
ldd "$GAME"
|
||||
if ldd "$GAME" | grep -q 'not found'; then
|
||||
echo "::error::the game needs a library that is neither bundled nor in the system"
|
||||
exit 1
|
||||
fi
|
||||
while read -r name; do
|
||||
[ -n "$name" ] || continue
|
||||
loaded="$(ldd "$GAME" | awk -v n="$name" '$1 == n { print $3 }')"
|
||||
if [ -z "$loaded" ] || [ "$(realpath "$loaded")" != "$(realpath "build/bin/$name")" ]; then
|
||||
echo "::error::$name is bundled, but the game loads it from '$loaded'"
|
||||
exit 1
|
||||
fi
|
||||
done < build/bin/bundled_libs.txt
|
||||
|
||||
- name: Prepare Linux Python environment
|
||||
run: |
|
||||
PYTHON_ROOT="$(python -c 'import sys; print(sys.base_prefix)')"
|
||||
@@ -280,7 +384,7 @@ jobs:
|
||||
- name: Upload Linux build
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: maszyna-linux-x64-${{ env.CONFIG_LINUX }}
|
||||
name: maszyna-linux-x64-${{ matrix.variant.suffix }}-${{ env.CONFIG_LINUX }}
|
||||
path: |
|
||||
build/bin/
|
||||
if-no-files-found: error
|
||||
@@ -303,29 +407,47 @@ jobs:
|
||||
cancel-in-progress: false
|
||||
|
||||
steps:
|
||||
- name: Download Windows build
|
||||
# the AVX2 build keeps the old name of the download, so the links already handed out still work
|
||||
- name: Download Windows build (AVX2)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: maszyna-windows-x64-${{ env.CONFIG_WIN }}
|
||||
name: maszyna-windows-x64-avx2-${{ env.CONFIG_WIN }}
|
||||
path: dist/maszyna-windows-x64
|
||||
|
||||
- name: Download Linux build
|
||||
- name: Download Windows build (no AVX2)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: maszyna-linux-x64-${{ env.CONFIG_LINUX }}
|
||||
name: maszyna-windows-x64-noavx2-${{ env.CONFIG_WIN }}
|
||||
path: dist/maszyna-windows-x64-noavx2
|
||||
|
||||
- name: Download Linux build (AVX2)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: maszyna-linux-x64-avx2-${{ env.CONFIG_LINUX }}
|
||||
path: dist/maszyna-linux-x64
|
||||
|
||||
- name: Download Linux build (no AVX2)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: maszyna-linux-x64-noavx2-${{ env.CONFIG_LINUX }}
|
||||
path: dist/maszyna-linux-x64-noavx2
|
||||
|
||||
- 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
|
||||
# the artifacts lose the executable bit
|
||||
for dir in maszyna-linux-x64 maszyna-linux-x64-noavx2; do
|
||||
find "$dir" -type f -exec sh -c 'file -b "$1" | grep -q "^ELF" && chmod +x "$1"' _ {} \;
|
||||
if [ -d "$dir/linuxpython64/bin" ]; then
|
||||
chmod +x "$dir"/linuxpython64/bin/*
|
||||
fi
|
||||
done
|
||||
|
||||
(cd maszyna-windows-x64 && zip -qr9 ../maszyna-windows-x64.zip .)
|
||||
(cd maszyna-windows-x64-noavx2 && zip -qr9 ../maszyna-windows-x64-noavx2.zip .)
|
||||
tar -czf maszyna-linux-x64.tar.gz -C maszyna-linux-x64 .
|
||||
tar -czf maszyna-linux-x64-noavx2.tar.gz -C maszyna-linux-x64-noavx2 .
|
||||
ls -la
|
||||
|
||||
- name: Publish rolling release of the branch
|
||||
@@ -345,14 +467,18 @@ jobs:
|
||||
"" \
|
||||
"Download without a GitHub account:" \
|
||||
"- Windows: $base/maszyna-windows-x64.zip" \
|
||||
"- Windows, CPUs without AVX2 (older than Haswell, 2013): $base/maszyna-windows-x64-noavx2.zip" \
|
||||
"- Linux: $base/maszyna-linux-x64.tar.gz" \
|
||||
"- Linux, CPUs without AVX2: $base/maszyna-linux-x64-noavx2.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-windows-x64-noavx2.zip \
|
||||
dist/maszyna-linux-x64.tar.gz \
|
||||
dist/maszyna-linux-x64-noavx2.tar.gz \
|
||||
--target "$SHA" \
|
||||
--prerelease \
|
||||
--latest=false \
|
||||
@@ -361,4 +487,6 @@ jobs:
|
||||
|
||||
echo "### Public download" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "- Windows: $base/maszyna-windows-x64.zip" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "- Windows, no AVX2: $base/maszyna-windows-x64-noavx2.zip" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "- Linux: $base/maszyna-linux-x64.tar.gz" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "- Linux, no AVX2: $base/maszyna-linux-x64-noavx2.tar.gz" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
Reference in New Issue
Block a user