Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3df9f93

Browse files
Merge pull request #125 from per1234/ci-unit-test-workflow-update
Use arduino/cpp-test-action in Unit Test CI workflow
2 parents 1891605 + 7592064 commit 3df9f93

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

‎.github/workflows/unit-tests.yml‎

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,26 @@ jobs:
2020
runs-on: ubuntu-latest
2121

2222
env:
23-
BUILD_PATH: ${{ github.workspace }}/test/build
23+
COVERAGE_DATA_PATH: extras/coverage-data/coverage.info
2424

2525
steps:
2626
- name: Checkout repository
2727
uses: actions/checkout@v2
2828

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 }}
5439

5540
# See: https://github.com/codecov/codecov-action/blob/master/README.md
5641
- name: Upload coverage report to Codecov
5742
uses: codecov/codecov-action@v1
5843
with:
59-
file: ${{ env.BUILD_PATH }}/coverage.info
44+
file: ${{ env.COVERAGE_DATA_PATH }}
6045
fail_ci_if_error: true

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /