-
Notifications
You must be signed in to change notification settings - Fork 185
281 lines (240 loc) · 9.98 KB
/
ci-linux_mac.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
name: CI (Linux and macOS)
on:
workflow_call:
inputs:
ci_backend:
description: 'Name of the job backend/target'
default: ''
required: false
type: string
ci_option:
description: 'Name of the job option for display'
default: ''
required: false
type: string
bootstrap_args:
default: ''
required: false
type: string
matrix_image:
default: ''
required: true
type: string
matrix_compiler_cc:
default: 'gcc'
required: false
type: string
matrix_compiler_cxx:
default: 'g++'
required: false
type: string
matrix_compiler_cflags:
default: ''
required: false
type: string
matrix_compiler_cxxflags:
default: ''
required: false
type: string
timeout:
default: 90
description: 'Job timeout (minutes)'
required: false
type: number
asan:
default: false
description: 'Enable Address Sanitizer'
required: false
type: boolean
manylinux:
default: false
description: 'Enable manylinux builds'
required: false
type: boolean
vcpkg_base_triplet:
default: ''
description: 'Base triplet for vcpkg'
required: false
type: string
cmake_generator:
default: 'Unix Makefiles' # TODO: Ninja is much better than makefiles. Should it be the default?
description: 'CMake generator'
required: false
type: string
build_only:
default: false
description: 'Whether to only build TileDB and not run tests'
required: false
type: boolean
env:
BACKWARDS_COMPATIBILITY_ARRAYS: OFF
CMAKE_GENERATOR: ${{ inputs.cmake_generator }}
TILEDB_CI_BACKEND: ${{ inputs.ci_backend }}
TILEDB_CI_OS: ${{ startsWith(inputs.matrix_image, 'ubuntu-') && 'Linux' || 'macOS' }}
TILEDB_MANYLINUX: ${{ !inputs.manylinux && 'ON' || 'OFF' }}
CXX: ${{ inputs.matrix_compiler_cxx }}
CC: ${{ inputs.matrix_compiler_cc }}
CFLAGS: ${{ inputs.matrix_compiler_cflags }}
CXXFLAGS: ${{ inputs.matrix_compiler_cxxflags }}
bootstrap_args: "--enable-ccache --vcpkg-base-triplet=${{ inputs.vcpkg_base_triplet || (startsWith(inputs.matrix_image, 'ubuntu-') && 'x64-linux' || 'arm64-osx') }} ${{ inputs.bootstrap_args }} ${{ inputs.asan && '--enable-sanitizer=address' || '' }}"
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
SCCACHE_GHA_ENABLED: "true"
jobs:
build:
strategy:
matrix:
os:
- ${{ inputs.matrix_image }}
runs-on: ${{matrix.os}}
container: ${{inputs.manylinux && 'quay.io/pypa/manylinux_2_28_x86_64' || ''}}
if: ${{ startsWith(github.ref , 'refs/tags') != true && startsWith(github.ref , 'build-') != true }}
timeout-minutes: ${{ inputs.timeout || 90 }}
name: ${{matrix.os}} - ${{ inputs.ci_backend }}${{ inputs.ci_option }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
# Configure required environment variables for vcpkg to use
# GitHub's Action Cache
- uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install Python
if: ${{ !inputs.manylinux }}
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Prevent vpckg from building debug variants
run: python3 ./scripts/ci/patch_vcpkg_triplets.py
- name: Setup sccache
uses: mozilla-actions/[email protected]
- name: 'Ubuntu Prelim'
if: ${{ startsWith(matrix.os, 'ubuntu-') == true }}
run: ./scripts/ci/posix/prelim.sh
shell: bash
- name: Install manylinux prerequisites
if: inputs.manylinux
run: |
set -e pipefail
yum install -y redhat-lsb-core perl-IPC-Cmd curl zip unzip tar
# This must happen after checkout, because checkout would remove the directory.
- name: Install Ninja
if: inputs.cmake_generator == 'Ninja'
uses: seanmiddleditch/gha-setup-ninja@v4
- name: 'Brew setup on macOS' # x-ref c8e49ba8f8b9ce
if: ${{ startsWith(matrix.os, 'macos-') == true }}
run: |
set -e pipefail
brew install automake
- name: 'Configure libtiledb'
id: configure
shell: bash
run: |
set -e pipefail
# Show CMake Version
cmake --version
#####################################################
# We want to run bootstrap in an isolated step in order to
# cache vcpkg deps across runs if the libtiledb build fails.
source $GITHUB_WORKSPACE/scripts/ci/bootstrap_libtiledb.sh
- name: 'Build libtiledb'
id: build
shell: bash
run: |
set -e pipefail
#####################################################
# Build libtiledb using previous bootstrap
source $GITHUB_WORKSPACE/scripts/ci/build_libtiledb.sh
- name: 'Test libtiledb'
id: test
if: ${{ !inputs.build_only }}
shell: bash
env:
ASAN_OPTIONS: ${{ inputs.asan && 'detect_leaks=0' || '' }}
LD_PRELOAD: ${{ inputs.asan && '/usr/lib/x86_64-linux-gnu/libasan.so.6' || '' }}
VCPKG_TARGET_TRIPLET: ${{ runner.os == 'Linux' && 'x64-linux' || 'x64-osx' }}
run: |
set -e pipefail
###################################################
# Start helper processes, such as backend emulator
# if applicable.
# ** NOTE: most tests must run in the same shell **
# ** as build-services, especially tests **
# ** requiring a backend emulator. **
source $GITHUB_WORKSPACE/scripts/ci/posix/build-services-start.sh
#####################################################
# Jump to our build directory after starting object
# store mock servers
cd $GITHUB_WORKSPACE/build
###################################################
# Run tests
# Bypass Catch2 Framework stdout interception with awk on test output
./test/regression/tiledb_regression -d yes
./test/ci/test_assert -d yes
./test/tiledb_unit -d yes | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
./tiledb/sm/filesystem/test/unit_vfs -d yes | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
ctest -R tiledb_timing_unit | awk '/1: ::set-output/{sub(/.*1: /, ""); print; next} 1'
###################################################
# Stop helper processes, if applicable
source $GITHUB_WORKSPACE/scripts/ci/posix/build-services-stop.sh
# Skip examples and benchmarks if ASAN is enabled
if [[ "${{ inputs.asan }}" == "true" ]]; then
exit 0
fi
###################################################
# Build and run Examples
# The following script must not be sourced.
# It relies on finding its source directory.
$GITHUB_WORKSPACE/scripts/run-nix-examples.sh
###################################################
# Build benchmark code
source $GITHUB_WORKSPACE/scripts/ci/build_benchmarks.sh
###################################################
# Perform package test
cmake --build $GITHUB_WORKSPACE/build --target check-package
- name: 'Dump core stacks on failure'
if: ${{ failure() && startsWith(matrix.os, 'ubuntu-') == true }} # only run this job if the build step failed
run: ./scripts/ci/posix/dump-core-stacks.sh
- name: List files in build directory on failure
run: |
if [ $(uname) = "Darwin" ] ; then
# MacOS du lacks --exclude
du -h $GITHUB_WORKSPACE/build
else
du --exclude _deps -h $GITHUB_WORKSPACE/build
fi
if: ${{ failure() }}
- name: 'Upload failure artifacts (Linux)' # https://github.com/actions/upload-artifact#where-does-the-upload-go
if: ${{ startsWith(matrix.os, 'ubuntu-') == true }} # only run this job if the build step failed
uses: actions/upload-artifact@v4
with:
retention-days: 10
name: "coredumps.${{ github.job }}.${{ matrix.os }}.${{ github.run_number }}.${{github.run_id}}.${{github.run_attempt}}"
if-no-files-found: warn # 'ignore', 'warn' or 'error' are available, defaults to `warn`
path: |
/var/lib/apport/coredump/
- name: 'Upload failure artifacts (macOS)' # https://github.com/actions/upload-artifact#where-does-the-upload-go
if: ${{ failure() == true && startsWith(matrix.os, 'macos-') == true }} # only run this job if the build step failed
uses: actions/upload-artifact@v4
with:
retention-days: 10
name: "${{ matrix.os }}.coredumps.${{ github.job }}.${{ github.run_number }}.${{github.run_id}}.${{github.run_attempt}}"
if-no-files-found: warn # 'ignore', 'warn' or 'error' are available, defaults to `warn`
path: |
/cores/
- name: 'Test status check'
if: ${{ !inputs.build_only }}
run: |
# tiledb_unit is configured to set a variable TILEDB_CI_SUCCESS=1
# following the test run. If this variable is not set, the build should fail.
# see https://github.com/TileDB-Inc/TileDB/pull/1400 (5f0623f4d3)
if [[ "${{ steps.test.outputs.TILEDB_CI_SUCCESS }}" -ne 1 ]]; then
exit 1;
fi
- name: "Print log files (failed build only)"
run: |
source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh
if: ${{ failure() }} # only run this job if the build step failed