Merge pull request #1503 from LedgerHQ/cev/clean_linked_list #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unit testing with Codecov coverage checking | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| - develop | |
| pull_request: | |
| jobs: | |
| job_unit_test: | |
| name: Unit test | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest | |
| steps: | |
| - name: Clone | |
| uses: actions/checkout@v4 | |
| - name: Install package libbsd-dev | |
| run: apt-get install -y libbsd-dev | |
| - name: Find test directories | |
| id: find-tests | |
| working-directory: unit-tests | |
| run: | | |
| # Find all directories with CMakeLists.txt, excluding mock | |
| TEST_DIRS=$(find . -maxdepth 2 -name CMakeLists.txt -not -path "*/mock/*" -exec dirname {} \; | sed 's|^\./||' | sort | tr '\n' ' ') | |
| echo "Test directories found: ${TEST_DIRS}" | |
| echo "test_dirs=${TEST_DIRS}" >> "${GITHUB_OUTPUT}" | |
| - name: Build & Run Unit Tests | |
| working-directory: unit-tests | |
| run: | | |
| for dir in ${{ steps.find-tests.outputs.test_dirs }}; do | |
| echo "::group::Building tests in ${dir}" | |
| (cd "${dir}" && cmake -Bbuild -H. && make -C build && CTEST_OUTPUT_ON_FAILURE=1 make -C build test) | |
| echo "::endgroup::" | |
| done | |
| - name: Generate code coverage | |
| working-directory: unit-tests | |
| run: | | |
| for dir in ${{ steps.find-tests.outputs.test_dirs }}; do | |
| echo "::group::Generating coverage for ${dir}" | |
| (cd "${dir}" && ../gen_coverage.sh) | |
| echo "::endgroup::" | |
| done | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: code-coverage | |
| path: unit-tests/*/coverage | |
| - name: Upload to codecov.io | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| directory: ./unit-tests | |
| flags: unittests | |
| name: codecov-ledger-secure-sdk | |
| fail_ci_if_error: true | |
| verbose: true |