This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.makim.yaml
437 lines (386 loc) · 12.2 KB
/
.makim.yaml
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
version: 1.0.0
env:
CFLAGS_EXTRA: "\
-fsanitize=address\
"
ASAN_OPTIONS_DEFAULT: "\
fast_unwind_on_malloc=0\
:verbosity=1\
:strict_string_checks=1\
:check_initialization_order=1\
:strict_init_order=1\
:atexit=1\
:print_legend=1\
:detect_leaks=1\
"
LSAN_OPTIONS_DEFAULT: "\
fast_unwind_on_malloc=0\
:verbosity=1\
:log_threads=1\
:log_pointers=1\
:strict_string_checks=1\
:detect_leaks=1\
"
MESON_EXTRA_DEBUG: "-Db_coverage=true \
-Doptimization=0 \
--debug \
-Db_sanitize=address \
"
groups:
clean:
targets:
gcda:
help: Remove temporary gcda files
run: |
touch tmp.gcda
find . -name "*.gcda" -print0 | xargs -0 rm
all:
help: Remove all unnecessary temporary files
dependencies:
- target: clean.gcda
run: |
rm -rf build/*
rm -f bin/*
mkdir -p build
build:
targets:
install:
help: Install Arx locally
run: meson install -C build
release:
help: Build Arx for release
args:
asan-options:
help: |
Define a custom value for the environment variable
`ASAN_OPTIONS`
type: string
default: ''
lsan-options:
help: |
Define a custom value for the environment variable
`LSAN_OPTIONS`
type: string
default: ''
build-type:
help: |
Define the build type, options are:
plain, debug, debugoptimized, release, minsize, and custom
type: string
default: release
clean:
help: Clean temporary files before the building step
type: bool
action: store_true
meson-extra:
help: Extra arguments for the build step
type: string
default: ''
dependencies:
- target: clean.all
if: {{ args.clean }}
- target: clean.gcda
shell: bash
run: |
export ASAN_OPTIONS='{{ args.asan_options or env.ASAN_OPTIONS_DEFAULT }}'
export LSAN_OPTIONS='{{ args.lsan_options or env.LSAN_OPTIONS_DEFAULT }}'
meson setup \
--prefix $CONDA_PREFIX \
--libdir $CONDA_PREFIX/lib \
--includedir $CONDA_PREFIX/include \
--buildtype={{ args.build_type }} \
--native-file meson.native {{ args.meson_extra }} \
build .
meson compile -C build
debug:
help: Build for debugging (+debug)
args:
clean:
help: Clean temporary files before the building step
type: bool
action: store_true
dependencies:
- target: build.release
args:
build-type: "debug"
meson-extra: {{ env.MESON_EXTRA_DEBUG }}
clean: {{ args.clean }}
asan-options: {{ env.ASAN_OPTIONS_DEFAULT }}
lsan-options: {{ env.LSAN_OPTIONS_DEFAULT }}
dev:
help: Build for development (+tests +debug)
args:
clean:
help: Clean temporary files before the building step
type: bool
action: store_true
dependencies:
- target: build.release
args:
build-type: "debug"
meson-extra: {{ env.MESON_EXTRA_DEBUG }} -Ddev=enabled
clean: {{ args.clean }}
asan-options: {{ env.ASAN_OPTIONS_DEFAULT }}
lsan-options: {{ env.LSAN_OPTIONS_DEFAULT }}
env:
targets:
create-file:
help: Create a .env file
run: |
touch .env
echo -n @("HOST_UID=" + $(id -u) + "HOST_GID=" + $(id -g)) > .env
conda:
targets:
build:
help: Create the conda package for arx
run: |
cd conda/recipe
conda build purge
conda mambabuild .
release:
vars:
app: |
npx --yes \
-p semantic-release \
-p "conventional-changelog-conventionalcommits" \
-p "@semantic-release/commit-analyzer" \
-p "@semantic-release/release-notes-generator" \
-p "@semantic-release/changelog" \
-p "@semantic-release/exec" \
-p "@semantic-release/github" \
-p "@semantic-release/git" \
-p "@google/semantic-release-replace-plugin" \
semantic-release
targets:
ci:
help: Run semantic-release on CI
run: {{ vars.app }} --ci
dry:
help: Run semantic-release on CI for tests in dry-run mode.
run: {{ vars.app }} --dry-run
docs:
targets:
api:
help: Build API docs
run: |
mkdir -p build/docs
doxygen Doxyfile
./scripts/format_releases.sh
build:
help: Build the general docs pages
dependencies:
- target: docs.clean
- target: docs.api
run: |
mkdocs build --config-file docs/mkdocs.yaml --dirty
echo "arxlang.org" > ./build/docs/CNAME
clean:
help: Clean temporary documentation files
run: |
rm -rf ./build/docs
preview:
help: Preview documentation result locally
dependencies:
- target: docs.clean
- target: docs.api
run: mkdocs serve --config-file docs/mkdocs.yaml --watch docs
tests:
shell: bash
# env:
# ASAN_OPTIONS: {{ env.ASAN_OPTIONS_DEFAULT }}
# LSAN_OPTIONS: {{ env.LSAN_OPTIONS_DEFAULT }}
targets:
sanitizer:
help: Run sanitizer tests
run: meson test -C build -v
code-coverage:
help: Check code coverage by tests
run: ninja coverage -C build
gen-object-examples:
help: Run test for object generation
args:
debug:
help: Debug Mode
type: bool
action: store_true
examples-name:
help: Name of the tests to be executed
type: string
default: "constant fibonacci sum average print-star"
shell: bash
run: |
set -e
TMP_DIR=/tmp/arx
rm -f ${TMP_DIR}/*
mkdir -p "${TMP_DIR}"
GDB=""
DEBUG_FLAGS=""
if [[ "{{ args.debug }}" == "True" ]]; then
GDB="gdb core --args"
DEBUG_FLAGS="-g -O0"
fi
TEST_DIR_PATH="./tests"
# load utils functions
. "${TEST_DIR_PATH}/scripts/utils.sh"
ARX="${GDB} ./build/arx --build-lib"
MAIN_EXE="${TMP_DIR}/main"
LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
LLVM_MODULES="core executionengine interpreter analysis native bitwriter"
CLANG_EXTRA="${CLANG_EXTRA} -fno-omit-frame-pointer"
CLANG_EXTRA="${CLANG_EXTRA} $(llvm-config --cxxflags)"
CLANG_EXTRA="${CLANG_EXTRA} $(llvm-config --ldflags --libs ${LLVM_MODULES})"
CLANG_EXTRA="${CLANG_EXTRA} $(pkg-config --cflags --libs arrow-glib)"
CLANG_EXTRA=$(echo "${CLANG_EXTRA}" | sed s/-std=c++14/-std=c++20/g)
rm --force "${TMP_DIR}/*.o"
for test_name in {{ args.examples_name }}; do
print_header "${test_name}"
OBJECT_FILE="${TMP_DIR}/${test_name}.o"
echo "Arx build ..."
${ARX} --output "${OBJECT_FILE}" --input "examples/${test_name}.arx"
echo "clang build ..."
set -x
clang++ \
${CLANG_EXTRA} \
${DEBUG_FLAGS} \
-fPIC \
"${TEST_DIR_PATH}/integration/${test_name}.cpp" \
${OBJECT_FILE} \
-o "${TMP_DIR}/main"
set +x
echo ">>> RUN THE PROGRAM:"
chmod +x ${MAIN_EXE}
${GDB} ${MAIN_EXE}
done
gen-ast-examples:
help: Run test for AST generation
args:
debug:
help: Debug Mode
type: bool
action: store_true
examples-name:
help: Name of the tests to be executed
type: string
default: "constant fibonacci sum average print-star"
run: |
set -e
TMP_DIR=/tmp/arx
mkdir -p "${TMP_DIR}"
GDB=""
if [[ "{{ args.debug }}" == "True" ]]; then
GDB="gdb --args"
fi
TEST_DIR_PATH="./tests"
# load utils functions
. "${TEST_DIR_PATH}/scripts/utils.sh"
ARX="${GDB} ./build/arx"
MAIN_EXE="${TMP_DIR}/main"
for test_name in {{ args.examples_name }}; do
print_header "${test_name}"
${ARX} --show-ast --input "examples/${test_name}.arx"
done
gen-llvm-ir-examples:
help: Run test for LLVM IR
args:
debug:
help: Debug Mode
type: bool
action: store_true
run: |
TMP_DIR=/tmp/arx
mkdir -p "${TMP_DIR}"
GDB=""
if [[ "{{ args.debug }}" == "True" ]]; then
GDB="gdb --args"
fi
TEST_DIR_PATH="./tests"
# load utils functions
. "${TEST_DIR_PATH}/scripts/utils.sh"
ARX="${GDB} ./build/arx"
MAIN_EXE="${TMP_DIR}/main"
for test_name in "constant" "fibonacci" "sum" "average" "print-star"; do
print_header "${test_name}"
${ARX} --show-llvm-ir --input "examples/${test_name}.arx"
done
gen-all-examples:
help: Test all code generation for the example arx files
dependencies:
- target: tests.gen-ast-examples
- target: tests.gen-object-examples
- target: tests.gen-llvm-ir-examples
all:
help: Run sanitizer tests and code generation for examples
dependencies:
- target: tests.sanitizer
- target: tests.gen-all-examples
lint:
help: Run linter tools
run: pre-commit run --all-files --verbose
debug:
targets:
source-build:
help: Debug arx via an example file
args:
example-name:
help: Name of the tests that should be executed
type: string
required: true
debug:
help: Use gdb
type: bool
action: store_true
memory-leak-info:
help: Show ASAN/LSAN information
type: bool
action: store_true
shell: bash
run: |
{% if args.memory_leak_info %}
export ASAN_OPTIONS={{ env.ASAN_OPTIONS_DEFAULT }}
export LSAN_OPTIONS={{ env.LSAN_OPTIONS_DEFAULT }}
{% endif %}
{{ "gdb --args" if args.debug else "" }} build/arx \
--input `pwd`/examples/{{ args.example_name }}.arx \
--output "{{ env.OUTPUT_DIR }}/{{ args.example_name }}.o" \
--build-lib
readelf:
help: Read ELF from an object file
args:
example-name:
help: Name of the tests that should be executed
type: string
required: true
memory-leak-info:
help: Show ASAN/LSAN information
type: bool
action: store_true
dependencies:
- target: debug.source-build
args:
example-name: {{ args.example_name }}
memory-leak-info: {{ args.memory_leak_info }}
run: |
readelf --all "{{ env.OUTPUT_DIR }}/{{ args.example_name }}.o"
objdump:
help: Debug object files using objdump
args:
example-name:
help: Name of the tests that should be executed
type: string
required: true
memory-leak-info:
help: Show ASAN/LSAN information
type: bool
action: store_true
options:
help: Options to be given to objdump
type: string
default: "-d -Mintel"
dependencies:
- target: debug.source-build
args:
example-name: {{ args.example_name }}
memory-leak-info: {{ args.memory_leak_info }}
run: |
objdump {{ args.options }} "{{ env.OUTPUT_DIR }}/{{ args.example_name }}.o"