Skip to content

Notecard OTA

Notecard OTA #1305

Workflow file for this run

name: Unit Tests
on:
pull_request:
paths:
- ".github/workflows/unit-tests.yml"
- 'extras/test/**'
- 'src/**'
push:
paths:
- ".github/workflows/unit-tests.yml"
- 'extras/test/**'
- 'src/**'
jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest
env:
COVERAGE_DATA_PATH: extras/coverage-data/coverage.info
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: arduino/cpp-test-action@main
with:
runtime-paths: |
- extras/test/build/bin/testArduinoIoTCloud
coverage-exclude-paths: |
- '*/extras/test/*'
- '/usr/*'
- '*/src/cbor/lib/*'
coverage-data-path: ${{ env.COVERAGE_DATA_PATH }}
# A token is used to avoid intermittent spurious job failures caused by rate limiting.
- name: Set up Codecov upload token
run: |
if [[ "${{ github.repository }}" == "arduino-libraries/ArduinoIoTCloud" ]]; then
# In order to avoid uploads of data from forks, only use the token for runs in the parent repo.
# Token is intentionally exposed.
# See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
CODECOV_TOKEN="47827969-3fda-4ba1-9506-e8d0834ed88c"
else
# codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input.
CODECOV_TOKEN=""
fi
echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> "$GITHUB_ENV"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
file: "${{ env.COVERAGE_DATA_PATH }}"
fail_ci_if_error: true
token: ${{ env.CODECOV_TOKEN }}