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# This job contains fuzzers, that won't found any bugs recently, so they don't need to be checked so often
name: ๐ง Stable Fuzzer Check
on:
# push: # Once daily
# pull_request: # Once daily
schedule:
- cron: '0 21 * * 1'
env:
CARGO_TERM_COLOR: always
SANITIZER: true
jobs:
automated-ci:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- name: DICOM
config-file: fuzz_dicom_rs_settings_ci.toml
timeout: 3600
files: "AA_DCM_VALID_FILES.7z"
library_folder: dicom
stability_check: false
binary: dicom
- name: TTF_PARSER
config-file: fuzz_ttf_parser_settings_ci.toml
timeout: 3600
files: "AA_FONT_VALID_FILES_MORE.7z"
library_folder: ttf_parser
stability_check: false
binary: ttf_parser
- name: ZIP_RS
config-file: fuzz_zip_rs_settings_ci.toml
timeout: 3600
files: "AA_ZIP_VALID_FILES.7z"
library_folder: zip_rs
stability_check: false
binary: zip_rs
# - name: GO
# config-file: fuzz_go_settings_ci.toml
# timeout: 3600
# files: "AA_GO_VALID_FILES.7z"
# go_version: '1.23.0-rc.1'
# library_folder: ''
# stability_check: false
# binary: staticcheck
- name: RUFFFORMAT1
config-file: fuzz_ruff_format_settings_ci.toml
timeout: 3600
files: "FILES_23.zip"
library_folder: ''
stability_check: false
binary: ruff
- name: RUFF
config-file: fuzz_ruff_settings_ci.toml
timeout: 3600
files: "FILES_23.zip"
library_folder: ''
stability_check: false
binary: ruff
- name: TYPST
config-file: fuzz_typst_settings_ci.toml
timeout: 3600
files: "AA_TYPST_VALID_FILES.zip"
library_folder: ''
stability_check: false
binary: typst
- name: IMAGE
config-file: fuzz_image_settings_ci.toml
timeout: 3600
files: "AA_IMAGE_VALID_FILES.7z"
library_folder: image
stability_check: false
binary: image
- name: IMAGE_HASHER
config-file: fuzz_image_hasher_settings_ci.toml
timeout: 3600
files: "AA_IMAGE_VALID_FILES.7z"
library_folder: image_hasher
stability_check: false
binary: image_hasher
- name: FAST_IMAGE_RESIZER
config-file: fuzz_fast_image_resizer_settings_ci.toml
timeout: 3600
files: "AA_IMAGE_VALID_FILES.7z"
library_folder: fast_image_resizer
stability_check: false
binary: fast_image_resizer
- name: NOM_EXIF
config-file: fuzz_nom_exif_settings_ci.toml
timeout: 3600
files: "AA_NOM_EXIF_VALID_FILES.7z"
library_folder: nom_exif
stability_check: false
binary: nom_exif
- name: LOFTY
config-file: fuzz_lofty_settings_ci.toml
timeout: 3600
files: "AA_MUSIC_VALID_FILES.7z"
library_folder: lofty
stability_check: false
binary: lofty
- name: SLINT
config-file: fuzz_slint_settings_ci.toml
timeout: 3600
files: "AA_SLINT_FILES.7z"
library_folder: slint
stability_check: false
binary: slint
- name: LOPDF
config-file: fuzz_lopdf_settings_ci.toml
timeout: 3600
files: "AA_PDF_VALID_FILES2.7z"
library_folder: lopdf
stability_check: false
binary: lopdf
- name: VIDDUPLICATE
config-file: fuzz_vidduplicate_settings_ci.toml
timeout: 3600
files: "AA_VIDEO_VALID_FILES.7z"
library_folder: vidduplicate
stability_check: false
binary: vidduplicate
- name: CHROMAPRINT
config-file: fuzz_chromaprint_settings_ci.toml
timeout: 3600
files: "AA_MUSIC_VALID_FILES.7z"
library_folder: chromaprint
stability_check: false
binary: chromaprint
- name: GDSCRIPT
config-file: fuzz_gdscript_formatter_settings_ci.toml
timeout: 3600
files: "AA_GDSCRIPT_VALID_FILES.7z"
library_folder: ''
stability_check: false
binary: gdscript-formatter
- name: GDSCRIPT_LINTER1
config-file: fuzz_gdscript_formatter_linter_settings_ci.toml
timeout: 3600
files: "AA_GDSCRIPT_VALID_FILES.7z"
library_folder: ''
stability_check: false
binary: gdscript-formatter
steps:
- uses: actions/checkout@v4
- name: Setup rust version
run: |
rustup default nightly
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add llvm-tools-preview --toolchain nightly-x86_64-unknown-linux-gnu
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y wget earlyoom libasan8 llvm sd python3
# sudo apt install -y pkg-config libfreetype6-dev libfontconfig1-dev # For font_kit
- name: Install create_broken_files
run: cargo install create_broken_files minimizer
# THERE STARTING CUSTOM STEP
- name: Install libraries, which are inside this repo(inside repo are binaries which uses these libraries)
if: ${{ matrix.library_folder != '' }}
run: |
PROJECT_INSTALL_DIR="src/crates/${{ matrix.library_folder }}"
cd $PROJECT_INSTALL_DIR
cargo update
cd ../../..
echo PROJECT_INSTALL_DIR=$PROJECT_INSTALL_DIR >> $GITHUB_ENV
#################### START OF APPLICATION STEPS ####################
# BIOME
- name: Download biome
if: ${{ contains(matrix.name, 'BIOME') }}
run: |
wget -q https://github.com/biomejs/biome/archive/refs/heads/main.zip
unzip -q main.zip
rm main.zip
echo PROJECT_INSTALL_DIR=biome-main/crates/biome_cli >> $GITHUB_ENV
echo PROJECT_CARGO_TOML_FOLDER=biome-main >> $GITHUB_ENV
#### PYREFLY
- name: Install pyrefly
if: ${{ contains(matrix.name, 'PYREFLY') }}
run: |
wget -q https://github.com/facebook/pyrefly/archive/refs/heads/main.zip
unzip -q main.zip
rm main.zip
echo PROJECT_INSTALL_DIR=pyrefly-main/pyrefly >> $GITHUB_ENV
echo PROJECT_CARGO_TOML_FOLDER=pyrefly-main >> $GITHUB_ENV
#### TY
- name: Install TY(ruff) - special name, because ty may conflict with other binaries
if: ${{ contains(matrix.name, 'TYRUF') }}
run: |
wget -q https://github.com/astral-sh/ruff/archive/refs/heads/main.zip
unzip -q main.zip
rm main.zip
sd -F "std::mem::forget(db);" "//std::mem::forget(db);" ruff-main/crates/ty/src/lib.rs
echo PROJECT_INSTALL_DIR=ruff-main/crates/ty >> $GITHUB_ENV
echo PROJECT_CARGO_TOML_FOLDER=ruff-main >> $GITHUB_ENV
#### RUFF
- name: Install ruff
if: ${{ contains(matrix.name, 'RUFF') }}
run: |
wget -q https://github.com/astral-sh/ruff/archive/refs/heads/main.zip
unzip -q main.zip
rm main.zip
echo PROJECT_INSTALL_DIR=ruff-main/crates/ruff >> $GITHUB_ENV
echo PROJECT_CARGO_TOML_FOLDER=ruff-main >> $GITHUB_ENV
#### GDSCRIPT
- name: Install gdscript-formatter
if: ${{ contains(matrix.name, 'GDSCRIPT') }}
run: |
# TODO why this not works?
# wget -q https://github.com/GDQuest/GDScript-formatter/archive/refs/heads/main.zip
# unzip -q main.zip
# rm main.zip
sudo apt update && sudo apt install -y git
git clone https://github.com/GDQuest/GDScript-formatter.git GDScript-formatter-main
echo PROJECT_INSTALL_DIR=GDScript-formatter-main >> $GITHUB_ENV
echo PROJECT_CARGO_TOML_FOLDER=GDScript-formatter-main >> $GITHUB_ENV
#### SWC
- name: Install swc
if: ${{ contains(matrix.name, 'SWC') }}
run: |
wget -q https://github.com/swc-project/swc/archive/refs/heads/main.zip
unzip -q main.zip
rm main.zip
echo PROJECT_INSTALL_DIR=swc-main/crates/swc_cli_impl >> $GITHUB_ENV
echo PROJECT_CARGO_TOML_FOLDER=swc-main >> $GITHUB_ENV
#### TYPST
- name: Install typst_rs
if: ${{ contains(matrix.name, 'TYPST') }}
run: |
wget -q https://github.com/typst/typst/archive/refs/heads/main.zip
unzip -q main.zip
rm main.zip
echo PROJECT_INSTALL_DIR=typst-main/crates/typst-cli >> $GITHUB_ENV
echo PROJECT_CARGO_TOML_FOLDER=typst-main >> $GITHUB_ENV
#### RUSTPYTHON
- name: Install rust_python
if: ${{ contains(matrix.name, 'RUSTPYTHON') }}
run: |
wget -q https://github.com/RustPython/RustPython/archive/refs/heads/main.zip
unzip -q main.zip
rm main.zip
echo PROJECT_INSTALL_DIR=RustPython-main >> $GITHUB_ENV
echo PROJECT_CARGO_TOML_FOLDER=RustPython-main >> $GITHUB_ENV
echo FEATURES="--features encodings" >> $GITHUB_ENV
#################### END OF APPLICATION STEPS ####################
- name: Remove rust_toolchain.toml files and .cargo folders
run: |
find . -name "rust-toolchain.toml" -exec rm -f {} \; || true
find . -name ".cargo" -exec rm -rf {} \; || true
- name: Apply Release patch
run: |
ls -alh
# If PROJECT_CARGO_TOML_FOLDER exists and is not empty, then use it
if [ -n "${{ env.PROJECT_CARGO_TOML_FOLDER }}" ]; then
sed -i '/^\[profile\.release\]/,/^\[.*\]/ { /^\[profile\.release\]/d; /^\[.*\]/!d; }' "${{ env.PROJECT_CARGO_TOML_FOLDER }}/Cargo.toml"
echo "Using PROJECT_CARGO_TOML_FOLDER: ${{ env.PROJECT_CARGO_TOML_FOLDER }}"
echo "[profile.release]" >> "${{ env.PROJECT_CARGO_TOML_FOLDER }}/Cargo.toml"
echo "overflow-checks = true" >> "${{ env.PROJECT_CARGO_TOML_FOLDER }}/Cargo.toml"
echo "debug = true" >> "${{ env.PROJECT_CARGO_TOML_FOLDER }}/Cargo.toml"
# echo "panic = 'abort'" >> "${{ env.PROJECT_CARGO_TOML_FOLDER }}/Cargo.toml"
echo "debug-assertions = true" >> "${{ env.PROJECT_CARGO_TOML_FOLDER }}/Cargo.toml"
echo "lto = \"thin\"" >> "${{ env.PROJECT_CARGO_TOML_FOLDER }}/Cargo.toml"
echo "codegen-units = 1" >> "${{ env.PROJECT_CARGO_TOML_FOLDER }}/Cargo.toml"
else
echo "Using default Cargo.toml"
fi
- name: Compile apps
run: |
# First compile app in normal mode
echo "Compiling in normal mode"
if [ -n "${{ env.FEATURES }}" ]; then
cargo +nightly install --path "${{ env.PROJECT_INSTALL_DIR }}" --locked ${{ env.FEATURES }} --target x86_64-unknown-linux-gnu
else
cargo +nightly install --path "${{ env.PROJECT_INSTALL_DIR }}" --locked --target x86_64-unknown-linux-gnu
fi
sudo cp "$(whereis -b ${{ matrix.binary }} | awk '{print $2}')" /etc/${{ matrix.binary }}_normal
sudo cp "$(whereis -b ${{ matrix.binary }} | awk '{print $2}')" /usr/bin/${{ matrix.binary }}_normal # Additional step, to not shadow it with ASAN version
ldd /etc/${{ matrix.binary }}_normal
# Then compile app in ASAN mode
echo "Compiling in ASAN mode"
if [ -n "${{ env.FEATURES }}" ]; then
RUSTFLAGS="-Zsanitizer=address" cargo +nightly install --path "${{ env.PROJECT_INSTALL_DIR }}" --locked ${{ env.FEATURES }} --target x86_64-unknown-linux-gnu
else
RUSTFLAGS="-Zsanitizer=address" cargo +nightly install --path "${{ env.PROJECT_INSTALL_DIR }}" --locked --target x86_64-unknown-linux-gnu
fi
sudo cp "$(whereis -b ${{ matrix.binary }} | awk '{print $2}')" /etc/${{ matrix.binary }}
ldd /etc/${{ matrix.binary }}
- name: Remove all target/compilation folders and files
run: |
git clean -xqdf
- name: Pack files
run: |
echo "Path to normal binary: /etc/${{ matrix.binary }}_normal"
time 7z a "${{ matrix.binary }}_normal.7z" "/etc/${{ matrix.binary }}_normal"
echo "Path to asan binary: /etc/${{ matrix.binary }}"
time 7z a "${{ matrix.binary }}.7z" "/etc/${{ matrix.binary }}"
ls -al
- name: Release
if: ${{ !endsWith(matrix.name, '1') && !endsWith(matrix.name, '2') && !endsWith(matrix.name, '3') && !endsWith(matrix.name, '4') && !endsWith(matrix.name, '5') && !endsWith(matrix.name, '6') && !endsWith(matrix.name, '7') && !endsWith(matrix.name, '8') && !endsWith(matrix.name, '9') && !endsWith(matrix.name, '0') }}
uses: softprops/action-gh-release@v2
with:
tag_name: "Nightly"
files: |
${{ matrix.binary }}.7z
${{ matrix.binary }}_normal.7z
token: ${{ secrets.PAT2 }}
- name: Install fuzzer
run: cargo install --path .
- name: Create folders
run: |
mkdir /opt/VALID_FILES_DIR
mkdir /opt/POSSIBLY_BROKEN_FILES_DIR
mkdir /opt/BROKEN_FILES_DIR
- name: Download and prepare data files
run: |
CURR_DIR=$(pwd)
cd /opt/VALID_FILES_DIR
python3 "$CURR_DIR/download_helper.py" "${{ matrix.files }}"
cd $CURR_DIR
- name: Run app
run: |
mv ${{ matrix.config-file }} fuzz_settings.toml
sd "TMP_FOLDER_TO_REPLACE" "/tmp/tmp_folder/data" fuzz_settings.toml
if [ "${{ matrix.stability_check }}" = "true" ]; then
sd "check_for_stability = false" "check_for_stability = true" fuzz_settings.toml
fi
export RUST_BACKTRACE=1
# export ASAN_OPTIONS="detect_leaks=0" # TODO - ty leaks memory
automated_fuzzer ${{ matrix.timeout }}
- name: Create broken file to fail ci
run: |
[ "$(ls -A /opt/BROKEN_FILES_DIR)" ] && touch CI_NEEDS_TO_FAIL.txt || true
- name: Store results before
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: FILES___${{ matrix.name }}___before
path: /opt/BROKEN_FILES_DIR
- name: Remove non crashing files
if: ${{ matrix.stability_check == false }}
run: |
sd "remove_non_crashing_items_from_broken_files = false" "remove_non_crashing_items_from_broken_files = true" fuzz_settings.toml
export RUST_BACKTRACE=1
export ASAN_SYMBOLIZER_PATH=$(which llvm-symbolizer-18)
export ASAN_OPTIONS="symbolize=1"
automated_fuzzer
- name: Create broken file to fail ci
run: |
[ "$(ls -A /opt/BROKEN_FILES_DIR)" ] && touch CI_NEEDS_TO_FAIL.txt || true
[ "$(ls -A /tmp/tmp_folder/data)" ] && touch CI_NEEDS_TO_FAIL.txt || true
- name: Store Reports
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: REPORTS___${{ matrix.name }}
path: /tmp/tmp_folder/data
- name: Store results after
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: FILES___${{ matrix.name }}___after
path: /opt/BROKEN_FILES_DIR
- name: Store custom
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: CUSTOM___${{ matrix.name }}
path: /opt/CUSTOM
- name: Remove all folders
run: |
rm -rf /opt/VALID_FILES_DIR || true
rm -rf /opt/POSSIBLY_BROKEN_FILES_DIR || true
- name: Exit when found broken files
run: |
[ "$(ls -A /opt/BROKEN_FILES_DIR)" ] && exit 1 || true
[ -f CI_NEEDS_TO_FAIL.txt ] && exit 1 || true
[ "$(ls -A /opt/CUSTOM)" ] && exit 1 || true