@@ -20,41 +20,26 @@ jobs:
20
20
runs-on : ubuntu-latest
21
21
22
22
env :
23
- BUILD_PATH : ${{ github.workspace }}/test/build
23
+ COVERAGE_DATA_PATH : extras/coverage-data/coverage.info
24
24
25
25
steps :
26
26
- name : Checkout repository
27
27
uses : actions/checkout@v2
28
28
29
- - name : Install valgrind
30
- run : sudo apt-get --assume-yes install valgrind
31
-
32
- - name : Run unit tests
33
- run : |
34
- mkdir "$BUILD_PATH"
35
- cd "$BUILD_PATH"
36
- # Generate makefile
37
- cmake ..
38
- # Compile tests
39
- make
40
- # Run tests and check for memory leaks
41
- valgrind --leak-check=yes --error-exitcode=1 bin/test-ArduinoCore-API
42
-
43
- - name : Install lcov
44
- run : sudo apt-get --assume-yes install lcov
45
-
46
- - name : Report code coverage
47
- run : |
48
- cd "$BUILD_PATH"
49
- lcov --directory . --capture --output-file coverage.info
50
- # Remove external files from coverage data
51
- lcov --quiet --remove coverage.info '*/test/*' '/usr/*' --output-file coverage.info
52
- # Print coverage report in the workflow log
53
- lcov --list coverage.info
29
+ # See: https://github.com/arduino/cpp-test-action/blob/main/README.md
30
+ - uses : arduino/cpp-test-action@main
31
+ with :
32
+ source-path : test
33
+ build-path : test/build
34
+ runtime-path : test/build/bin/test-ArduinoCore-API
35
+ coverage-exclude-paths : |
36
+ - '*/test/*'
37
+ - '/usr/*'
38
+ coverage-data-path : ${{ env.COVERAGE_DATA_PATH }}
54
39
55
40
# See: https://github.com/codecov/codecov-action/blob/master/README.md
56
41
- name : Upload coverage report to Codecov
57
42
uses : codecov/codecov-action@v1
58
43
with :
59
- file : ${{ env.BUILD_PATH }}/coverage.info
44
+ file : ${{ env.COVERAGE_DATA_PATH }}
60
45
fail_ci_if_error : true
0 commit comments