18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-28 08:02:22 +01:00
Files
maszyna/.github/workflows/build_bin.yml
jerrrrycho 3eb2fdf462 Merge staging into feat/gl46-migration
origin/staging 7ac2472c3 into feat/gl46-migration db26a33ed, so that #468
merges into staging. Merge base 037158104. Staging carries master up to
571487612 (squashed in #514); this branch had merged master up to 7c12b83ba.

Conflicts, file by file:
- README.md: WITH_BETTER_RENDERER row dropped (gl46), USE_SYSTEM_JSON row kept (staging)
- CMakeLists.txt: gl46 lists, plus staging's new core sources (hardwareinfo, sn_utils, regionfile, inionlysettings, fieldshunting, gaugewrap, drivingaid, signalpassing, brakereleaser, crew, brakecharge); none listed twice
- tests/unit/CMakeLists.txt: both (texturealpha, freecameramotion; editorSwitchDrives, Camera)
- vehicle/brakingcurve.{h,cpp}, tests/unit/test_braking_curve.cpp (add/add): staging (#479 brake_acting on the same #409 code)
- editor/editorHttp.cpp: staging (it has gl46's #432 and certificate fixes, plus #439 libcurl loaded at run time)
- tests/unit/test_editor_http.cpp (add/add): staging (adds the available() case of #439)
- utilities/Globals.h: gl46 crashdump_full (staging's CrashDumpFull is #425, replaced here by utilities/crashdump.cpp); fmradio and staging's OpenAL options both; gfx_headlights_beamwidth (#481) not taken
- utilities/Globals.cpp: both (odometer.expiry, OpenAL keys, fmradio, gl46 gfx keys); gfx.headlights.beamwidth (#481) not taken
- utilities/Logs.cpp: staging's log_file_name() for both files, with gl46's crashdump_set_log_file() for both
- utilities/utilities.h: gl46 set_thread_random_engine(); Random(int, int) gone on both sides
- tests/unit/test_utilities.cpp: staging's includes
- simulation/simulationtest.cpp: gl46 (no NvRenderer, LegacyRenderer, BasicRenderer here)
- ci_shadervalidator/* (incl. add/add utilities/Logs.h): gl46's validator of shaders/ogl46 and shaders/vk14; staging's #437 fixed the GL 3.3 one
- gl/shader.cpp, gl/glsl_common.cpp: gl46 (shaders come from rendering/common/shadersource.cpp); HEADLIGHT_BEAM_WIDTH (#481) not taken
- shaders/mat_wire.frag: gl46. Rename detection paired staging's mat_colored.frag (#481) with it
- lang/editor_pl.po: union; the 12 camera speed / orthophoto entries staging adds are here already (master #312)
- audio/audiorenderer.{h,cpp}: both (fmradio; startsample and the low-pass filter); the destructor releases the radio, then the filter
- application/editormode.h, application/editormodeswitchdrive.cpp: staging (#509 on #330, which is all this side had)
- application/application.cpp: gl46's start sequence (no init_ogl, ANGLE or NvRenderer; crash window after init_ui) with staging's hardware::log_system() (#389)
- EU07.cpp: gl46 (crash reports of utilities/crashdump.cpp); staging's side was #425's handler, replaced here
- model/Texture.{h,cpp}: gl46 (texture_source); staging's side is master #399/#411/#362/#386, merged here before
- world/Track.h, world/TrackSleepers.h: both (TrackBlend, lay(Fastened)/fasten; TrackBuckle, pack_models)
- world/Segment.cpp: staging's track buckling on the split stray factors both sides have
- vehicle/Driver.h: staging's additions (#444, #494, #473, #346, timetable flags)
- vehicle/Driver.cpp: staging's file, with this branch's f4f8c75e4 (road orders measured along the lane) and 8fbf05674 (a holding road order blocks the ones past it) applied again; #409's SeenAheadTolerance gives way to #473
- vehicle/DynObj.h: friend opengl46_renderer and friend class vehicle_table
- vehicle/DynObj.cpp: gl46's vehicle_table::update() with staging's update_off_track_contacts() and update_brake_pipes()
- McZapkie/Mover.cpp: staging's function splits (#239) and hose exchange (#388); every line this branch added to Mover.cpp/MOVER.h is kept
- .github/workflows/build_bin.yml: staging's apt-install step (#497) and pinned download-artifact (#331)

Modify/delete, kept deleted:
- rendering/opengl33renderer.{cpp,h}, rendering/openglparticles.cpp, rendering/openglrenderer.{cpp,h}: staging's versions are master's, and every master change to them is in this branch's history already
- shaders/light_common.glsl, shaders/mat_sunlessnormalmap_specgloss.frag: see below

Carried into this branch's code:
- the hose exchange after each sub-step (#387/#388) also in update_steps_parallel(), per group of vehicles, as update() does it single-threaded
- physics.pipewake (pipe_wakes(), wake_cause::scndpipe) in staging's GetScndDVc(), where the main reservoir hose exchange went
- hardware::log_gl_context() (#389) in after_window() of the GL 4.6 backend, init_ogl() being gone

Taken back out of the auto-merge (renderers this branch removed):
- shaders/vk14/tonemapping.glsl: #481's switch to ACES, applied there by rename detection
- environment/skydome.cpp, simulation/simulationenvironment.cpp: #415, the sky of the legacy renderer
- application/application.cpp: #384's fallback of an unknown gfxrenderer, which this branch had dropped

Not carried from staging (renderer files removed here):
- master #481 (571487612): old assets drawn as in 26.05 (metal diffuse, sun highlight tint, ACES, SUN_DIFFUSE_SCALE 2.5, untinted Diffuse, mat_colored base) and gfx.headlights.beamwidth. Made for the GL 3.3 shaders; the PBR shaders of shaders/ogl46 and vk14 (and their SPIR-V binaries) are the author's call
- #437: the unique temporary file of the shader validator (Sonar S5443); gl46's validator still writes /tmp/shader*

Unit tests: 1133 of 1137 cases pass. Four staging tests fail (derailment: a
repaired vehicle is back on the rails; three pullee cases): the vehicle
stands, and with physics.sleepheld (on by default here) its physics sleeps
with the Fb / FStand of before. With physics.sleepheld off they pass. Left
to the author.
2026-11-27 05:26:13 +01:00

659 lines
30 KiB
YAML

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
# ============================================================
# 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 / ${{ 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
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"
# the cab screens are drawn with Pillow; CMake copies this Python's Lib, site-packages included, next to the
# executable as python64\Lib, so Pillow has to be installed here to come with the build (as on Linux)
- name: Install Pillow for the screens
shell: pwsh
run: |
$pythonExe = "${{ steps.python.outputs.python-path }}"
& $pythonExe -m pip install --no-cache-dir Pillow
& $pythonExe -c "from PIL import Image; print('Pillow:', Image.__version__)"
- 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
# 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: |
$pythonExe = "${{ steps.python.outputs.python-path }}"
$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" `
${{ matrix.variant.cmake_flags }}
- 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
# the Python 3 version of the module every cab screen builds on; the game data still has the Python 2 one
New-Item `
-ItemType Directory `
-Force `
-Path "$output/python/local" | Out-Null
Copy-Item `
-Path "staticFiles/python/local/*" `
-Destination "$output/python/local" `
-Recurse `
-Force
# The downloads of the next step, kept between the runs: a release out of reach then doesn't fail the build. The
# key is this file, which pins them; a cache of an older one is taken too, as the next step checks every file by
# its SHA-256 and downloads only those it doesn't have.
- name: Restore the audio library downloads
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/audio-dlls-downloads
key: audio-dlls-${{ hashFiles('.github/workflows/build_bin.yml') }}
restore-keys: audio-dlls-
# The game loads OpenAL32.dll and libsndfile-1.dll from its own folder, and the depot had OpenAL Soft 1.18.1 and
# libsndfile 1.0.28 (2017) there. OpenAL Soft 1.18 lacks ALC_SOFT_reopen_device and ALC_SOFT_system_events, so on
# Windows the sound didn't follow a change of the output device; libsndfile 1.0.28 reads no Opus and no MP3, which
# the Linux build (libsndfile 1.2) does. The official release binaries of both are taken, pinned by SHA-256. They
# need nothing beyond the system DLLs and msvcrt.dll (soft_oal.dll) or KERNEL32.dll (sndfile.dll). soft_oal.dll
# has no AVX code; sndfile.dll (its static opus and mpg123) picks its AVX/AVX2 paths at run time, so the same files
# go with both variants. The exe links them by name: soft_oal.dll is shipped as OpenAL32.dll (as its readme says,
# without the router), sndfile.dll as libsndfile-1.dll. Both are LGPL, so their license texts go with them, in
# licenses/, with those of what the DLLs have built in (below); the libsndfile zip has none, its COPYING is taken
# from the source tree of the same tag. Those texts are kept in ref/licenses (with where each comes from), so the
# build doesn't depend on the servers they come from.
- name: Add the OpenAL Soft and libsndfile DLLs
shell: pwsh
timeout-minutes: 10
run: |
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$output = "build/bin/$env:CONFIG_WIN"
$licenses = Join-Path $output 'licenses'
$work = Join-Path $env:RUNNER_TEMP 'audio-dlls'
$downloads = Join-Path $env:RUNNER_TEMP 'audio-dlls-downloads'
New-Item -ItemType Directory -Force -Path $work, $licenses, $downloads | Out-Null
$pinned = [System.Collections.Generic.List[string]]::new()
# the file of the URL with the given SHA-256: the one kept by a run before, else downloaded. named by its
# SHA-256 and the last part of its path, without the query
function Get-Pinned([string] $Url, [string] $Sha256) {
$name = "$Sha256-$([uri]::new($Url).Segments[-1])"
$pinned.Add($name)
$file = Join-Path $downloads $name
if ((Test-Path -Path $file) -and (Get-FileHash -Algorithm SHA256 -Path $file).Hash.ToLowerInvariant() -eq $Sha256) {
Write-Host "$Url kept by a run before"
return $file
}
Invoke-WebRequest -Uri $Url -OutFile $file -UserAgent 'ci-download' -MaximumRetryCount 3 -RetryIntervalSec 10 -TimeoutSec 120
$hash = (Get-FileHash -Algorithm SHA256 -Path $file).Hash.ToLowerInvariant()
if ($hash -ne $Sha256) {
Remove-Item -Path $file -Force
throw "${Url}: SHA-256 $hash, expected $Sha256"
}
return $file
}
# each package: the zip and, for each file wanted from it, where it goes in the build
$packages = @(
@{ Url = 'https://github.com/kcat/openal-soft/releases/download/1.25.2/openal-soft-1.25.2-bin.zip'
Sha256 = '67a0c4b800bd860c93c04f38caf8cbe4875f9c84700ac430efc451f70e265434'
Files = [ordered]@{
'openal-soft-1.25.2-bin/bin/Win64/soft_oal.dll' = 'OpenAL32.dll'
'openal-soft-1.25.2-bin/COPYING' = 'licenses/openal-soft-COPYING.txt' } },
@{ Url = 'https://github.com/libsndfile/libsndfile/releases/download/1.2.2/libsndfile-1.2.2-win64.zip'
Sha256 = '2173935c0c1ed13cf627951d34483f9d405ead2eb473190461c42ba220643a3f'
Files = [ordered]@{
'libsndfile-1.2.2-win64/bin/sndfile.dll' = 'libsndfile-1.dll' } }
)
foreach ($package in $packages) {
$zip = Get-Pinned $package.Url $package.Sha256
$unpacked = Join-Path $work ([IO.Path]::GetFileNameWithoutExtension($zip))
Expand-Archive -Path $zip -DestinationPath $unpacked -Force
foreach ($entry in $package.Files.GetEnumerator()) {
Copy-Item -Path (Join-Path $unpacked $entry.Key) -Destination (Join-Path $output $entry.Value) -Force
Write-Host "$($entry.Value) <- $($package.Url) $($entry.Key)"
}
}
# the license texts, each from the source tree of the version built in: of libsndfile, its ALAC and GSM 06.10
# code, and the libraries its vcpkg build linked into sndfile.dll; of OpenAL Soft's PFFFT, Microsoft GSL and
# its BSD 3-Clause parts, and of the MinGW-w64 runtime and winpthreads, linked into soft_oal.dll (a MinGW GCC
# 15 build: the texts are the same in mingw-w64 12 and 13).
# The versions in sndfile.dll: those it names (libopus 1.4, libFLAC 1.4.2, libVorbis 1.3.7), mpg123 1.31.3 by
# the SHA-512 of its source archive in the build paths it keeps, and libogg 1.3.5 and LAME 3.100 of the vcpkg
# ports of the time (mid 2023). LAME's from Debian's copy of the 3.100 source, the same file as in LAME's own
# repository on SourceForge. The texts are in ref/licenses, whose README names the URL of each; each is
# checked by its SHA-256, so an edit or a line ending changed on the way doesn't go out unnoticed
$texts = [ordered]@{
'libsndfile-COPYING.txt' = 'ad01ea5cd2755f6048383c8d54c88459cd6fcb17757c5c8892f8c5ea060f6140'
'libsndfile-ALAC-LICENSE.txt' = '232efbd83786e157286b0b96c68ebb673541b69b33036287bf1e5ec5067a49d9'
'libsndfile-GSM610-COPYRIGHT.txt' = '1bbe7119b1bcd1489e0f36cb95b8902f7f0ceec9a2f3a67394bc9f4709a4e0a7'
'libogg-COPYING.txt' = 'd2ab5758336489da61c12cc5bb757da5339c4ae9001f9bb0562b4370249af814'
'libvorbis-COPYING.txt' = 'ec1815db59fcd302846df949d7424876cb2e2dc5ed1606c5fb0b36787b1cf43a'
'flac-COPYING.Xiph.txt' = '6e58d3036f05e2a0d58af854c12a505ddbe75011d71a598a2170987f3b15408d'
'opus-COPYING.txt' = '8338ce8d922bb4416ce3dd1e5680173332435e3f0755007ac7801ccd674fe682'
'mpg123-COPYING.txt' = 'c22482728a634a8dfdb4ff72a96d4c1ed64cd8f3e79335c401751ac591609366'
'lame-COPYING.txt' = 'bfe4a52dc4645385f356a8e83cc54216a293e3b6f1cb4f79f5fc0277abf937fd'
'openal-soft-pffft-LICENSE.txt' = '64056328b3e7bc104e24ef96accc1a7abead156f0c02d1b87c97e3f3a28030de'
'openal-soft-gsl-LICENSE.txt' = '4c21dc82a1c7186ea754fd59d504c00947953a3401fe8e24eaa44109ef8e2555'
'openal-soft-BSD-3Clause.txt' = 'b5a08cf98996dd83aa906a72c163600f6cb17a65ce546a553815a1267abd43ff'
'openal-soft-winpthreads-COPYING.txt' = '63263614cdd29f2f93cba85e992f041b31f9fc7b4033692f31269489a8a1b177'
'openal-soft-mingw-w64-runtime.txt' = 'e9b2dc02451ea29092a1f25fa0f3c07207ed421f1807dffb0c4e6dce69dee7bd'
}
foreach ($text in $texts.GetEnumerator()) {
$file = Join-Path 'ref/licenses' $text.Key
$hash = (Get-FileHash -Algorithm SHA256 -Path $file).Hash.ToLowerInvariant()
if ($hash -ne $text.Value) {
throw "${file}: SHA-256 $hash, expected $($text.Value)"
}
Copy-Item -Path $file -Destination (Join-Path $licenses $text.Key) -Force
}
# OpenAL Soft's bs2b has its license only in its source files: the notice as core/bs2b.cpp of 1.25.2 has it
@'
Copyright (c) 2005 Boris Mikhaylov
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'@ | Set-Content -Path (Join-Path $licenses 'openal-soft-bs2b-LICENSE.txt') -Encoding utf8
# what the DLLs are and have built in, where their source is (the LGPL ones); the DLLs can be replaced by the user
@(
'OpenAL32.dll: OpenAL Soft 1.25.2, unmodified soft_oal.dll of the official binaries, GNU LGPL 2 or later'
' (openal-soft-COPYING.txt). Source: https://github.com/kcat/openal-soft/releases/tag/1.25.2'
' Built in: a modified PFFFT, BSD-style (openal-soft-pffft-LICENSE.txt); Microsoft GSL, MIT'
' (openal-soft-gsl-LICENSE.txt); the ambisonic rotator, the vocal morpher and the compressor, BSD 3-Clause'
' (openal-soft-BSD-3Clause.txt); bs2b, MIT (openal-soft-bs2b-LICENSE.txt); {fmt} 11.2.0, MIT, whose'
' exception for the object form asks for no text. Linked into it by its MinGW-w64 build: the MinGW-w64'
' runtime (openal-soft-mingw-w64-runtime.txt) and winpthreads, MIT and BSD-style'
' (openal-soft-winpthreads-COPYING.txt);'
' libstdc++ and libgcc under the GCC Runtime Library Exception, which asks for no text.'
' Its default HRTF data set is based on the KEMAR HRTF measurements by Bill Gardner and Keith Martin,'
' MIT Media Laboratory, 1994: http://sound.media.mit.edu/resources/KEMAR.html'
'libsndfile-1.dll: libsndfile 1.2.2, unmodified sndfile.dll of the official binaries, GNU LGPL 2.1 or later'
' (libsndfile-COPYING.txt). Source: https://github.com/libsndfile/libsndfile/releases/tag/1.2.2'
' Its ALAC code: Apache License 2.0 (libsndfile-ALAC-LICENSE.txt). Its GSM 06.10 code: Jutta Degener and'
' Carsten Bormann, TU Berlin (libsndfile-GSM610-COPYRIGHT.txt). Its G.721/G.723 code: Sun Microsystems, public'
' domain.'
' Linked into it by its build, made with the vcpkg ports of the time and their patches'
' (https://github.com/microsoft/vcpkg/tree/2023.08.09/ports, the ports named below):'
' libogg 1.3.5, BSD (libogg-COPYING.txt), port libogg. Source: https://github.com/xiph/ogg/releases/tag/v1.3.5'
' libvorbis 1.3.7, BSD (libvorbis-COPYING.txt), port libvorbis. Source: https://github.com/xiph/vorbis/releases/tag/v1.3.7'
' libFLAC 1.4.2, BSD (flac-COPYING.Xiph.txt), port libflac. Source: https://github.com/xiph/flac/releases/tag/1.4.2'
' libopus 1.4, BSD (opus-COPYING.txt), port opus. Source: https://github.com/xiph/opus/releases/tag/v1.4'
' mpg123 1.31.3, GNU LGPL 2.1 (mpg123-COPYING.txt), port mpg123. Source: https://www.mpg123.de/download/mpg123-1.31.3.tar.bz2'
' LAME 3.100, GNU LGPL 2 or later (lame-COPYING.txt), port mp3lame. Source: https://sourceforge.net/projects/lame/files/lame/3.100/'
) | Set-Content -Path (Join-Path $licenses 'audio-libraries.txt') -Encoding utf8
# the files no pin names any more aren't kept for the next run
Get-ChildItem -Path $downloads -File | Where-Object { $pinned -notcontains $_.Name } | Remove-Item -Force
- name: Upload Windows build
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: maszyna-windows-x64-${{ matrix.variant.suffix }}-${{ 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-${{ matrix.variant.suffix }}-${{ 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 / ${{ 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
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"
# The packages are kept in the Actions cache (.github/actions/apt-install): the mirror of the runners has been
# too slow to download them every time. The timeout is a safety net.
# 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.
# The X11 packages are the ones GLFW (ref/glfw, 3.4) looks for; xorg-dev brought ~45 more. The game loads the
# X11 and Wayland libraries of the system, none of them is bundled (CMake_modules/bundle_runtime_libs.cmake).
- name: Install Linux dependencies
timeout-minutes: 15
uses: ./.github/actions/apt-install
with:
packages: >-
build-essential
pkg-config
libasound2-dev
libpulse-dev
libpipewire-0.3-dev
libgl1-mesa-dev
libglew-dev
libglfw3-dev
libpng-dev
libopenal-dev
libluajit-5.1-dev
libserialport-dev
libsndfile1-dev
libcurl4-openssl-dev
libx11-dev
libxcursor-dev
libxext-dev
libxi-dev
libxinerama-dev
libxrandr-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
# 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_REQUIRE_PIPEWIRE=ON \
-DALSOFT_REQUIRE_PULSEAUDIO=ON \
-DALSOFT_REQUIRE_ALSA=ON
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_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"
- name: Build
run: |
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)')"
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 build/bin/python/local
cp -R shaders/. build/bin/shaders/
cp -R lang/. build/bin/lang/
# the Python 3 version of the module every cab screen builds on; the game data still has the Python 2 one
cp -R staticFiles/python/local/. build/bin/python/local/
- name: Upload Linux build
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: maszyna-linux-x64-${{ matrix.variant.suffix }}-${{ 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:
# 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@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: maszyna-windows-x64-avx2-${{ env.CONFIG_WIN }}
path: dist/maszyna-windows-x64
- name: Download Windows build (no AVX2)
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: maszyna-windows-x64-noavx2-${{ env.CONFIG_WIN }}
path: dist/maszyna-windows-x64-noavx2
- name: Download Linux build (AVX2)
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: maszyna-linux-x64-avx2-${{ env.CONFIG_LINUX }}
path: dist/maszyna-linux-x64
- name: Download Linux build (no AVX2)
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: maszyna-linux-x64-noavx2-${{ env.CONFIG_LINUX }}
path: dist/maszyna-linux-x64-noavx2
- name: Pack
run: |
cd dist
# 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
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" \
"- 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 \
--title "Build: $BRANCH" \
--notes "$notes"
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"