Repository navigation
135 lines (122 loc) · 5.77 KB
/
Copy pathci.yml
File metadata and controls
135 lines (122 loc) · 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# 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