generated from florianvazelle/cpp-template
-
Notifications
You must be signed in to change notification settings - Fork 5
259 lines (220 loc) · 8.34 KB
/
main.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: build
on: [push, pull_request]
env:
# Vulkan version
UNIX_VULKAN_VERSION: 1.2.198.1
WINDOWS_VULKAN_VERSION: 1.2.198.1
# Conan cache environment variables
CONAN_SYSREQUIRES_MODE: enabled
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"
# Cache
PIP_CACHE_DIR: "${{ github.workspace }}/pip-cache"
CHOCO_CACHE_DIR: "${{ github.workspace }}/choco-cache"
CPM_SOURCE_CACHE: "${{ github.workspace }}/cpm_modules"
jobs:
linux:
strategy:
fail-fast: false
matrix:
include:
- compiler: g++-10
package: g++-10
- compiler: g++-11
package: g++-11
- compiler: g++-12
package: g++-12
- compiler: clang++-15
package: clang-15
- compiler: clang++-16
package: clang-16
- compiler: clang++-17
package: clang-17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v3
env:
cache-name: cache-conan-pip-chocolatey-modules
with:
path: |
${{ env.CONAN_USER_HOME }}
${{ env.PIP_CACHE_DIR }}
${{ env.CHOCO_CACHE_DIR }}
${{ env.CPM_SOURCE_CACHE }}
key: ubuntu-${{ hashFiles('conanfile.txt') }} }}
- name: Install ${{ matrix.package }}
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.package }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install ninja-build cmake doxygen
ninja --version
cmake --version
gcc --version
clang --version
- name: Install Conan
run: |
pip -VV
pip install --upgrade pip setuptools wheel conan
- name: Install Ubuntu Dependencies
run: |
sudo apt-get update
sudo apt-get install freeglut3-dev \
libxi-dev libxinerama-dev libxcursor-dev xorg-dev \
libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev \
libxcb-render-util0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev \
libxcb-sync-dev libxcb-xfixes0-dev libx11-xcb-dev libxcb-dri3-dev libxcb-util-dev
- name: Install Vulkan SDK
run: |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-$UNIX_VULKAN_VERSION-jammy.list http://packages.lunarg.com/vulkan/$UNIX_VULKAN_VERSION/lunarg-vulkan-$UNIX_VULKAN_VERSION-jammy.list
sudo apt update
sudo apt install -f vulkan-sdk
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{ runner.workspace }}/build ${{ runner.workspace }}/instdir
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{ runner.workspace }}/build
env:
CXX: ${{ matrix.compiler }}
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
cmake \
$GITHUB_WORKSPACE \
-DBUILD_TESTING=ON -DBUILD_DOCS=ON -DINSTALL_APPS=ON \
-DCMAKE_INSTALL_PREFIX="${{ runner.workspace }}/instdir"
- name: Build
working-directory: ${{ runner.workspace }}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config Release
- name: Run tests
working-directory: ${{ runner.workspace }}/build
env:
CTEST_OUTPUT_ON_FAILURE: 1
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --timeout 10 -C Release -j4
- name: Install Strip
working-directory: ${{ runner.workspace }}/build
shell: bash
run: cmake --install . --strip
- name: Upload
uses: actions/upload-artifact@v4
with:
path: ${{ runner.workspace }}/instdir
name: ubuntu-${{ matrix.compiler }}
windows:
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-2016]
toolset: [clang-cl, default, v141]
include:
- toolset: clang-cl
toolset_option: -T"ClangCl"
- toolset: v141
toolset_option: -T"v141"
exclude:
- os: windows-2016
toolset: clang-cl
- os: windows-2016
toolset: v141
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v3
env:
cache-name: cache-conan-pip-chocolatey-modules
with:
path: |
${{ env.CONAN_USER_HOME }}
${{ env.PIP_CACHE_DIR }}
${{ env.CHOCO_CACHE_DIR }}
${{ env.CPM_SOURCE_CACHE }}
key: windows-${{ hashFiles('conanfile.txt') }} }}
- name: Install Build Dependencies
run: |
choco config set cacheLocation ${{ env.CHOCO_CACHE_DIR }}
choco install ninja cmake
ninja --version
cmake --version
- name: Install Conan
run: |
python -c "import sys; print(sys.version)"
python -m pip install --upgrade pip
pip install conan
- name: Download Vulkan SDK
run: Invoke-WebRequest "https://sdk.lunarg.com/sdk/download/$Env:WINDOWS_VULKAN_VERSION/windows/VulkanSDK-$Env:WINDOWS_VULKAN_VERSION-Installer.exe" -OutFile VulkanSDK.exe -v
- name: Install Vulkan SDK
run: .\VulkanSDK.exe --accept-licenses --default-answer --confirm-command install
shell: cmd
- name: Create Build Environment
run: cmake -E make_directory ${{ runner.workspace }}/build ${{ runner.workspace }}/instdir
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
env:
CXX: ${{ matrix.compiler }}
VULKAN_SDK: "C:\\VulkanSDK\\${{ env.WINDOWS_VULKAN_VERSION }}"
run: |
cmake \
$GITHUB_WORKSPACE \
-DBUILD_TESTING=ON -DBUILD_DOCS=ON -DINSTALL_APPS=ON \
-DCMAKE_INSTALL_PREFIX="${{ runner.workspace }}/instdir"
- name: Build
working-directory: ${{ runner.workspace }}/build
shell: bash
run: cmake --build . --config Release
env:
VULKAN_SDK: "C:\\VulkanSDK\\${{ env.WINDOWS_VULKAN_VERSION }}"
- name: Run tests
working-directory: ${{ runner.workspace }}/build
env:
CTEST_OUTPUT_ON_FAILURE: 1
VULKAN_SDK: "C:\\VulkanSDK\\${{ env.WINDOWS_VULKAN_VERSION }}"
run: ctest --timeout 10 -C Release -j4
- name: Install Strip
working-directory: ${{ runner.workspace }}/build
shell: bash
run: cmake --install . --strip
env:
VULKAN_SDK: "C:\\VulkanSDK\\${{ env.WINDOWS_VULKAN_VERSION }}"
- name: Upload
uses: actions/upload-artifact@v4
with:
path: ${{ runner.workspace }}/instdir
name: windows-${{ matrix.toolset }}
docs:
name: Publish documentation
runs-on: macos-latest
needs: linux
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ubuntu-g++
path: ${{ runner.workspace }}
- name: Display structure of downloaded files
working-directory: ${{ runner.workspace }}
run: ls -R
- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ runner.workspace }}/docs/doxygen/html