Files
Dreierpack-Manager/.github/workflows/ci.yml
T

110 lines
4.9 KiB
YAML

# SPDX-License-Identifier: GPL-3.0-only
name: Build without game data
on:
push:
branches: [main, release/1.0, poc/1.1-international]
pull_request:
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
platform: linux-x64
- runner: windows-2022
platform: windows-x64
- runner: macos-15
platform: macos-arm64
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
env:
SDL_VIDEODRIVER: dummy
SDL_AUDIODRIVER: dummy
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y build-essential git cmake ninja-build pkg-config libgtk-3-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxfixes-dev libxss-dev libasound2-dev libpulse-dev libgl1-mesa-dev libudev-dev
# Audit the selected tree shipped in source archives. Full repository
# history auditing is available separately with --history.
- name: Verify source export
run: |
python3 tools/public_release/check_public_tree.py --root .
python3 tools/ci/test_build_runnable_tests.py
python3 tools/package/test_verify_ci_release.py
python3 -m unittest discover -s tools/poc -p "test_*.py"
- name: Set up MSVC x64
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@a102174a2b586eec2ea151a69e6fd14404a8ce7c # v1.13.0
with:
arch: x64
- name: Configure Windows x64
if: runner.os == 'Windows'
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBMH_DATA= -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Configure Linux
if: runner.os == 'Linux'
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBMH_DATA= -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSDL_ALSA=ON -DSDL_PULSEAUDIO=ON -DSDL_X11=ON
- name: Verify Linux audio and video backends
if: runner.os == 'Linux'
shell: python
run: |
import pathlib, re
required = ['SDL_AUDIO_DRIVER_ALSA', 'SDL_AUDIO_DRIVER_PULSEAUDIO', 'SDL_VIDEO_DRIVER_X11']
headers = list(pathlib.Path('build/_deps/sdl2-build').rglob('SDL_config.h'))
assert any(all(re.search(r'^#define\s+' + macro + r'\s+1\s*$', p.read_text(), re.M) for macro in required) for p in headers), 'ALSA/PulseAudio/X11 were not configured into SDL'
- name: Configure macOS arm64
if: runner.os == 'macOS'
run: |
test "$(uname -m)" = arm64
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DBMH_DATA= -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Build products and every runnable test
run: python3 tools/ci/build_runnable_tests.py --build build --config Release --parallel 2
- name: Run synthetic tests and report data tests as skipped
run: ctest --test-dir build -C Release --output-on-failure --output-junit test-results.xml
- name: Verify product versions
shell: python
run: |
import pathlib, subprocess, sys
build = pathlib.Path('build').resolve()
version = (build / 'product-version.txt').read_text().strip()
suffix = '.exe' if sys.platform == 'win32' else ''
cli = subprocess.run([str(build / ('openbmh_cli' + suffix)), '--version'], check=True, capture_output=True, text=True)
assert cli.stdout.strip() == 'OpenBMH console ' + version
subprocess.run([str(build / ('OpenBMH' + suffix)), '--version'], check=True)
- name: Package products and licenses
run: python3 tools/package/make_package.py --build build --out dist --platform ${{ matrix.platform }}
- name: Package corresponding source and pinned dependencies
if: runner.os == 'Linux'
run: python3 tools/package/make_source_package.py --source . --build build --out source-dist
- name: Upload corresponding source
if: runner.os == 'Linux'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: OpenBMH-source
path: source-dist/*.zip
if-no-files-found: error
- name: Upload package
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: OpenBMH-${{ matrix.platform }}
path: dist/*.zip
if-no-files-found: error
- name: Upload test report
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: tests-${{ matrix.platform }}
path: build/test-results.xml
if-no-files-found: warn