-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (46 loc) · 1.93 KB
/
Copy pathcode_coverage.yml
File metadata and controls
54 lines (46 loc) · 1.93 KB
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
name: "Code Coverage"
on: [push, pull_request]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
coverage:
name: "Code Coverage"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Get submodules"
run: git submodule update --init --recursive
- name: "Generate coverage report"
run: |
for i in tests/*/; do
x=${i#tests/}
test=${x%/}
echo "Running the test $test..."
echo "Compiling $test.cpp..."
g++ "tests/$test/$test.cpp" -o "$test" -Wall -Wshadow -Wextra -Werror --coverage -std=c++11 -I "headers"
echo "Compiling ${test}_gen.cpp..."
g++ "tests/$test/${test}_gen.cpp" -o "${test}_gen" -Wall -Wshadow -Wextra -Werror -std=c++11 -I "third_party/Tree-Generator"
echo "Compiling ${test}_bf.cpp..."
g++ "tests/$test/${test}_bf.cpp" -o "${test}_bf" -Wall -Wshadow -Wextra -Werror -std=c++11
echo "Compiling ${test}_check.cpp..."
g++ "tests/$test/${test}_check.cpp" -o "${test}_check" -std=c++11 -I "third_party/testlib"
echo "Running ${test}_gen..."
"./${test}_gen" > "$test.in"
echo "Running ${test}..."
"./$test" < "$test.in" > "$test.out"
echo "Running ${test}_bf..."
"./${test}_bf" < "$test.in" > "${test}_bf.out"
echo "Running ${test}_check..."
"./${test}_check" "$test.in" "$test.out" "${test}_bf.out"
echo "Generating coverage report..."
gcov -n -o . "$test.cpp" > /dev/null
echo "The test $test has passed."
done
- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
- name: "Upload failed tests directory"
uses: actions/upload-artifact@v1
if: failure()
with:
name: failed-tests-directory-${{ github.sha }}
path: tests