-
Notifications
You must be signed in to change notification settings - Fork 21
367 lines (313 loc) · 11.3 KB
/
build-multiplatform.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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the Common Development
# and Distribution License Version 1.0 (the "License").
#
# You can obtain a copy of the license at
# http://www.opensource.org/licenses/CDDL-1.0. See the License for the
# specific language governing permissions and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each file and
# include the License file in a prominent location with the name LICENSE.CDDL.
# If applicable, add the following below this CDDL HEADER, with the fields
# enclosed by brackets "[]" replaced with your own identifying information:
#
# Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
#
# CDDL HEADER END
#
#
# Copyright (c) 2013--2021, Regents of the University of Minnesota.
# All rights reserved.
#
# Contributors:
# Richard Berger
# Christoph Junghans
# Ryan S. Elliott
# Alexander Stukowski
# Daniel S. Karls
#
# Release: This file is part of the kim-api-2.3.0 package.
#
name: Build
# Run when pushing to all branches other than 'coverity_scan'
on:
push:
branches-ignore:
- 'coverity_scan'
pull_request:
workflow_dispatch: # Trigger workflow manually through Github API, Github CLI, or Github Web-UI
jobs:
macos-debug:
strategy:
fail-fast: false
matrix:
os: [macos-13-large, macos-14-large]
include:
- os: macos-13-large
DISTRO: macos_ventura
job_name: macOS Ventura 13 (debug)
- os: macos-14-large
DISTRO: macos_sonoma
job_name: macOS Sonoma 14 (debug)
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
env:
DISTRO: ${{ matrix.DISTRO }}
CMAKE_BUILD_TYPE: Debug
CCACHE_DIR: /Users/runner/.ccache/
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Initialize ccache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.DISTRO }}-ccache-${{ github.sha }}
restore-keys: |
${{ env.DISTRO }}-ccache
- name: Ensure ccache dir exists
run: |
if [ ! -d ${{ env.CCACHE_DIR }} ]; then \
echo "Could not find CCACHE_DIR ${{ env.CCACHE_DIR }}" \
&& echo "Creating ${{ env.CCACHE_DIR }}" \
&& mkdir -p ${{ env.CCACHE_DIR }}; \
else \
echo "Found CCACHE_DIR ${{ env.CCACHE_DIR }}" \
&& ls -lha ${{ env.CCACHE_DIR }}; \
fi
- name: Install ccache via homebrew
run: brew install ccache
- name: Build KIM API, run tests
run: |
export PATH="/usr/local/opt/ccache/libexec:$PATH"
export CXX17=true
export CXX=g++-9
export CC=gcc-9
export FC=gfortran-9
env
./scripts/ci-build-and-test
linux-debug-sanitize:
strategy:
fail-fast: false
matrix:
os: [fedora, openSUSE, ubuntu, debian]
include:
- os: fedora
job_name: Fedora (debug & sanitize)
env:
DISTRO: fedora
CMAKE_BUILD_TYPE: Debug
SANITIZE: true
CXX17: true
CCACHE_DIR: /home/runner/kim-ccache/
WORK_DIR: /home/runner/kim-work/
- os: openSUSE
job_name: openSUSE (debug, IWYU, sanitize & LTO)
env:
DISTRO: openSUSE
CMAKE_BUILD_TYPE: Debug
IWYU: true
SANITIZE: true
CXX17: true
CXXFLAGS: "-flto=auto"
CFLAGS: "-flto=auto"
FFLAGS: "-flto=auto"
CCACHE_DIR: /home/runner/kim-ccache/
WORK_DIR: /home/runner/kim-work/
- os: ubuntu
job_name: Ubuntu (debug, sanitize, & coverage)
env:
DISTRO: ubuntu
CMAKE_BUILD_TYPE: Debug
SANITIZE: true
COVERAGE: true
CXX17: true
CCACHE_DIR: /home/runner/kim-ccache/
WORK_DIR: /home/runner/kim-work/
- os: debian
job_name: Debian (debug & sanitize)
env:
DISTRO: debian
CMAKE_BUILD_TYPE: Debug
SANITIZE: true
CXX17: true
CCACHE_DIR: /home/runner/kim-ccache/
WORK_DIR: /home/runner/kim-work/
name: ${{ matrix.job_name }}
runs-on:
ubuntu-latest
env: ${{ matrix.env }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Initialize ccache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.DISTRO }}-ccache-${{ github.sha }}
restore-keys: |
${{ env.DISTRO }}-ccache
- name: Ensure ccache dir exists
run: |
if [ ! -d ${{ env.CCACHE_DIR }} ]; then \
echo "Could not find CCACHE_DIR ${{ env.CCACHE_DIR }}" \
&& echo "Creating ${{ env.CCACHE_DIR }}" \
&& mkdir -p ${{ env.CCACHE_DIR }}; \
else \
echo "Found CCACHE_DIR ${{ env.CCACHE_DIR }}" \
&& ls -lha ${{ env.CCACHE_DIR }}; \
fi
- name: Ensure work dir exists
run: |
if [ ! -d ${{ env.WORK_DIR }} ]; then mkdir -p ${{ env.WORK_DIR }}; fi
- name: Build docker, build KIM API, run tests
run: |
cd ${{ env.WORK_DIR }}
env
${GITHUB_WORKSPACE}/scripts/ci-docker-build-and-run \
"${GITHUB_WORKSPACE}" \
"${{ env.DISTRO }}" \
"${GITHUB_REPOSITORY}:${{ env.DISTRO }}" \
"${{ env.CCACHE_DIR }}"
# Ubuntu where we want to use cmake 3.10 specifically has to be separate
# because we use a separate gha cache directory for the cmake tarball that is
# downloaded.
ubuntu-cmake310-debug:
name: Ubuntu [email protected] (debug)
runs-on:
ubuntu-latest
env:
DISTRO: ubuntu_cmake310
CMAKE_BUILD_TYPE: Debug
CCACHE_DIR: /home/runner/kim-ccache/
CMAKE_DIR: /home/runner/kim-cmake310/
WORK_DIR: /home/runner/kim-work/
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Initialize cmake 3.10 binaries cache
id: cmake-cache
uses: actions/cache@v2
with:
path: ${{ env.CMAKE_DIR }}
key: ${{ env.DISTRO }}-cmake-${{ github.sha }}
restore-keys: |
${{ env.DISTRO }}-cmake
- name: Ensure cmake dir exists
run: |
if [ ! -d ${{ env.CMAKE_DIR }} ]; then \
echo "Could not find CMAKE_DIR ${{ env.CMAKE_DIR }}" \
&& echo "Creating ${{ env.CMAKE_DIR }}" \
&& mkdir -p ${{ env.CMAKE_DIR }}; \
else \
echo "Found CMAKE_DIR ${{ env.CMAKE_DIR }}" \
&& ls -lha ${{ env.CMAKE_DIR }}; \
fi
# NOTE: The archive downloaded *must* end in .tar.gz and be decompressable via
# `tar -xzf`
- name: Download cmake 3.10.3 binaries, if necessary
if: steps.cmake-cache.outputs.cache-hit != 'true'
run: |
export CMAKE_VER=3.10.3
export CMAKE_PKG_NAME=cmake-${CMAKE_VER}-Linux-x86_64
export CMAKE_ARCHIVE_NAME=${CMAKE_PKG_NAME}.tar.gz
cd ${CMAKE_DIR}
wget http://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/${CMAKE_ARCHIVE_NAME} -O ${CMAKE_ARCHIVE_NAME}
- name: Initialize ccache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.DISTRO }}-ccache-${{ github.sha }}
restore-keys: |
${{ env.DISTRO }}-ccache
- name: Ensure ccache dir exists
run: |
if [ ! -d ${{ env.CCACHE_DIR }} ]; then \
echo "Could not find CCACHE_DIR ${{ env.CCACHE_DIR }}" \
&& echo "Creating ${{ env.CCACHE_DIR }}" \
&& mkdir -p ${{ env.CCACHE_DIR }}; \
else \
echo "Found CCACHE_DIR ${{ env.CCACHE_DIR }}" \
&& ls -lha ${{ env.CCACHE_DIR }}; \
fi
- name: Ensure work dir exists
run: |
if [ ! -d ${{ env.WORK_DIR }} ]; then mkdir -p ${{ env.WORK_DIR }}; fi
- name: Build docker, build KIM API, run tests
run: |
cd ${{ env.WORK_DIR }}
env
${GITHUB_WORKSPACE}/scripts/ci-docker-build-and-run \
"${GITHUB_WORKSPACE}" \
"${{ env.DISTRO }}" \
"${GITHUB_REPOSITORY}:${{ env.DISTRO }}" \
"${{ env.CCACHE_DIR }}" \
"${{ env.CMAKE_DIR }}"
windows-mingw-debug:
name: Windows-MinGW (debug)
runs-on:
windows-latest
env:
DISTRO: windows_mingw
CMAKE_BUILD_TYPE: Debug
WINDOWS_CCACHE_DIR: C:/ccache/
CCACHE_DIR: /home/runneradmin/ccache/
defaults:
run:
shell: msys2 {0}
steps:
- name: Check out repository
uses: actions/checkout@v2
# Because the msys2/setup-msys2 action creates the path for msys2 where
# everything in this job happens at the start of every time this job is
# run (of the form ${RUNNER_TEMP}/msys/msys64 where RUNNER_TEMP is a
# default GHA envvar containing an absolute windows path), we avoid
# directly setting up a cache directory inside of it to hold ccache
# artifacts. Instead, we make a cache directory directly in windows and
# copy its contents into the ccache directory we use inside of msys2; at
# the conclusion of the job, we copy the contents of the ccache directory
# back to the windows directory.
- name: Initialize windows ccache dir
uses: actions/cache@v2
with:
path: ${{ env.WINDOWS_CCACHE_DIR }}
key: ${{ env.DISTRO }}-ccache-${{ github.sha }}
restore-keys: |
${{ env.DISTRO }}-ccache
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: minimal
update: true
install: >-
mingw-w64-x86_64-ccache
mingw-w64-x86_64-cmake
mingw-w64-x86_64-doxygen
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-gcc-fortran
- name: Ensure windows ccache dir exists
run: |
if [ ! -d ${{ env.WINDOWS_CCACHE_DIR }} ]; then \
echo "Could not find windows ccache dir ${{ env.WINDOWS_CCACHE_DIR }}" \
&& echo "Creating ${{ env.WINDOWS_CCACHE_DIR }}" \
&& mkdir -p ${{ env.WINDOWS_CCACHE_DIR }}; \
else \
echo "Found windows ccache dir ${{ env.WINDOWS_CCACHE_DIR }}" \
&& ls -lha ${{ env.WINDOWS_CCACHE_DIR }}; \
fi
- name: Copy ccache contents (if any) from windows ccache dir -> msys2 working path
run: |
echo "Copying ${{ env.WINDOWS_CCACHE_DIR}} -> ${{ env.CCACHE_DIR }}"
cp -r ${{ env.WINDOWS_CCACHE_DIR }} ${{ env.CCACHE_DIR }}
- name: Build KIM API, run tests
env:
FC: gfortran
CMAKE_GENERATOR: MinGW Makefiles
MAKE: mingw32-make
CMAKE_MAKE_PROGRAM: mingw32-make
run: |
bash ./scripts/ci-build-and-test
- name: Copy ccache content from msys2 working path -> windows ccache dir
run: cp -r ${{ env.CCACHE_DIR }}/* ${{ env.WINDOWS_CCACHE_DIR }}