File tree 1 file changed +56
-0
lines changed
1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Unit Tests
2
+
3
+ on :
4
+ pull_request :
5
+ paths :
6
+ - " .github/workflows/unit-tests.yml"
7
+ - ' extras/test/**'
8
+ - ' src/**'
9
+
10
+ push :
11
+ paths :
12
+ - " .github/workflows/unit-tests.yml"
13
+ - ' extras/test/**'
14
+ - ' src/**'
15
+
16
+ jobs :
17
+ test :
18
+ name : Run unit tests
19
+ runs-on : ubuntu-latest
20
+
21
+ env :
22
+ COVERAGE_DATA_PATH : extras/coverage-data/coverage.info
23
+
24
+ steps :
25
+ - name : Checkout
26
+ uses : actions/checkout@v4
27
+
28
+ - uses : arduino/cpp-test-action@main
29
+ with :
30
+ runtime-paths : |
31
+ - extras/test/build/bin/testNetworkConfigurator
32
+ coverage-exclude-paths : |
33
+ - '*/extras/test/*'
34
+ - '/usr/*'
35
+ coverage-data-path : ${{ env.COVERAGE_DATA_PATH }}
36
+
37
+ # A token is used to avoid intermittent spurious job failures caused by rate limiting.
38
+ - name : Set up Codecov upload token
39
+ run : |
40
+ if [[ "${{ github.repository }}" == "arduino-libraries/Arduino_CloudUtils" ]]; then
41
+ # In order to avoid uploads of data from forks, only use the token for runs in the parent repo.
42
+ # Token is intentionally exposed.
43
+ # See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
44
+ CODECOV_TOKEN="bf6a7f2a-362b-43a8-ac34-c0fd5ef11d6a"
45
+ else
46
+ # codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input.
47
+ CODECOV_TOKEN=""
48
+ fi
49
+ echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> "$GITHUB_ENV"
50
+
51
+ - name : Upload coverage report to Codecov
52
+ uses : codecov/codecov-action@v3
53
+ with :
54
+ file : " ${{ env.COVERAGE_DATA_PATH }}"
55
+ fail_ci_if_error : true
56
+ token : ${{ env.CODECOV_TOKEN }}
You can’t perform that action at this time.
0 commit comments