Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 79 additions & 85 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,132 +21,126 @@ on:
- .gitmodules

jobs:
mac:
name: macOS amd64 AppleClang
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v7

- name: Check out submodules
shell: bash
env:
# For example: "master" (on pull requests only)
PR_TARGET_BRANCH: ${{ github.base_ref }}
# Target branch name, on pull requests only. Even if the branch comes from an external
# repo it is just the bare branch name, for example "new-feature".
PR_SOURCE_BRANCH: ${{ github.head_ref }}
# For example: "master" for a build of the 'master' branch
# Other formats exist for builds on pull requests
BUILD_SOURCE_BRANCH: ${{ github.ref_name }}
# "push" or "pull_request" (see 'on:')
EVENT_NAME: ${{ github.event_name }}
run: |
set -e
echo "Variables: PR_TARGET_BRANCH=${PR_TARGET_BRANCH} PR_SOURCE_BRANCH=${PR_SOURCE_BRANCH} BUILD_SOURCE_BRANCH=${BUILD_SOURCE_BRANCH}"
curl -fsSL https://gitlab.com/illwieckz/git-checkout-modules/raw/master/git-checkout-modules -o ~/git-checkout-modules
SYNC_ARGS=()
if [[ "$EVENT_NAME" == pull_request ]]; then
SYNC_ARGS=("--sub-ref=${PR_TARGET_BRANCH}:has=/sync" "--sub-ref=${PR_SOURCE_BRANCH}:has=/sync")
else # It is a branch build
SYNC_ARGS=("--sub-ref=${BUILD_SOURCE_BRANCH}:has=/sync")
fi
echo "${#SYNC_ARGS[@]} branch-name-based checkout arg(s): ${SYNC_ARGS[@]}"
bash ~/git-checkout-modules --update "${SYNC_ARGS[@]}" --print

- name: Build
shell: bash
run: |
set -e
set -x
cmake --version
export CFLAGS='-Wno-c++14-extensions'
export CXXFLAGS='-Wno-c++14-extensions'
cmake -Wdev -Wdeprecated -DUSE_PRECOMPILED_HEADER=0 -DUSE_WERROR=1 -DBE_VERBOSE=1 -DCMAKE_BUILD_TYPE=Release -DBUILD_DUMMY_APP=1 -DBUILD_DUMMY_GAMELOGIC=1 -DBUILD_TESTS=1 -H. -Bbuild
cmake --build build -- -j`sysctl -n hw.logicalcpu`

- name: Test
shell: bash
run: |
set -e
build/test-ttyclient -pakpath pkg -set fs_basepak daemon -set vm.cgame.type 3

linux:
build:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
runs-on: ${{ matrix.vm_image }}

strategy:
fail-fast: false
matrix:
include:
- name: Linux amd64 GCC
build_type: Release
vm_image: ubuntu-24.04
c_compiler: gcc
cxx_compiler: g++
extra_packages: ''
extra_installs: ''
toolchain_file: ''
apt_packages: ninja-build zlib1g-dev libncursesw5-dev nettle-dev libgmp-dev libcurl4-gnutls-dev libogg-dev libvorbis-dev libopusfile-dev libwebp-dev libjpeg8-dev libpng-dev libfreetype6-dev libglew-dev libopenal-dev liblua5.2-dev
- name: Linux amd64 Clang
build_type: Release
vm_image: ubuntu-24.04
c_compiler: clang
cxx_compiler: clang++
extra_packages: ''
extra_installs: ''
toolchain_file: ''
apt_packages: ninja-build zlib1g-dev libncursesw5-dev nettle-dev libgmp-dev libcurl4-gnutls-dev libogg-dev libvorbis-dev libopusfile-dev libwebp-dev libjpeg8-dev libpng-dev libfreetype6-dev libglew-dev libopenal-dev liblua5.2-dev
- name: Windows amd64 MinGW
vm_image: ubuntu-24.04
build_type: Debug
c_compiler: x86_64-w64-mingw32-gcc
cxx_compiler: x86_64-w64-mingw32-g++
extra_packages: gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
extra_installs: sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix ; sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
toolchain_file: cmake/cross-toolchain-mingw64.cmake
apt_packages: ninja-build g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
mingw_flavor: posix
cmake_toolchain: cmake/cross-toolchain-mingw64.cmake
run_test: false
- name: macOS amd64 AppleClang
vm_image: macos-15-intel
nproc_command: sysctl -n hw.logicalcpu
env_commands: export CFLAGS=-Wno-c++14-extensions CXXFLAGS=-Wno-c++14-extensions
cmake_generator: Unix Makefiles

defaults:
run:
shell: ${{ matrix.shell || 'bash' }}

steps:
- uses: actions/checkout@v7

