Skip to content

feat: run the game.cpp and tifa.cpp engines as external processes #10

feat: run the game.cpp and tifa.cpp engines as external processes

feat: run the game.cpp and tifa.cpp engines as external processes #10

Workflow file for this run

# Builds and tests otter on Linux and Windows.
#
# The dependency tree comes from vcpkg through the manifest in scripts/vcpkg-manifest, with the
# in-repo ports in scripts/vcpkg-ports searched before the shared overlay submodule.
name: ci
on:
push:
# Runs on the trunk and on the integration branches, because work remains on an integration
# branch for extended periods. The trunk is main, as in wolf; a trigger restricted to a branch
# absent from the repository never runs.
branches: [main, "analysis-**"]
pull_request:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
triplet: x64-linux
- os: windows-2022
triplet: x64-windows
runs-on: ${{ matrix.os }}
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install build tools
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build python3
# The build generates the model fixtures if a Python interpreter with onnx is present.
python3 -m pip install --user --break-system-packages onnx numpy
- name: Install the Python build tools
if: runner.os == 'Windows'
# The build generates the model fixtures if a Python interpreter with onnx is present, and
# the script tests read the declarations. Both jobs therefore need the same packages, and
# the step also proves the interpreter the test suite looks for is the one on the path.
run: |
python -m pip install onnx numpy
python --version
- name: Set up the MSVC environment
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Set up vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: ${{ runner.temp }}/vcpkg
vcpkgGitCommitId: 1fddddc280dfed63956e15ef74f4321bc6a219c9
runVcpkgInstall: false
- name: Install dependencies
shell: bash
run: |
"${{ runner.temp }}/vcpkg/vcpkg" install \
--x-manifest-root=scripts/vcpkg-manifest \
--x-install-root=build/vcpkg_installed \
--x-feature=onnx --x-feature=tests
- name: Generate the test packages
# The packages the loading and runtime tests read are data, not sources: the generator holds
# their contents, and the check proves the prepared directory matches it before any test
# reads it. Without this step the two tests would report themselves as skipped and the suite
# would shrink without failing.
shell: bash
run: |
cmake -DOTTER_TEST_PACKAGES_OUTPUT="$PWD/build/test-packages" \
-P scripts/make-test-packages.cmake
cmake -DOTTER_TEST_PACKAGES_CHECK="$PWD/build/test-packages" \
-P scripts/make-test-packages.cmake
- name: Configure
shell: bash
run: |
# The fixture generation and the script tests need the interpreter the packages were
# installed into. The probe in CMake could find another one, and an interpreter without
# onnx disables the four model tests instead of failing them, so the path is stated here
# rather than left to the probe.
PYTHON="$(command -v python3 || command -v python)"
cmake -S . -B build/cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_INSTALLED_DIR="$PWD/build/vcpkg_installed" \
-DVCPKG_MANIFEST_MODE=OFF \
-DPython3_EXECUTABLE="$PYTHON" \
-DOTTER_BUILD_TESTS=ON \
-DOTTER_TEST_PACKAGES_SOURCE="$PWD/build/test-packages"
- name: Build
run: cmake --build build/cmake
- name: Require the model tests
# An interpreter without onnx disables the four model tests rather than failing them, and
# ctest then passes while none of them ran. They are required here, because a suite that
# shrinks without a word is worse than one that fails.
shell: bash
run: |
listed="$(ctest --test-dir build/cmake -N)"
for test in test_Rmvpe test_Game test_Hfa test_Tifa; do
echo "$listed" | grep -qE "^[[:space:]]*Test +#[0-9]+: ${test}\$" || {
echo "::error::${test} is not an enabled test, so an interpreter without onnx was found"
exit 1
}
done
- name: Test
# Data-dependent tests exit with the skip status when the data they need is absent, which is
# why the model fixtures are generated and the test packages are prepared above. The script
# tests run here too: ctest carries them as test_CheckDeclarations, so running them again
# from this file would only report the same verdict twice.
run: ctest --test-dir build/cmake --output-on-failure
- name: Check the installed CMake package
# The test suite exercises the code, and this step exercises the installed package that a
# host consumes. The install rules write its targets, include directories and plugin
# directory, and only a consumer project reads them.
shell: bash
run: |
cmake --install build/cmake --prefix build/install
cmake -S .github/consumer -B build/consumer -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_INSTALLED_DIR="$PWD/build/vcpkg_installed" \
-DVCPKG_MANIFEST_MODE=OFF \
-DCMAKE_PREFIX_PATH="$PWD/build/install"
cmake --build build/consumer