Skip to content

Fix build

Fix build #1889

name: Continuous Integration
on:
push:
branches: ["*"]
tags-ignore: ["*"]
pull_request:
branches: ["*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Cmake:
name: ${{ matrix.config.display_name }}
runs-on: ${{ matrix.config.runner }}
strategy:
fail-fast: false
matrix:
config:
-
display_name: "Windows | x86 | GCC"
runner: "windows-2022"
shell: "msys2 {0}"
msys_msystem: "MINGW32"
msys_prefix: "i686"
compiler_name: "gcc"
cmake_gen: "Ninja"
build_suffix: "x86-gcc"
-
display_name: "Windows | x64 | GCC"
runner: "windows-2022"
shell: "msys2 {0}"
msys_msystem: "UCRT64"
msys_prefix: "ucrt-x86_64"
compiler_name: "gcc"
cmake_gen: "Ninja"
build_suffix: "x64-gcc"
-
display_name: "Windows | x86 | GCC - msvcrt"
runner: "windows-2022"
shell: "msys2 {0}"
msys_msystem: "MINGW32"
msys_prefix: "i686"
compiler_name: "gcc"
cmake_gen: "Ninja"
cmake_opts: "-D RD_UCRT32=OFF"
build_suffix: "x86-gcc-msvcrt"
# -
# display_name: "Windows | x64 | GCC - msvcrt"
# runner: "windows-2022"
# shell: "msys2 {0}"
# msys_msystem: "MINGW64"
# msys_prefix: "x86_64"
# compiler_name: "gcc"
# cmake_gen: "Ninja"
# build_suffix: "x64-gcc-msvcrt"
# -
# display_name: "Windows | x86 | Clang"
# runner: "windows-2022"
# shell: "msys2 {0}"
# msys_msystem: "CLANG32"
# msys_prefix: "clang-i686"
# compiler_name: "clang"
# cmake_gen: "Ninja"
# build_suffix: "x86-clang"
-
display_name: "Windows | x64 | Clang"
runner: "windows-2022"
shell: "msys2 {0}"
msys_msystem: "CLANG64"
msys_prefix: "clang-x86_64"
compiler_name: "clang"
cmake_gen: "Ninja"
build_suffix: "x64-clang"
# -
# display_name: "Windows | x86 | MSVC"
# runner: "windows-2019" # windows-2022
# shell: "bash"
# msvc_triplet: "x86-windows"
# compiler_name: "cl"
# cmake_gen: "Visual Studio 16 2019" # Visual Studio 17 2022
# cmake_opts: "-T v141_xp -A Win32"
# build_suffix: "x86-msvc"
-
display_name: "Windows | x64 | MSVC"
runner: "windows-2022"
shell: "bash"
msvc_triplet: "x64-windows"
compiler_name: "cl"
cmake_gen: "Visual Studio 17 2022"
cmake_opts: "-A x64"
build_suffix: "x64-msvc"
-
display_name: "Linux | x64 | GCC"
runner: "ubuntu-22.04"
shell: "bash"
compiler_name: "gcc"
cmake_gen: "Ninja"
cmake_opts: "-D RD_BUILD_PORTABLE=ON"
# -
# display_name: "Linux | x64 | Clang"
# runner: "ubuntu-22.04"
# shell: "bash"
# compiler_name: "clang"
# cmake_gen: "Ninja"
# cmake_opts: "-D RD_BUILD_PORTABLE=ON"
defaults:
run:
shell: ${{ matrix.config.shell }}
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- name: Setup MSYS env
if: |
runner.os == 'Windows' &&
matrix.config.compiler_name != 'cl'
timeout-minutes: 10
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.msys_msystem }}
update: true
install: >-
mingw-w64-${{ matrix.config.msys_prefix }}-pkgconf
mingw-w64-${{ matrix.config.msys_prefix }}-${{ matrix.config.compiler_name }}
mingw-w64-${{ matrix.config.msys_prefix }}-gdb
mingw-w64-${{ matrix.config.msys_prefix }}-ninja
mingw-w64-${{ matrix.config.msys_prefix }}-cmake
mingw-w64-${{ matrix.config.msys_prefix }}-SDL2
mingw-w64-${{ matrix.config.msys_prefix }}-SDL2_net
mingw-w64-${{ matrix.config.msys_prefix }}-SDL2_mixer
mingw-w64-${{ matrix.config.msys_prefix }}-libsamplerate
git
- name: Install MSVC XP toolset
if: |
runner.name == 'windows-2022' &&
runner.arch == 'X86' &&
matrix.config.compiler_name == 'cl'
run: |
echo "Installing Microsoft.VisualStudio.Component.WinXP"
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer" modify \
--installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" \
--add Microsoft.VisualStudio.Component.WinXP \
--nocache --norestart --quiet
echo "Installation of Microsoft.VisualStudio.Component.WinXP finished"
- name: Get GitHub Action Cache url and token
if: |
runner.os == 'Windows' &&
matrix.config.compiler_name == 'cl'
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup MSVC env
if: |
runner.os == 'Windows' &&
matrix.config.compiler_name == 'cl'
run: |
cd $VCPKG_INSTALLATION_ROOT
./bootstrap-vcpkg.sh -disableMetrics
# For classic mode:
# vcpkg integrate install
# vcpkg install --triplet=${{ matrix.arch.msvc_triplet }} sdl2 sdl2-mixer[libflac,libmodplug,mpg123,opusfile] sdl2-net libsamplerate
- name: Setup Linux env
if: runner.os == 'Linux'
run: |
sudo apt-get update --fix-missing
sudo apt-get full-upgrade --fix-missing
sudo apt-get install ${{ matrix.config.compiler_name }} gdb ninja-build python3 cmake \
libsdl2-dev libsdl2-net-dev libsdl2-mixer-dev libsamplerate-dev
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure
id: configure
env:
CC: ${{ matrix.config.compiler_name }}
run: |
if [[ '${{ matrix.config.compiler_name }}' == 'cl' ]]
then
msvc_cmake_toolchain="-D CMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
fi
rev_number=$(git rev-list --count HEAD)
cmake -G "${{ matrix.config.cmake_gen }}" ${{ matrix.config.cmake_opts }} \
$msvc_cmake_toolchain \
-D RD_BUILD_VERSION_OVERWRITE="r$rev_number" \
-D RD_GIT_FORCE_HASH_SUFFIX=ON \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D RD_TEST_WITH_GDB="ON"\
-S . -B build
sha_short=$(echo ${{ github.sha }} | cut -c1-7)
echo "sha_short=$sha_short" >> $GITHUB_OUTPUT
echo "rev_number=r$rev_number" >> $GITHUB_OUTPUT
- name: Build
run: |
export MAKEFLAGS=--keep-going
cmake --build build --config RelWithDebInfo --parallel 2
- name: Test Windows
if: runner.os == 'Windows'
run: |
cd build
ctest --output-on-failure -C RelWithDebInfo
- name: Test Linux
if: runner.os == 'Linux'
env:
SDL_VIDEODRIVER: dummy
run: |
cd build
ctest --output-on-failure
- name: Install
if: |
github.repository == 'Russian-Doom/russian-doom' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
runner.os == 'Windows'
run: |
cmake --install build --config RelWithDebInfo --prefix "./build/install"
- name: Package Zip
if: |
github.repository == 'Russian-Doom/russian-doom' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: russian-doom-${{ steps.configure.outputs.rev_number }}-${{ steps.configure.outputs.sha_short }}-windows-${{ matrix.config.build_suffix }}
path: ./build/install/