-
Notifications
You must be signed in to change notification settings - Fork 17
253 lines (215 loc) · 8.22 KB
/
cmake.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
name: CMake Build
env:
APIKEY: ${{ secrets.REALM_BAASAAS_API_KEY }}
REALM_CI: true
REALM_DISABLE_ANALYTICS: true
on:
push:
branches:
- main
pull_request:
jobs:
stop-all-containers:
runs-on: ubuntu-latest
name: Stop Stray Containers
if: always()
needs:
- build-macos
- build-linux
- build-windows
steps:
- name: Stop containers
run: |
export JSON_HEADER="Content-Type: application/json"
export AUTH_HEADER="apiKey: $APIKEY"
export BASE_URL="https://us-east-1.aws.data.mongodb-api.com/app/baas-container-service-autzb/endpoint"
curl --silent -X GET -H "$JSON_HEADER" -H "$AUTH_HEADER" "$BASE_URL/listContainers?mine=true" | jq | grep '"id":' | awk -F '"' '{print $4}' | while read id; do
curl --silent -X POST -H "$JSON_HEADER" -H "$AUTH_HEADER" "$BASE_URL/stopContainer?id=$id"
done
build-macos:
runs-on: macos-14
name: macOS ${{ matrix.configuration }}, Xcode ${{ matrix.xcode }}, REALM_DISABLE_ALIGNED_STORAGE=${{ matrix.disable-aligned-storage }}
strategy:
fail-fast: false
matrix:
xcode:
- '15.4'
configuration:
- Debug
- Release
disable-aligned-storage:
- 1
- 0
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Setup Ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache-macos-${{ matrix.xcode }}-disable-aligned-storage-${{ matrix.disable-aligned-storage }}-${{ matrix.configuration }}
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- uses: ammaraskar/gcc-problem-matcher@master
- name: Configure
run: cmake --preset macos -DCMAKE_VERBOSE_MAKEFILE=${RUNNER_DEBUG:-OFF} -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DREALM_ENABLE_EXPERIMENTAL=1 -DREALM_DISABLE_ALIGNED_STORAGE=${{ matrix.disable-aligned-storage }} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Compile
run: cmake --build --preset macos --config ${{ matrix.configuration }}
- name: Non Sync Tests
working-directory: .build/cmake-preset-macos/tests/${{ matrix.configuration }}/
run: ./cpprealm_db_tests
- name: Flexible Sync Tests
working-directory: .build/cmake-preset-macos/tests/${{ matrix.configuration }}/
run: ./cpprealm_sync_tests "~client_reset"
- name: Client Reset Tests
working-directory: .build/cmake-preset-macos/tests/${{ matrix.configuration }}/
run: ./cpprealm_sync_tests "client_reset"
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '.build/**/TestResults.xml'
annotate_only: true
require_tests: true
- name: Open a tmate debug session
if: ${{ failure() && runner.debug }}
uses: mxschmitt/action-tmate@v3
with:
timeout-minutes: 15
build-linux:
runs-on: ubuntu-latest
name: Linux ${{ matrix.configuration }} (${{ matrix.compiler.name }} ${{ matrix.compiler.version }})
strategy:
fail-fast: false
matrix:
compiler:
- name: gcc
version: "8.3"
- name: gcc
version: "9.1"
- name: gcc
version: "10.1"
- name: gcc
version: "11.1"
- name: gcc
version: "12.1"
- name: clang
version: 15
configuration:
- Debug
- Release
container:
image: ${{ matrix.compiler.name == 'clang' && 'silkeh/clang' || matrix.compiler.name }}:${{ matrix.compiler.version }}
steps:
- name: Install Linux Dependencies
run: |
apt-get update
apt-get install -y \
git \
libcurl4-openssl-dev \
libssl-dev \
libuv1-dev \
ninja-build \
sudo \
zlib1g-dev \
valgrind
- name: Setup Ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache-linux-${{ matrix.compiler.name }}-${{ matrix.compiler.version }}-${{ matrix.configuration }}
- name: Setup CMake
uses: jwlawson/[email protected]
with:
cmake-version: latest
- uses: ammaraskar/gcc-problem-matcher@master
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Configure
run: cmake --preset linux -DCMAKE_VERBOSE_MAKEFILE=${RUNNER_DEBUG:-OFF} -DREALM_ENABLE_EXPERIMENTAL=1 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Compile
run: cmake --build --preset linux --config ${{ matrix.configuration }}
- name: Test
working-directory: .build/cmake-preset-linux/tests/${{ matrix.configuration }}/
run: ./cpprealm_db_tests
- name: Flexible Sync Tests
working-directory: .build/cmake-preset-linux/tests/${{ matrix.configuration }}/
run: ./cpprealm_sync_tests "~client_reset"
- name: Client Reset Tests
working-directory: .build/cmake-preset-linux/tests/${{ matrix.configuration }}/
run: ./cpprealm_sync_tests "client_reset"
- name: Valgrind leak check
if: ${{ matrix.compiler.name == 'gcc' && matrix.compiler.version == '12.1' }}
working-directory: .build/cmake-preset-linux/tests/${{ matrix.configuration }}/
run: valgrind --tool=memcheck --leak-check=full --show-leak-kinds=definite --undef-value-errors=yes --track-origins=yes --child-silent-after-fork=no --trace-children=yes --log-file=valgrind.log ./cpprealm_db_tests
- name: Check for definitely lost errors
if: ${{ matrix.compiler.name == 'gcc' && matrix.compiler.version == '12.1' }}
id: check_valgrind
run: |
if grep -q "definitely lost: [1-9]" valgrind.log; then
echo "Valgrind detected definitely lost errors"
exit 1
else
echo "No definitely lost errors detected"
fi
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: '.build/**/TestResults.xml'
annotate_only: true
require_tests: true
- name: Open a tmate debug session
if: ${{ failure() && runner.debug }}
uses: mxschmitt/action-tmate@v3
with:
timeout-minutes: 15
build-windows:
runs-on: windows-2022
name: Windows ${{ matrix.configuration }}
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: ammaraskar/msvc-problem-matcher@master
- name: Setup Ccache
uses: hendrikmuhs/[email protected]
with:
key: windows-${{ matrix.configuration }}
- name: Setup CMake
uses: jwlawson/[email protected]
with:
cmake-version: latest
- name: Configure
run: cmake --preset windows-x64 -DENABLE_STATIC=1 -DREALM_ENABLE_EXPERIMENTAL=1 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Compile
run: cmake --build --preset windows-x64 --config ${{ matrix.configuration }}
- name: Non Sync Tests
working-directory: .build/cmake-preset-windows-x64/tests/${{ matrix.configuration }}/
run: ./cpprealm_db_tests
- name: Flexible Sync Tests
working-directory: .build/cmake-preset-windows-x64/tests/${{ matrix.configuration }}/
run: ./cpprealm_sync_tests "~client_reset"
- name: Client Reset Tests
working-directory: .build/cmake-preset-windows-x64/tests/${{ matrix.configuration }}/
run: ./cpprealm_sync_tests "client_reset"
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '.build/**/TestResults.xml'
annotate_only: true
require_tests: true