1+ name : Unit Tests
2+
3+ on :
4+ pull_request :
5+ # Only run workflow if a file in these paths is modified
6+ paths :
7+ - " .github/workflows/unit-tests.yml"
8+ - " ArduinoCore-API/test/**"
9+ - " ArduinoCore-API/api/**"
10+
11+ push :
12+ paths :
13+ - " .github/workflows/unit-tests.yml"
14+ - " ArduinoCore-API/test/**"
15+ - " ArduinoCore-API/api/**"
16+
17+ jobs :
18+ test :
19+ name : Run unit tests
20+ runs-on : ubuntu-latest
21+
22+ env :
23+ COVERAGE_DATA_PATH : extras/coverage-data/coverage.info
24+
25+ steps :
26+ - name : Checkout repository
27+ uses : actions/checkout@v2
28+
29+ - name : Create link to String.h
30+ run : echo '#include "WString.h"' > ArduinoCore-API/api/String.h
31+
32+ - name : Create link to String.cpp
33+ run : echo '#include "WString.cpp"' > ArduinoCore-API/api/String.cpp
34+
35+ - name : Fix catch lib issues
36+ run : echo 'add_compile_definitions(CATCH_CONFIG_NO_POSIX_SIGNALS)' >> ArduinoCore-API/test/CMakeLists.txt
37+
38+ - name : Relax some warings
39+ # run: echo 'add_compile_options(-Wno-unused-function)' >> ArduinoCore-API/test/CMakeLists.txt
40+ # run: echo 'add_compile_options(-Wno-error=all)' >> ArduinoCore-API/test/CMakeLists.txt
41+ # run: echo 'add_compile_options(-Wno-error=unused-function)' >> ArduinoCore-API/test/CMakeLists.txt
42+ run : sed -i 's/-Werror//g' ArduinoCore-API/test/CMakeLists.txt
43+
44+
45+ # See: https://github.com/arduino/cpp-test-action/blob/main/README.md
46+ - uses : arduino/cpp-test-action@main
47+ with :
48+ source-path : ArduinoCore-API/test
49+ build-path : ArduinoCore-API/test/build
50+ runtime-path : ArduinoCore-API/test/build/bin/test-ArduinoCore-API
51+ coverage-exclude-paths : |
52+ - '*/test/*'
53+ - '/usr/*'
54+ coverage-data-path : ${{ env.COVERAGE_DATA_PATH }}
55+
56+ # Temporary excluded to prevent token requirement
57+ # See: https://github.com/codecov/codecov-action/blob/master/README.md
58+ # - name: Code coverage
59+ # uses: codecov/codecov-action@v3
60+ # with:
61+ # token: ${{ secrets.CODECOV_TOKEN }}
62+ # files: ${{ env.COVERAGE_DATA_PATH }}
63+ # fail_ci_if_error: true
0 commit comments