-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (136 loc) · 5.24 KB
/
ci.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "dev" ]
env:
DISPLAY: ":99"
MESA_GL_VERSION_OVERRIDE: "4.6"
MESA_GLSL_VERSION_OVERRIDE: "460"
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- { name: Windows VS2022, os: windows-latest, flags: -G"Visual Studio 17 2022" }
- { name: Windows Clang, os: windows-latest, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
- { name: Windows GCC, os: windows-latest, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ }
- { name: Linux Clang, os: ubuntu-latest, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
- { name: Linux GCC, os: ubuntu-latest, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ }
config:
- { name: Static, flags: -DBUILD_SHARED_LIBS=OFF }
- { name: Shared, flags: -DBUILD_SHARED_LIBS=ON }
type:
- { name: Release, flags: -DCMAKE_BUILD_TYPE=Release }
- { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: latest
ninjaVersion: latest
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libgl1-mesa-dev
fi
- name: Configure
run: cmake -S . -B build ${{ matrix.platform.flags }} ${{ matrix.config.flags }} ${{ matrix.type.flags }}
- name: Build
run: cmake --build build --config ${{ matrix.type.name }} --parallel
clang-format:
name: clang-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Format code
run: cmake -P cmake/run_clang_format.cmake
- name: Check formatting
run: git diff --exit-code
clang-tidy:
name: clang-tidy ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- { name: Windows, os: windows-latest }
- { name: Linux, os: ubuntu-latest }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: latest
ninjaVersion: latest
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libgl1-mesa-dev
fi
- name: Configure
run: cmake -S . -B build -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Prepare compile_commands.json
run: sed -i -E 's|(-I)([^ ]*third_party[^ ]*include\b)|-isystem \2|g' build/compile_commands.json
- name: Analyze code
run: cmake -DPROJECT_BINARY_DIR=build -P cmake/run_clang_tidy.cmake
unit-tests:
name: unit-tests ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- { name: Windows, os: windows-latest, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DNOX_ENABLE_COVERAGE=ON -DNOX_BUILD_TESTS=ON }
- { name: Linux, os: ubuntu-latest, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DNOX_ENABLE_COVERAGE=ON -DNOX_BUILD_TESTS=ON }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: latest
ninjaVersion: latest
- name: Install dependencies
run: |
set -e
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install xorg-dev libxrandr-dev libxcursor-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev mesa-utils xvfb fluxbox gcovr
fi
if [ "$RUNNER_OS" == "Windows" ]; then
pip install gcovr
fi
- name: Create Display Linux
if: runner.os == 'Linux'
run: |
set -e
Xvfb $DISPLAY -screen 0 800x600x24 &
sleep 5
fluxbox > /dev/null 2>&1 &
sleep 5
- name: Install Windows Mesa3D
uses: ssciwr/setup-mesa-dist-win@v2
if: runner.os == 'Windows'
with:
build-type: 'release-msvc'
- name: Configure
run: cmake -S . -B build ${{ matrix.platform.flags }}
- name: Build
run: |
cmake --build build --config Debug --target run-unit-tests
gcovr --root $GITHUB_WORKSPACE -x build/coverage.out -s -f 'src/.*'
- name: Upload coverage report to Coveralls
uses: coverallsapp/github-action@v2
with:
file: ./build/coverage.out
base-path: ${{ github.workspace }}