-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (98 loc) · 2.67 KB
/
ci.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
name: CI
on:
push:
branches:
- main
paths:
- include/**
- src/**
- test/**
- .github/workflows/ci.yml
workflow_dispatch:
jobs:
test:
name: Create NPY files in C and load from Python, vice versa
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
- name: Install Libraries
run: |
python -m pip install --upgrade pip
pip install numpy
- name: Build and Run Tests
run: |
set -x
cd test
mkdir artifacts
make clean
make all
test_exit_code=$(python3 runner.py > test.log; echo $?)
echo $test_exit_code > artifacts/test_exit_code.txt
mv *.log artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@main
with:
name: test
path: test/artifacts
- name: Return error code
run: |
set -x
test_exit_code=$(cat test/artifacts/test_exit_code.txt)
if [ "$test_exit_code" -ne 0 ]; then
echo "some of the test cases fail"
exit 1
else
echo "all test cases success"
fi
memory-leak-check:
name: Check memory leak
runs-on: ubuntu-latest
container:
image: naokihori/alpine-valgrind:1.0
volumes:
- :/home
options: --rm
steps:
- name: Checkout repository
uses: actions/checkout@main
- name: Run tests
run: |
set -x
mkdir -p artifacts
make clean
make all
valgrind_exit_code=$(valgrind \
--leak-check=full \
--error-exitcode=1 \
--xml=yes \
--xml-file=artifacts/valgrind.xml \
./a.out > artifacts/log.out; echo $?)
echo $valgrind_exit_code > artifacts/valgrind_exit_code.txt
- name: Upload artifacts
uses: actions/upload-artifact@main
with:
name: memory-leak-check
path: artifacts
- name: Evaluate Valgrind Exit Code
run: |
set -x
valgrind_exit_code=$(cat artifacts/valgrind_exit_code.txt)
if [ "$valgrind_exit_code" -ne 0 ]; then
echo "Valgrind detected errors"
exit 1
else
echo "Valgrind did not detect any memory leaks"
fi
check-install:
name: Check install script works
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
- name: Install
run: |
bash install.sh install
- name: Uninstall
run: |
bash install.sh uninstall