-
Notifications
You must be signed in to change notification settings - Fork 7
58 lines (54 loc) · 1.88 KB
/
build_tests_and_analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Build, test (unit, functional) and scan the application
on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:
jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: compiled_app_binaries
ragger_tests:
name: Run ragger tests using the reusable workflow
needs: build_application
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: compiled_app_binaries
run_for_devices: '["stax", "flex"]'
unittesting:
name: C unit testing
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Install cmocka
run: |
sudo apt update
sudo apt install libcmocka-dev lcov libsodium-dev
- name: Compile the tests
run: |
cd tests/unit/
rm -rf build/
cmake -B build -H.
make -C build
- name: Run the tests
run: |
cd tests/unit/
CTEST_OUTPUT_ON_FAILURE=1 make -C build test
- name: Generate code coverage
run: |
cd tests/unit/
lcov --directory . -b "$(realpath build/)" --capture --initial -o coverage.base
lcov --rc lcov_branch_coverage=1 --directory . -b "$(realpath build/)" --capture -o coverage.capture
lcov --directory . -b "$(realpath build/)" --add-tracefile coverage.base --add-tracefile coverage.capture -o coverage.info
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info
genhtml coverage.info -o coverage
- uses: actions/upload-artifact@v3
with:
name: code-coverage
path: tests/unit/coverage