-
Notifications
You must be signed in to change notification settings - Fork 1
362 lines (316 loc) · 10.9 KB
/
fuzzy-testing.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
# Copyright (C) 2023 Roberto Rossini (roberros@uio.no)
# SPDX-License-Identifier: MIT
name: Run fuzzy tests
on:
push:
branches: [main]
paths:
- ".github/workflows/fuzzy-testing.yml"
- "cmake/**"
- "src/**"
- "test/fuzzer/**"
- "CMakeLists.txt"
- "conanfile.py"
tags:
- "v*.*.*"
pull_request:
paths:
- ".github/workflows/fuzzy-testing.yml"
- "cmake/**"
- "src/**"
- "test/fuzzer/**"
- "CMakeLists.txt"
- "conanfile.py"
schedule:
# Run weekly
- cron: "15 3 * * 0"
workflow_dispatch:
inputs:
duration:
description: "Test duration in seconds"
required: true
default: "600"
type: string
resolution:
description: "Matrix resolution to use for testing"
required: true
default: "random"
type: string
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
build-project:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- {
dataset: "4DNFIYECESRC",
format: "cool",
normalization: "NONE",
bin-type: "fixed",
}
- {
dataset: "4DNFIYECESRC",
format: "cool",
normalization: "weight",
bin-type: "fixed",
}
- {
dataset: "4DNFIYECESRC",
format: "cool",
normalization: "VC",
bin-type: "fixed",
}
- {
dataset: "4DNFIYECESRC",
format: "cool",
normalization: "NONE",
bin-type: "variable",
}
- {
dataset: "4DNFIYECESRC",
format: "hic8",
normalization: "NONE",
bin-type: "fixed",
}
- {
dataset: "4DNFIYECESRC",
format: "hic8",
normalization: "KR",
bin-type: "fixed",
}
- {
dataset: "4DNFIYECESRC",
format: "hic9",
normalization: "NONE",
bin-type: "fixed",
}
- {
dataset: "4DNFIYECESRC",
format: "hic9",
normalization: "SCALE",
bin-type: "fixed",
}
- {
dataset: "4DNFIYECESRC",
format: "hic9",
normalization: "VC",
bin-type: "fixed",
}
container:
image: ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-18
options: "--user=root"
env:
CCACHE_DIR: "/opt/ccache-cache"
CCACHE_COMPILERCHECK: "content"
CCACHE_COMPRESSLEVEL: "1"
CCACHE_MAXSIZE: "100M"
CONAN_HOME: "/opt/conan/"
HICTK_CI: "1"
outputs:
ccache-old-cache-key: ${{ steps.cache-ccache.outputs.cache-matched-key }}
steps:
- name: Clone hictk
uses: actions/checkout@v4
- name: Fix permissions
run: |
chown -R $(id -u):$(id -g) $PWD
- name: Generate cache key
id: cache-key
run: |
conanfile_hash="${{ hashFiles('conanfile.py') }}"
# This can be used by to always update a cache entry (useful e.g. for ccache)
current_date="$(date '+%s')"
ccache_key_prefix="ccache-fuzzy-testing-$GITHUB_REF-$conanfile_hash"
echo "conan-key=fuzzy-testing-$conanfile_hash" | tee -a "$GITHUB_OUTPUT"
echo "ccache-key=${ccache_key_prefix}-${current_date}" | tee -a "$GITHUB_OUTPUT"
echo "ccache-restore-key=$ccache_key_prefix" | tee -a "$GITHUB_OUTPUT"
- name: Install Python
run: |
apt-get update
apt-get install -y python3.12 python3.12-dev
- name: Restore Conan cache
id: cache-conan
uses: actions/cache/restore@v4
with:
key: ${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
- name: Clean Conan cache (pre-build)
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan cache clean "*" --build
conan cache clean "*" --download
conan cache clean "*" --source
conan remove --confirm "*"
- name: Install build dependencies
run: |
conan install . \
--build=missing \
-pr:b="$CONAN_DEFAULT_PROFILE_PATH" \
-pr:h="$CONAN_DEFAULT_PROFILE_PATH" \
-s build_type=Release \
-s compiler.libcxx=libstdc++11 \
-s compiler.cppstd=17 \
--output-folder=build
- name: Clean Conan cache (post-build)
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan cache clean "*" --build
conan cache clean "*" --download
conan cache clean "*" --source
- name: Save Conan cache
uses: actions/cache/save@v4
if: steps.cache-conan.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
env:
ZSTD_CLEVEL: 19
- name: Configure project
run: |
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$PWD/build" \
-DENABLE_DEVELOPER_MODE=ON \
-DOPT_ENABLE_CLANG_TIDY=OFF \
-DOPT_ENABLE_CPPCHECK=OFF \
-DHICTK_ENABLE_TESTING=ON \
-DHICTK_ENABLE_FUZZY_TESTING=ON \
-DHICTK_BUILD_EXAMPLES=OFF \
-DHICTK_DOWNLOAD_TEST_DATASET=OFF \
-S . \
-B build
- name: Restore Ccache folder
id: cache-ccache
uses: actions/cache/restore@v4
with:
key: ${{ steps.cache-key.outputs.ccache-restore-key }}
path: ${{ env.CCACHE_DIR }}
- name: Reset Ccache stats
run: ccache --zero-stats
- name: Build hictk_fuzzer
run: cmake --build build -j $(nproc) -t hictk_fuzzer
- name: Print Ccache statistics (pre-cleanup)
run: |
ccache --show-stats \
--show-compression \
--verbose
- name: Cleanup Ccache folder
run: |
ccache --evict-older-than=14400s # 4h
ccache --recompress=19 --recompress-threads="$(nproc)"
ccache --cleanup
- name: Print Ccache statistics (post-cleanup)
run: |
ccache --show-stats \
--show-compression \
--verbose
- name: Save Ccache folder
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-key.outputs.ccache-key }}
path: ${{ env.CCACHE_DIR }}
env:
ZSTD_CLEVEL: 1
- name: Install test dependencies
run: |
pip install --no-cache-dir 'cooler==0.10.*' 'numpy<2'
- name: Detect CI type
id: ci-type
run: |
if git log --format=%B -n 1 ${{ github.event.after }} | grep -qF '[ci full]'; then
echo "type=full" | tee -a "$GITHUB_OUTPUT"
else
echo "type=short" | tee -a "$GITHUB_OUTPUT"
fi
- name: Prepare for test
id: test-params
run: |
duration=120
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
duration='${{ inputs.duration }}'
elif [[ '${{ steps.ci-type.outputs.type }}' == 'full' ]]; then
duration=3600
fi
resolution=50000
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
if [[ '${{ inputs.resolution }}' == 'random' ]]; then
resolution="$(
python3 -c 'import random; import sys; print(random.choice([int(x) for x in sys.argv[1:]]))' \
1000 5000 10000 50000 100000 500000
)"
else
resolution='${{ inputs.resolution }}'
fi
fi
if [[ '${{ matrix.bin-type }}' == variable ]]; then
resolution=0
fi
2>&1 echo "Duration: ${duration}"
2>&1 echo "Resolution: ${resolution}"
echo "duration=$duration" | tee -a "$GITHUB_OUTPUT"
echo "resolution=$resolution" | tee -a "$GITHUB_OUTPUT"
- name: Download test datasets
run: |
test/fuzzer/scripts/download_test_datasets.py \
test/fuzzer/test_files.json \
. \
--format cool "${{ matrix.format }}" \
--resolution "${{ steps.test-params.outputs.resolution }}" \
--dataset "${{ matrix.dataset }}" \
--nproc 2
- name: Run test (df)
run: |
build/test/fuzzer/src/hictk_fuzzer fuzz \
--resolution ${{ steps.test-params.outputs.resolution }} \
--duration '${{ steps.test-params.outputs.duration }}' \
--normalization ${{ matrix.normalization }} \
--nproc $(nproc) \
--format df \
*".${{ matrix.format }}" \
*.cool
- name: Run test (dense)
run: |
build/test/fuzzer/src/hictk_fuzzer fuzz \
--resolution ${{ steps.test-params.outputs.resolution }} \
--duration '${{ steps.test-params.outputs.duration }}' \
--normalization ${{ matrix.normalization }} \
--nproc $(nproc) \
--format dense \
*".${{ matrix.format }}" \
*.cool
- name: Run test (sparse)
run: |
build/test/fuzzer/src/hictk_fuzzer fuzz \
--resolution ${{ steps.test-params.outputs.resolution }} \
--duration '${{ steps.test-params.outputs.duration }}' \
--normalization ${{ matrix.normalization }} \
--nproc $(nproc) \
--format sparse \
*".${{ matrix.format }}" \
*.cool
clean-stale-cache:
needs: [build-project]
uses: paulsengroup/hictk/.github/workflows/evict-gha-cache.yml@main
name: Clean stale Ccache cache
permissions:
actions: write
if: needs.build-project.outputs.ccache-old-cache-key != ''
with:
cache-key: "${{ needs.build-project.outputs.ccache-old-cache-key }}"
fuzzy-testing-status-check:
name: Status Check (fuzzy-testing)
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- build-project
steps:
- name: Collect job results
if: needs.build-project.result != 'success'
run: exit 1