-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.sh
80 lines (67 loc) · 1.77 KB
/
runner.sh
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
#!/bin/bash
for var in "$@"
do
echo "cmd: $var"
case "$var" in
"docker")
export IMAGE_TAG=aml_tmp
#export IMAGE_TAG_STAB=aml_stab
export IMAGE_TAG_LATEST=aml_latest
# docker pull $IMAGE_TAG_STAB || true
# docker pull $IMAGE_TAG_LATEST || true
docker build --build-arg JOBS=4 --tag $IMAGE_TAG .
# docker push $IMAGE_TAG
# docker pull $IMAGE_TAG
docker run --entrypoint aml_tests $IMAGE_TAG
# docker pull $IMAGE_TAG
docker tag $IMAGE_TAG $IMAGE_TAG_LATEST
# docker push $IMAGE_TAG_LATEST
echo "deploy TODO"
;;
"build")
cmake -S. -B./build \
&& cmake --build ./build -j6 \
&& cmake --build ./build --target package \
&& cmake --build ./build --target test
;;
"tests")
./build/aml_tests
;;
"sample_compile")
export IMAGE_TAG_LATEST=aml_latest
export FILE_INPUT=aml/sample.aml
export FILE_INPUT_DIR="$(dirname($FILE_INPUT))"
export FILE_INPUT_SRC=$PWD/$FILE_INPUT
export FILE_INPUT_DST=/tmp/aml/$FILE_INPUT
echo $FILE_INPUT_DIR
docker run \
--volume=$FILE_INPUT_SRC:$FILE_INPUT_DST:rw \
--volume=logs:/logs:rw \
$IMAGE_TAG_LATEST \
--cmd=compile \
--file_input=$FILE_INPUT_DST \
--file_output=logs/sample.binary \
--log=a \
--level=trace
;;
"sample_execute")
./build/amlc \
--cmd=execute \
--file_input=logs/sample.binary \
--file_output=logs/sample.result \
--log=logs/sample.execute.log \
--level=trace \
&& cat logs/sample.result;
;;
*)
echo "ERROR: unknown cmd $var"
;;
esac
RC=$?
echo ""
date;
echo "code: $RC"
if [ $RC -ne 0 ]; then
exit $RC
fi
done