-
Notifications
You must be signed in to change notification settings - Fork 58
112 lines (98 loc) · 4.28 KB
/
test.yml
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
name: Test
# This is derived from the standard CMake template for github actions.
# For more details on the settings used, have a look at the template in the marketplace
# Only pushes and PRs against protected branches are built
on:
push:
branches:
- master
- ramses-28
pull_request:
branches:
- master
- ramses-28
jobs:
build:
runs-on: ${{ matrix.os }}
# Strategy: builds on oldest and newest Ubuntu and on Windows
# Oldest -> because that's what is used to build backwards compatible packages (see release.yaml)
# Newest -> so that we can test with latest tools (clang-tidy) and use recent drivers/packages
strategy:
matrix:
target-platform: [host-os]
os: [ubuntu-20.04, ubuntu-22.04, windows-2022, macos-12]
type: [Debug, Release]
compiler: [default]
include:
- target-platform: iphoneos
os: macos-12
type: Debug
- target-platform: iphonesimulator
os: macos-12
type: Debug
# Test with Clang too
- os: ubuntu-20.04
type: Debug
compiler: clang
# on Windows we skip Debug because otherwise the hosted runner runs out of space
exclude:
- os: windows-2022
type: Debug
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install GL/X11 packages for rendering (Linux only)
run: |
sudo apt-get update && sudo apt-get -y --no-install-recommends install \
libgles2-mesa-dev \
libx11-dev
if: ${{ contains(matrix.os, 'ubuntu') }}
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake (${{matrix.os}} ${{matrix.compiler}} ${{matrix.type}} ${{matrix.target-platform}})
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake_args="-DCMAKE_BUILD_TYPE=${{ matrix.type }}"
if [[ "${{matrix.compiler}}" == "clang"* ]]; then
export CC=clang-12
export CXX=clang++-12
cmake_args+=" -DCMAKE_EXPORT_COMPILE_COMMANDS=1"
cmake_args+=" -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12"
cmake_args+=" -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/toolchain/Linux_X86_64_llvm.toolchain"
fi
if [[ "${{matrix.os}}" == "windows"* ]]; then
# This is needed because on the Windows Server 2019 build nodes of Github, the Perl installation
# exposes its libraries on the path and messes up CMake builds
echo "Path before: $PATH"
export PATH=$(echo "$PATH" | sed -e 's/:\/c\/Strawberry\/c\/bin//')
export PATH=$(echo "$PATH" | sed -e 's/:\/c\/Strawberry\/perl\/site\/bin//')
export PATH=$(echo "$PATH" | sed -e 's/:\/c\/Strawberry\/perl\/bin//')
echo "Path after: $PATH"
# Limiting CMAKE_CONFIGURATION_TYPES for MSVC improves build time and reduces diskspace usage
cmake_args+=" -DCMAKE_CONFIGURATION_TYPES=${{ matrix.type }}"
fi
if [[ "${{matrix.os}}" == "macos"* ]]; then
cmake_args+=" -Dramses-sdk_ENABLE_FLATBUFFERS_GENERATION=OFF"
cmake_args+=" -Dramses-sdk_ENABLE_DEFAULT_WINDOW_TYPE=OFF"
cmake_args+=" -Dramses-sdk_BUILD_FULL_SHARED_LIB=OFF"
cmake_args+=" -Dramses-sdk_BUILD_HEADLESS_SHARED_LIB=ON"
fi
if [[ "${{matrix.target-platform}}" == "iphone"* ]]; then
cmake_args+=" -GXcode"
cmake_args+=" -DCMAKE_OSX_SYSROOT=${{ matrix.target-platform }}"
cmake_args+=" -DCMAKE_SYSTEM_NAME=iOS"
cmake_args+=" -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO"
fi
cmake $GITHUB_WORKSPACE ${cmake_args}
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.type }}
- name: Run unit tests (exclude rendering tests)
working-directory: ${{runner.workspace}}/build
shell: bash
run: ctest -C ${{ matrix.type }} --exclude-regex '.*RNDSANDWICHTEST'
# Tests cannot be executed on iOS, will only be executed if not cross-compiling for a different platform
if: ${{ matrix.target-platform == 'host-os' }}