-
Notifications
You must be signed in to change notification settings - Fork 4
447 lines (406 loc) · 16.1 KB
/
macos.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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
name: "MacOS build, general"
on: [push, pull_request]
env:
NINJA_BUILD: true
CACHE_DIR: ${{ github.workspace }}/_cache
NIH_CACHE_ROOT: ${{ github.workspace }}/_cache/nih_c
NIH_SRC_PATH: ${{ github.workspace }}/_srccache
PARALLEL_TESTS: true
USE_CCACHE: true
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_NOHASHDIR: true
CCACHE_DIR: ${{ github.workspace }}/_cache/ccache
BOOST_URL: 'https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.bz2'
# Alternate dowload location
BOOST_URL2: 'https://downloads.sourceforge.net/project/boost/boost/1.75.0/boost_1_75_0.tar.bz2?r=&ts=1594393912&use_mirror=newcontinuum'
BOOST_ROOT: ${{ github.workspace }}/boost_1_75_0
# Travis downloader doesn't seem to have updated certs. Using this option
# introduces obvious security risks, but they're Travis's risks.
# Note that this option is only used if the "normal" build fails.
#BOOST_WGET_OPTIONS: '--no-check-certificate'
CMAKE_ARGS: "-G Ninja -Dwerr=ON -Dwextra=ON -DBoost_ARCHITECTURE=-x64 -DBoost_NO_SYSTEM_PATHS=ON -DCMAKE_VERBOSE_MAKEFILE=ON"
homebrew_packages: 'protobuf grpc pkg-config bash ninja cmake wget zstd libarchive [email protected] ccache'
srcdir: ${{ github.workspace }}/rippled
builddir: ${{ github.workspace }}/rippled/build/macos
# This can't be used in the if: clauses
verbose: ${{ contains(github.event.head_commit.message, 'ci_verbose') }}
jobs:
macos_cache:
name: Seed MacOS dependencies
runs-on: "mac-runner"
timeout-minutes: 720
if: ${{ !contains(github.event.head_commit.message, 'ci_run_') || contains(github.event.head_commit.message, 'ci_run_mac') }}
outputs:
cmakeconfig: ${{ steps.cachekeys.outputs.cmakeconfig }}
headers: ${{ steps.cachekeys.outputs.headers }}
source: ${{ steps.cachekeys.outputs.source }}
instructions: ${{ steps.cachekeys.outputs.instructions }}
brewinfo: ${{ steps.brew.outputs.brewinfo }}
CC: ${{ steps.pre.outputs.CC }}
CXX: ${{ steps.pre.outputs.CXX }}
NUM_PROCESSORS: ${{ steps.pre.outputs.NUM_PROCESSORS }}
steps:
- name: Cancel Previous Runs
# https://github.com/styfle/cancel-workflow-action/tree/0.9.0
# Note this will not cancel jobs triggered by a pull request event
# when the PR is created from a fork, even if for the same PR.
# It works fine within the same fork, and is intended to allow
# multiple pushes during development without ending up with a
# huge backlog of jobs.
if: ${{ !contains(github.event.head_commit.message, 'ci_no_cancel') }}
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
with:
path: rippled
- name: Build cache keys
id: cachekeys
shell: bash
run: |
echo "::set-output name=cmakeconfig::${{ hashfiles(
'rippled/CMakeFiles.txt', 'rippled/Builds/CMake/**',
'rippled/.github/**/cache-invalidate.txt') }}"
echo "::set-output name=headers::${{ hashfiles('rippled/src/**/*.h',
'rippled/src/**/*.hpp', 'rippled/src/**/*.ipp') }}"
echo "::set-output name=source::${{ hashfiles('rippled/src/**',
'!rippled/src/**/*.md', '!rippled/src/**/*.uml',
'!rippled/src/**/*.png', '!rippled/src/**/*.php') }}"
echo "::set-output name=instructions::${{ hashfiles(
'rippled/**/macos.yml') }}"
- name: Install Homebrew packages
run: |
echo Upgrade all brew packages
brew upgrade
for pkg in ${homebrew_packages}
do
[[ "${verbose}" == "true" ]] && echo INSTALLING ${pkg} || true
brew install ${pkg}
done
[[ "${verbose}" == "true" ]] && set -x || true
echo Currently installed brews:
brew list
brew info --all --json > brew.info
- name: Hash Homebrew info
id: brew
run: |
echo "::set-output name=brewinfo::${{ hashfiles('brew.info') }}"
- name: Boost cache
id: boostcache
continue-on-error: true
uses: actions/cache@v2
with:
path: ${{ env.BOOST_ROOT }}
key: ${{ runner.os }}-boost-${{ env.BOOST_ROOT }}
- name: Source cache
id: srccache
continue-on-error: true
uses: actions/cache@v2
with:
path: ${{ env.NIH_SRC_PATH}}
key: ${{ runner.os }}-nihsrc-${{ steps.cachekeys.outputs.cmakeconfig }}-${{ steps.cachekeys.outputs.instructions }}
restore-keys: |
${{ runner.os }}-nihsrc-${{ steps.cachekeys.outputs.cmakeconfig }}-
- name: Dump environment
run: |
env
set | grep =
- name: Disk space before
shell: bash
run: |
df -h
find ${CACHE_DIR} -maxdepth 2 \( -iname src -prune -o \
-type d -exec du -sh {} \; \) || true
- name: Pre-install
id: pre
shell: bash
run: |
export NUM_PROCESSORS=${NUM_PROCESSORS:-$(nproc || sysctl -n hw.logicalcpu || echo 3)}
echo "NUM PROC is ${NUM_PROCESSORS}"
mkdir -pv "${CACHE_DIR}"
echo "::set-output name=NUM_PROCESSORS::${NUM_PROCESSORS}"
echo "::set-output name=CC::$(brew --prefix llvm)/bin/clang"
echo "::set-output name=CXX::$(brew --prefix llvm)/bin/clang++"
- name: Build boost
if: steps.boostcache.outputs.cache-hit != 'true'
shell: bash
env:
CC: ${{ steps.pre.outputs.CC }}
CXX: ${{ steps.pre.outputs.CXX }}
NUM_PROCESSORS: ${{ steps.pre.outputs.NUM_PROCESSORS }}
run: |
[[ "${verbose}" == "true" ]] && set -x || true
$CC --version
$CXX --version
export OPENSSL_ROOT=$(brew --prefix [email protected])
cd rippled
./Builds/containers/shared/install_boost.sh
# brew uninstall --ignore-dependencies boost
- name: Download CMake dependencies
if: steps.srccache.outputs.cache-hit != 'true'
shell: bash
env:
CC: ${{ steps.pre.outputs.CC }}
CXX: ${{ steps.pre.outputs.CXX }}
NUM_PROCESSORS: ${{ steps.pre.outputs.NUM_PROCESSORS }}
run: |
cmake --version
${CC} --version
${CXX} --version
export BLD_CONFIG=Debug
export OPENSSL_ROOT=$(brew --prefix [email protected])
${CC} --version
${CXX} --version
dir="${builddir}/$( basename ${CXX} ).${BLD_CONFIG}"
mkdir "-pv" "${dir}"
pushd "${dir}"
# Verbose or not, it's good to see the right params
# are being used
set "-x"
# rm is called if the first cmake fails, because the most
# likely cause is cache mismatch or corruption. If that happens
# reset the cache and try again.
cmake -DCMAKE_BUILD_TYPE=${BLD_CONFIG} \
${CMAKE_ARGS} ${srcdir} || \
( rm -rf ${{ env.CACHE_DIR }} ${{ env.NIH_SRC_PATH }}; \
cmake -DCMAKE_BUILD_TYPE=${BLD_CONFIG} \
${CMAKE_ARGS} ${srcdir} )
alldeps=( $( \
cmake --build . --target help | \
grep phony | cut -d: -f1 | \
sed 's/^\/.*\/rippled\/.*\/CMakeFiles\///' | \
grep -v -e '\/' -e '^all' -e install -e clean \
-e depend -e cache -e docs -e rippled -e xrpl_core \
-e container -e '^rpm' -e '^dpkg' \
) )
echo "Building dependencies: ${alldeps[@]}"
for dep in help "${alldeps[@]}"
do
echo Building $dep
cmake --build . --target $dep --parallel
done
set +x
popd
- name: Disk space after
shell: bash
if: always()
run: |
df -h
du -sh ${CACHE_DIR} || true
du -sh ${CCACHE_DIR} || true
find ${NIH_SRC_PATH} ${NIH_CACHE_ROOT} -maxdepth 2 \
-type d -exec du -sh {} \; || true
- name: Debug output
if: steps.cache.outputs.cache-hit != 'true' || failure()
shell: bash
continue-on-error: true
run: |
time df -h
dir=rippled/build
if [ -e ${dir} ] ; then find ${dir} \( -name CMakeOutput.log -o \
-name CMakeError.log \) -ls -exec cat {} \; ; fi
- name: Debug output artifacts
if: steps.cache.outputs.cache-hit != 'true' || failure()
uses: actions/upload-artifact@v2
continue-on-error: true
with:
name: debug-output NIH dependencies
retention-days: 7
if-no-files-found: ignore
path: |
rippled/build/**/CMakeOutput.log
rippled/build/**/CMakeError.log
macos:
# These two matrix jobs could be split into separate jobs (debug
# and release), so the test runner job only needs to depend on
# the debug, but it doesn't seem worth the duplication at this
# time, since it's only one extra job (as opposed to a dozen),
# and the jobs appear to be pretty reliable so far.
name: MacOS ${{ matrix.build.BLD_CONFIG }}
needs: macos_cache
runs-on: "mac-runner"
timeout-minutes: 720
strategy:
fail-fast: false
matrix:
build:
- BLD_CONFIG: "Debug"
- BLD_CONFIG: "Release"
# Build Release with asserts
CMAKE_ADD: "-Dassert=ON"
env:
BLD_CONFIG: ${{ matrix.build.BLD_CONFIG }}
CMAKE_ADD: ${{ matrix.build.CMAKE_ADD }}
CC: ${{ needs.macos_cache.outputs.CC }}
CXX: ${{ needs.macos_cache.outputs.CXX }}
NUM_PROCESSORS: ${{ needs.macos_cache.outputs.NUM_PROCESSORS }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: rippled
- name: Install Homebrew packages
run: |
[[ "${verbose}" == "true" ]] && set -x || true
echo Upgrade all brew packages
brew upgrade
for pkg in ${homebrew_packages}
do
[[ "${verbose}" == "true" ]] && echo INSTALLING ${pkg} || true
brew install ${pkg}
done
- name: Boost cache
continue-on-error: true
uses: actions/cache@v2
with:
path: ${{ env.BOOST_ROOT }}
key: ${{ runner.os }}-boost-${{ env.BOOST_ROOT }}
- name: Build cache
id: nihcache
continue-on-error: true
uses: actions/cache@v2
# The cache key is built on the following in order
# 1) OS.
# 2) The hash of all the CMake config files.
# 3) The build type
# 4) The hash of all the header files under the source dir.
# 5) The hash of all the code files under the source dir.
# 6) The hash of the files controlling this job
# When restoring, if the matching cache is not found, search for a usable
# cache by chopping pieces off the end of the cache key until a match is
# found, with a special case for the NIH built in the previous job
with:
path: ${{ env.CACHE_DIR }}
key: ${{ runner.os }}-${{ needs.macos_cache.outputs.cmakeconfig }}-${{ env.BLD_CONFIG }}-${{ needs.macos_cache.outputs.headers }}-${{ needs.macos_cache.outputs.source }}-${{ needs.macos_cache.outputs.instructions }}
restore-keys: |
${{ runner.os }}-${{ needs.macos_cache.outputs.cmakeconfig }}-${{ env.BLD_CONFIG }}-${{ needs.macos_cache.outputs.headers }}-${{ needs.macos_cache.outputs.source }}
${{ runner.os }}-${{ needs.macos_cache.outputs.cmakeconfig }}-${{ env.BLD_CONFIG }}-${{ needs.macos_cache.outputs.headers }}
${{ runner.os }}-${{ needs.macos_cache.outputs.cmakeconfig }}-${{ env.BLD_CONFIG }}
- name: Source cache
id: srccache
continue-on-error: true
uses: actions/cache@v2
with:
path: ${{ env.NIH_SRC_PATH}}
key: ${{ runner.os }}-nihsrc-${{ needs.macos_cache.outputs.cmakeconfig }}-${{ needs.macos_cache.outputs.instructions }}
- name: Dump environment
run: |
env
set | grep =
- name: Reset ccache stats
shell: bash
run: |
ccache -s
# Reset the stats so only this build counts
ccache -z
- name: Disk space before
shell: bash
run: |
df -h
du -sh ${CACHE_DIR} || true
find ${NIH_SRC_PATH} ${NIH_CACHE_ROOT} -maxdepth 2 \
-type d -exec du -sh {} \; || true
- name: Build
shell: bash
run: |
[[ "${verbose}" == "true" ]] && set -x || true
$CC --version
$CXX --version
export OPENSSL_ROOT=$(brew --prefix [email protected])
if [ "${CMAKE_ADD}" != "" ] ; then
export CMAKE_ARGS+=" ${CMAKE_ADD}"
fi
if [[ ${USE_CCACHE:-} == true ]] && type -a ccache; then
echo "using ccache with basedir [${CCACHE_BASEDIR:-}]"
CMAKE_ARGS+=" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi
echo ${CMAKE_ARGS}
mkdir -p $builddir && cd $builddir
cmake ${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${BLD_CONFIG} ${srcdir}
cmake --build . --parallel --verbose
- name: Test
shell: bash
run: |
[[ "${verbose}" == "true" ]] && set -x || true
# Always run single threaded
${builddir}/rippled --unittest
- name: Disk space after
shell: bash
if: always()
run: |
df -h
du -sh ${CACHE_DIR} || true
find ${NIH_SRC_PATH} ${NIH_CACHE_ROOT} -maxdepth 2 \
-type d -exec du -sh {} \; || true
- name: Post-run ccache stats
shell: bash
run: ccache -s
- name: Debug output artifacts
if: always()
uses: actions/upload-artifact@v2
continue-on-error: true
with:
name: debug-output ${{ env.BLD_CONFIG }}
retention-days: 7
if-no-files-found: ignore
path: |
rippled/build/**/CMakeOutput.log
rippled/build/**/CMakeError.log
- name: rippled executable artifact
if: always()
uses: actions/upload-artifact@v2
continue-on-error: true
with:
name: rippled ${{ env.BLD_CONFIG }}
retention-days: 7
if-no-files-found: ignore
path: |
rippled/build/**/rippled
!rippled/build/**/_INSTALLED_/**
macos_runner:
# Can't access env in the name, so hard code
name: MacOS IPv6 test runner Debug
needs: [ macos_cache, macos ]
runs-on: "mac-runner"
timeout-minutes: 720
strategy:
fail-fast: false
env:
name: "IPv6 tests"
BLD_CONFIG: "Debug"
TEST_EXTRA_ARGS: "--unittest-ipv6"
NUM_PROCESSORS: ${{ needs.macos_cache.outputs.NUM_PROCESSORS }}
steps:
- name: Download rippled artifact
uses: actions/download-artifact@v2
with:
name: rippled ${{ env.BLD_CONFIG }}
- name: Install Homebrew packages
run: |
[[ "${verbose}" == "true" ]] && set -x || true
echo Upgrade all brew packages
brew upgrade
for pkg in ${homebrew_packages}
do
[[ "${verbose}" == "true" ]] && echo INSTALLING ${pkg} || true
brew install ${pkg}
done
echo Currently installed brews:
brew list
brew info --all --json > brew.info
- name: Run IPv6 tests
shell: bash
run: |
[[ "${verbose}" == "true" ]] && set -x || true
: ${APP_ARGS:=}
# Always run single threaded
APP_ARGS+=" --unittest ${TEST_EXTRA_ARGS}"
find . -name rippled -ls
# There can be only one
[[ $( find . -name rippled | wc -l ) -eq 1 ]]
APP_PATH="$( find . -name rippled )"
chmod a+rx "${APP_PATH}"
# Verbose or not, it's good to see the right params are being used
echo Run: "${APP_PATH}" ${APP_ARGS}
"${APP_PATH}" ${APP_ARGS}