- name: Check out submodules
# This doesn't require a custom shell, so we can run this before setting-up a shell.
shell: bash
env:
# For example: "master" (on pull requests only)
# For example: "master" (on pull requests only).
PR_TARGET_BRANCH: ${{ github.base_ref }}
# Target branch name, on pull requests only. Even if the branch comes from an external
# repo it is just the bare branch name, for example "new-feature".
PR_SOURCE_BRANCH: ${{ github.head_ref }}
# For example: "master" for a build of the 'master' branch
# Other formats exist for builds on pull requests
# For example: "master" for a build of the 'master' branch.
# Other formats exist for builds on pull requests.
BUILD_SOURCE_BRANCH: ${{ github.ref_name }}
# "push" or "pull_request" (see 'on:')
EVENT_NAME: ${{ github.event_name }}
run: |
set -e
echo "Variables: PR_TARGET_BRANCH=${PR_TARGET_BRANCH} PR_SOURCE_BRANCH=${PR_SOURCE_BRANCH} BUILD_SOURCE_BRANCH=${BUILD_SOURCE_BRANCH}"
curl -fsSL https://gitlab.com/illwieckz/git-checkout-modules/raw/master/git-checkout-modules -o ~/git-checkout-modules
set -xeuo pipefail
echo "Variables: PR_TARGET_BRANCH='${PR_TARGET_BRANCH}' PR_SOURCE_BRANCH='${PR_SOURCE_BRANCH}' BUILD_SOURCE_BRANCH='${BUILD_SOURCE_BRANCH}'"
curl -fsSL \
https://raw.githubusercontent.com/DaemonEngine/DaemonGitTools/refs/heads/master/git-checkout-modules \
-o ~/git-checkout-modules
chmod +x ~/git-checkout-modules
SYNC_ARGS=()
if [[ "$EVENT_NAME" == pull_request ]]; then
SYNC_ARGS=("--sub-ref=${PR_TARGET_BRANCH}:has=/sync" "--sub-ref=${PR_SOURCE_BRANCH}:has=/sync")
else # It is a branch build
if [[ "${EVENT_NAME}" == pull_request ]]; then
SYNC_ARGS=(
"--sub-ref=${PR_TARGET_BRANCH}:has=/sync"
"--sub-ref=${PR_SOURCE_BRANCH}:has=/sync"
)
else
# It is a branch build.
SYNC_ARGS=("--sub-ref=${BUILD_SOURCE_BRANCH}:has=/sync")
fi
echo "${#SYNC_ARGS[@]} branch-name-based checkout arg(s): ${SYNC_ARGS[@]}"
bash ~/git-checkout-modules --update "${SYNC_ARGS[@]}" --print
~/git-checkout-modules --update "${SYNC_ARGS[@]}" --print

- name: Install deps
shell: bash
- name: Setup Apt packages
env:
APT_PACKAGES: ${{ matrix.apt_packages }}
if: matrix.apt_packages != ''
run: |
set -e
set -xueo pipefail
sudo apt-get update
sudo apt-get -y -q --no-install-recommends install zlib1g-dev libncursesw5-dev nettle-dev libgmp-dev libcurl4-gnutls-dev libogg-dev libvorbis-dev libopusfile-dev libwebp-dev libjpeg8-dev libpng-dev libfreetype6-dev libglew-dev libopenal-dev liblua5.2-dev ninja-build ${{ matrix.extra_packages }}
${{ matrix.extra_installs }}
sudo apt-get -y -q --no-install-recommends install ${APT_PACKAGES}

- name: Setup Apt MinGW flavor
env:
MINGW_FLAVOR: ${{ matrix.mingw_flavor }}
if: matrix.apt_packages != '' && matrix.mingw_flavor != ''
run: |
set -xueo pipefail
sudo update-alternatives --set x86_64-w64-mingw32-gcc "/usr/bin/x86_64-w64-mingw32-gcc-${MINGW_FLAVOR}"
sudo update-alternatives --set x86_64-w64-mingw32-g++ "/usr/bin/x86_64-w64-mingw32-g++-${MINGW_FLAVOR}"

- name: Build
shell: bash
env:
ENV_COMMANDS: ${{ matrix.env_commands }}
BUILD_TYPE: ${{ matrix.build_type || 'Release' }}
NPROC_COMMAND: ${{ matrix.nproc_command || 'nproc' }}
C_COMPILER: ${{ matrix.c_compiler || 'cc' }}
CXX_COMPILER: ${{ matrix.cxx_compiler || 'c++' }}
CMAKE_GENERATOR: ${{ matrix.cmake_generator || 'Ninja' }}
CMAKE_TOOLCHAIN: ${{ matrix.cmake_toolchain }}
run: |
set -e
set -xueo pipefail
${ENV_COMMANDS}
parallelism="$(${NPROC_COMMAND})"
echo "Build parallelism: ${parallelism}"
export CMAKE_BUILD_PARALLEL_LEVEL="${parallelism}"
cmake --version
cmake -G "Ninja" -Wdev -Wdeprecated -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_file }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DUSE_PRECOMPILED_HEADER=0 -DUSE_WERROR=1 -DBE_VERBOSE=1 -DBUILD_DUMMY_APP=1 -DBUILD_DUMMY_GAMELOGIC=1 -DBUILD_TESTS=1 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -H. -Bbuild
cmake --build build -- -j`nproc`
cmake -S. -Bbuild \
-G"${CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-Wdev -Wdeprecated \
-DCMAKE_TOOLCHAIN_FILE="${CMAKE_TOOLCHAIN}" \
-DCMAKE_C_COMPILER="${C_COMPILER}" -DCMAKE_CXX_COMPILER="${CXX_COMPILER}" \
-DUSE_PRECOMPILED_HEADER=OFF -DUSE_WERROR=ON -DBE_VERBOSE=ON \
-DBUILD_DUMMY_APP=ON -DBUILD_DUMMY_GAMELOGIC=ON -DBUILD_TESTS=ON
cmake --build build

- name: Test
if: matrix.toolchain_file == ''
shell: bash
if: matrix.run_test != false
run: |
set -e
SDL_VIDEODRIVER=offscreen ALSOFT_DRIVERS=null build/test-client -pakpath pkg -set fs_basepak daemon -set vm.cgame.type 3
set -xueo pipefail
export SDL_VIDEODRIVER=offscreen ALSOFT_DRIVERS=null
build/test-ttyclient -pakpath pkg -set fs_basepak daemon -set vm.cgame.type 3
Loading