2222 allowed_ncov_functions : 0
2323
2424jobs :
25-
2625 build-and-test :
2726 name : Build and Execute Tests
27+ runs-on : ubuntu-22.04
28+ container : ghcr.io/arielswalker/cfsbuildenv-linux:latest
2829
2930 strategy :
3031 fail-fast : false
31- matrix :
32- build-type : [Debug, Release]
33- base-os : [ubuntu-22.04]
34-
35- runs-on : ${{ matrix.base-os }}
3632
3733 steps :
38-
3934 - name : Checkout OSAL
4035 uses : actions/checkout@v4
4136 with :
4237 path : source
4338
44- - name : Install Coverage Analysis Tools
45- if : ${{ matrix.build-type == 'Debug' }}
46- run : sudo apt-get update && sudo apt-get install -y lcov xsltproc && echo "run_lcov=TRUE" >> $GITHUB_ENV
39+ - name : Set CXX environment variable
40+ run : echo "CXX=/usr/bin/g++" >> $GITHUB_ENV
41+
42+ - name : Set run_lcov=TRUE
43+ run : echo "run_lcov=TRUE" >> $GITHUB_ENV
4744
4845 - name : Set up debug environment
49- if : ${{ matrix.build-type == 'Debug' }}
5046 run : |
51- echo "is_debug=TRUE" >> $GITHUB_ENV
52- echo "is_release=FALSE" >> $GITHUB_ENV
53- echo "build_tgt=all" >> $GITHUB_ENV
5447 echo "DESTDIR=${{ github.workspace }}/staging-debug" >> $GITHUB_ENV
5548
56- - name : Set up release environment
57- if : ${{ matrix.build-type == 'Release' }}
58- run : |
59- echo "is_debug=FALSE" >> $GITHUB_ENV
60- echo "is_release=TRUE" >> $GITHUB_ENV
61- echo "build_tgt=install" >> $GITHUB_ENV
62- echo "DESTDIR=${{ github.workspace }}/staging-release" >> $GITHUB_ENV
63-
6449 - name : Set up build
6550 run : cmake
66- -DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
67- -DENABLE_UNIT_TESTS=${{ env.is_debug }}
68- -DOSAL_OMIT_DEPRECATED=${{ env.is_debug }}
69- -DOSAL_VALIDATE_API=${{ env.is_release }}
70- -DOSAL_INSTALL_LIBRARIES=${{ env.is_release }}
71- -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=${{ env.is_debug }}
51+ -DCMAKE_BUILD_TYPE=Debug
52+ -DENABLE_UNIT_TESTS=TRUE
53+ -DOSAL_OMIT_DEPRECATED=FALSE
54+ -DOSAL_VALIDATE_API=FALSE
55+ -DOSAL_INSTALL_LIBRARIES=FALSE
56+ -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE
7257 -DOSAL_SYSTEM_BSPTYPE=generic-linux
7358 -DCMAKE_PREFIX_PATH=/usr/lib/cmake
7459 -DCMAKE_INSTALL_PREFIX=/usr
@@ -79,57 +64,50 @@ jobs:
7964 working-directory : build
8065 run : make ${{ env.build_tgt }} -j2
8166
82- - name : Validate API
83- if : ${{ matrix.build-type == 'Release' }}
84- working-directory : build
85- run : make osal_apicheck
86-
8767 - name : Execute Tests
88- if : ${{ matrix.build-type == 'Debug' }}
8968 working-directory : build
9069 run : ctest --output-on-failure -j4 2>&1 | tee ../ctest.log
9170
9271 - name : Check Coverage
9372 id : stats
94- if : ${{ env.run_lcov == 'TRUE' }}
9573 uses : ./source/.github/actions/check-coverage
9674 with :
9775 binary-dir : build
9876
9977 - name : Enforce coverage function minimum
100- if : ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_functions > env.allowed_ncov_functions }}
78+ if : ${{ always() && steps.stats.outputs.ncov_functions > env.allowed_ncov_functions }}
10179 run : |
10280 echo "::error::Too many uncovered functions (${{ steps.stats.outputs.ncov_functions }})"
10381 /bin/false
10482
10583 - name : Enforce coverage line minimum
106- if : ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_lines > env.allowed_ncov_lines }}
84+ if : ${{ always() && steps.stats.outputs.ncov_lines > env.allowed_ncov_lines }}
10785 run : |
10886 echo "::error::Too many uncovered lines (${{ steps.stats.outputs.ncov_lines }})"
10987 /bin/false
11088
11189 - name : Enforce coverage branch minimum
112- if : ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_branches > env.allowed_ncov_branches }}
90+ if : ${{ always() && steps.stats.outputs.ncov_branches > env.allowed_ncov_branches }}
11391 run : |
11492 echo "::error::Too many uncovered branches (${{ steps.stats.outputs.ncov_branches }})"
11593 /bin/false
11694
11795 - name : Enforce keeping coverage function minimum up-to-date
118- if : ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_functions < env.allowed_ncov_functions }}
96+ if : ${{ always() && steps.stats.outputs.ncov_functions < env.allowed_ncov_functions }}
11997 run : |
12098 echo "::error::${{ steps.stats.outputs.ncov_functions }} uncovered function${{ steps.stats.outputs.ncov_functions == 1 && '' || 's' }} reported, but ${{ env.allowed_ncov_functions }} ${{ env.allowed_ncov_functions == 1 && 'is' || 'are' }} allowed."
12199 echo "::error::Please update the 'allowed_ncov_functions' variable to ${{ steps.stats.outputs.ncov_functions }} in order to match the new coverage level."
122100 /bin/false
123101
124102 - name : Enforce keeping coverage line minimum up-to-date
125- if : ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_lines < env.allowed_ncov_lines }}
103+ if : ${{ always() && steps.stats.outputs.ncov_lines < env.allowed_ncov_lines }}
126104 run : |
127105 echo "::error::${{ steps.stats.outputs.ncov_lines }} uncovered line${{ steps.stats.outputs.ncov_lines == 1 && '' || 's' }} reported, but ${{ env.allowed_ncov_lines }} ${{ env.allowed_ncov_lines == 1 && 'is' || 'are' }} allowed."
128106 echo "::error::Please update the 'allowed_ncov_lines' variable to ${{ steps.stats.outputs.ncov_lines }} in order to match the new coverage level."
129107 /bin/false
130108
131109 - name : Enforce keeping coverage branch minimum up-to-date
132- if : ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_branches < env.allowed_ncov_branches }}
110+ if : ${{ always() && steps.stats.outputs.ncov_branches < env.allowed_ncov_branches }}
133111 run : |
134112 echo "::error::${{ steps.stats.outputs.ncov_branches }} uncovered branch${{ steps.stats.outputs.ncov_branches == 1 && '' || 'es' }} reported, but ${{ env.allowed_ncov_branches }} ${{ env.allowed_ncov_branches == 1 && 'is' || 'are' }} allowed."
135113 echo "::error::Please update the 'allowed_ncov_branches' variable to ${{ steps.stats.outputs.ncov_branches }} in order to match the new coverage level."
0 commit comments