-
Notifications
You must be signed in to change notification settings - Fork 40
297 lines (244 loc) · 7.98 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
name: 'main'
on:
push:
pull_request:
jobs:
linux-gcc:
name: ubuntu-gcc
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
vendored_dependencies: [true, false]
defaults:
run:
shell: bash
steps:
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt install -y g++-9 build-essential pkg-config cmake
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup Python Packages
run: pip3 install orderedmultidict
- name: Git pull
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
if: ${{ matrix.vendored_dependencies }}
- name: Git pull
uses: actions/checkout@v3
if: ${{ !matrix.vendored_dependencies }}
# Fetch tags for CMakeLists version check
# https://github.com/actions/checkout/issues/701
- name: Git fetch tags
run: git fetch --tags origin
- name: Use ccache
uses: hendrikmuhs/[email protected]
with:
key: linux-gcc-cache
- name: Configure shell
run: |
echo 'CC=gcc-9' >> $GITHUB_ENV
echo 'CXX=g++-9' >> $GITHUB_ENV
echo 'PREFIX=/tmp/uhdm-install' >> $GITHUB_ENV
echo 'PATH=/usr/lib/ccache:'"$PATH" >> $GITHUB_ENV
- name: Install vendored dependencies
run: |
git clone --depth 1 https://github.com/google/googletest.git
cd googletest && cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON . && cmake --build build && sudo cmake --install build
git clone --depth 1 --branch v1.0.0 https://github.com/capnproto/capnproto.git
cd capnproto && cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON . && cmake --build build && sudo cmake --install build
if: ${{ !matrix.vendored_dependencies }}
- name: Configure cmake options
run: |
echo 'ADDITIONAL_CMAKE_OPTIONS=-DUHDM_USE_HOST_GTEST=ON -DUHDM_USE_HOST_CAPNP=ON' >> $GITHUB_ENV
if: ${{ !matrix.vendored_dependencies }}
- name: Ensure build/test env is setup
run: |
env
which cmake && cmake --version
which make && make --version
which python && python --version
which $CC && $CC --version
which $CXX && $CXX --version
- name: Build & Test
run: |
make release
make test
make install
make test_install
make test_install_pkgconfig
if: ${{ matrix.vendored_dependencies }}
- name: Build & Test (Shared)
run: |
make release-shared UHDM_WITH_PYTHON=ON
make test-shared UHDM_WITH_PYTHON=ON
make install-shared
make test_install
if: ${{ !matrix.vendored_dependencies }}
macos:
name: macos-gcc
runs-on: macos-12
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: x64
- name: Setup Python Packages
run: pip3 install orderedmultidict
- name: Git pull
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Use ccache
uses: hendrikmuhs/[email protected]
with:
key: macos-cache
- name: Configure shell
run: |
echo "PATH=$(brew --prefix)/opt/ccache/libexec:$PATH" >> $GITHUB_ENV
echo 'ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=${pythonLocation}' >> $GITHUB_ENV
- name: Build & Test
run: |
env
which cmake && cmake --version
which make && make --version
which python && python --version
which $CC && $CC --version
which $CXX && $CXX --version
make release
make test
msys2-gcc:
name: msys2-gcc
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: x64
- name: Setup Python Packages
shell: cmd
run: pip3 install orderedmultidict
- name: Setup Msys2
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: make cmake ninja gcc python git
env:
MSYS2_PATH_TYPE: inherit
- name: Git pull
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Configure shell
run: |
export Py3_ROOT_DIR=`cygpath -u $pythonLocation`
echo 'CC=gcc' >> $GITHUB_ENV
echo 'CXX=g++' >> $GITHUB_ENV
echo 'PREFIX=$PWD/install' >> $GITHUB_ENV
echo 'CMAKE_GENERATOR=Ninja' >> $GITHUB_ENV
echo 'NO_TCMALLOC=On' >> $GITHUB_ENV
echo 'TEST_TMPDIR=C:\temp' >> $GITHUB_ENV
echo "Py3_ROOT_DIR=$Py3_ROOT_DIR" >> $GITHUB_ENV
echo "ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=$Py3_ROOT_DIR" >> $GITHUB_ENV
echo "$Py3_ROOT_DIR" >> $GITHUB_PATH
- name: Build & Test
run: |
export PATH=$Py3_ROOT_DIR:$PATH
env
where cmake && cmake --version
where make && make --version
where ninja && ninja --version
where python && python --version
where $CC && $CC --version
where $CXX && $CXX --version
make release
make test
make install
make test_install
windows-msvc:
name: windows-cl
runs-on: windows-2022
defaults:
run:
shell: cmd
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: x64
- name: Install Core Dependencies
run: |
choco install -y make
pip3 install orderedmultidict
- run: git config --global core.autocrlf input
shell: bash
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Build & Test
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set CC=cl
set CXX=cl
set PREFIX=%GITHUB_WORKSPACE%\install
set CMAKE_GENERATOR=Ninja
set NO_TCMALLOC=On
set CPU_CORES=%NUMBER_OF_PROCESSORS%
set MAKE_DIR=C:\make\bin
set TEST_TMPDIR=C:\temp
set ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=%pythonLocation%
set PATH=%pythonLocation%;%MAKE_DIR%;%PATH%
set
where cmake && cmake --version
where make && make --version
where ninja && ninja --version
where python && python --version
make release
if %errorlevel% neq 0 exit /b %errorlevel%
make test
if %errorlevel% neq 0 exit /b %errorlevel%
make install
if %errorlevel% neq 0 exit /b %errorlevel%
make test_install
release-tagging:
name: Version Tagging
runs-on: ubuntu-20.04
if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')}}
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Tag with CMake version if not already.
run: |
git config --local user.name "Development Bot"
git config --local user.email "[email protected]"
# We want to tag whenever the cmake version changes. So extract the
# hash of when the current version was entered.
read TAG_HASH TAG_VERSION <<<$(git annotate -l CMakeLists.txt | sed 's/\(^[0-9A-Fa-f]\+\).*project(UHDM VERSION \([0-9]\+\.[0-9]\+\).*/\1 \2/p;d')
echo "UHDM Version v${TAG_VERSION} at hash ${TAG_HASH}"
# If this is the first time we see this tag: apply.
if [ -z "$(git tag -l "v${TAG_VERSION}")" ]; then
git tag -a "v${TAG_VERSION}" ${TAG_HASH} -m "Update to v${TAG_VERSION}"
git push origin "v${TAG_VERSION}"
else
echo "Tag already applied"
fi