1name: CMock Unit Tests
2on: [push, pull_request]
3
4jobs:
5  run:
6    runs-on: ubuntu-20.04
7    steps:
8    - name: Checkout Parent Repository
9      uses: actions/checkout@v4.1.1
10      with:
11        ref: main
12        repository: FreeRTOS/FreeRTOS
13        submodules: 'recursive'
14        fetch-depth: 1
15
16    # Checkout user pull request changes
17    - name: Checkout Pull Request
18      uses: actions/checkout@v4.1.1
19      with:
20        path: ./FreeRTOS/Source
21
22    - name: Setup Python
23      uses: actions/setup-python@master
24      with:
25        python-version: 3.8
26
27    - name: Install packages
28      run: |
29          sudo apt-get install lcov cflow ruby doxygen build-essential unifdef
30    - name: Run Unit Tests with ENABLE_SANITIZER=1
31      run: |
32          make -C FreeRTOS/Test/CMock clean
33          make -C FreeRTOS/Test/CMock ENABLE_SANITIZER=1 run_col_formatted
34    - name: Run Unit Tests for coverage
35      run: |
36          make -C FreeRTOS/Test/CMock clean
37          make -C FreeRTOS/Test/CMock lcovhtml
38          lcov --config-file FreeRTOS/Test/CMock/lcovrc --summary FreeRTOS/Test/CMock/build/cmock_test.info > FreeRTOS/Test/CMock/build/cmock_test_summary.txt
39    - name: Upload coverage to Codecov
40      uses: codecov/codecov-action@v3.1.0
41      with:
42        files: ${{ github.workspace }}/FreeRTOS/Test/CMock/build/cmock_test.info
43        root_dir: ${{ github.workspace }}/FreeRTOS/Source
44        flags: unittests
45        fail_ci_if_error: false
46        verbose: false
47    - name: Archive code coverage data
48      uses: actions/upload-artifact@v2
49      with:
50        name: coverage-data
51        path: FreeRTOS/Test/CMock/build/cmock_test*
52    - name: Archive code coverage html report
53      uses: actions/upload-artifact@v2
54      with:
55        name: coverage-report
56        path: FreeRTOS/Test/CMock/build/coverage
57