From 471a3a453927fea4365ab31de20321b5d284accd Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Sat, 23 Sep 2023 20:16:44 +1000 Subject: [PATCH] Fix #1417, Fix #1418, Fix workflow bug and enforce updating of coverage minimums --- .github/workflows/standalone-build.yml | 29 ++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/standalone-build.yml b/.github/workflows/standalone-build.yml index 21a647306..93d6e23ab 100644 --- a/.github/workflows/standalone-build.yml +++ b/.github/workflows/standalone-build.yml @@ -34,7 +34,7 @@ jobs: path: source - name: Install Coverage Analysis Tools - if: ${{ matrix.build-type == 'Debug' && matrix.base-os == 'ubuntu-20.04' }} + if: ${{ matrix.build-type == 'Debug' }} run: sudo apt-get install -y lcov xsltproc && echo "run_lcov=TRUE" >> $GITHUB_ENV - name: Set up debug environment @@ -89,23 +89,44 @@ jobs: binary-dir: build - name: Enforce coverage function minimum - if: ${{ always() && steps.stats.outputs.ncov_functions > env.allowed_ncov_functions }} + if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_functions > env.allowed_ncov_functions }} run: | echo "::error::Too many uncovered functions (${{ steps.stats.outputs.ncov_functions }})" /bin/false - name: Enforce coverage line minimum - if: ${{ always() && steps.stats.outputs.ncov_lines > env.allowed_ncov_lines }} + if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_lines > env.allowed_ncov_lines }} run: | echo "::error::Too many uncovered lines (${{ steps.stats.outputs.ncov_lines }})" /bin/false - name: Enforce coverage branch minimum - if: ${{ always() && steps.stats.outputs.ncov_branches > env.allowed_ncov_branches }} + if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_branches > env.allowed_ncov_branches }} run: | echo "::error::Too many uncovered branches (${{ steps.stats.outputs.ncov_branches }})" /bin/false + - name: Enforce keeping coverage function minimum up-to-date + if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_functions < env.allowed_ncov_functions }} + run: | + echo "::error::${{ steps.stats.outputs.ncov_functions }} uncovered function(s) reported, but ${{ env.allowed_ncov_functions }} are allowed." + echo "::error::Please update (lower) the allowed_ncov_functions variable to ${{ steps.stats.outputs.ncov_functions }} in order to match the new coverage level." + /bin/false + + - name: Enforce keeping coverage line minimum up-to-date + if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_lines < env.allowed_ncov_lines }} + run: | + echo "::error::${{ steps.stats.outputs.ncov_lines }} uncovered line(s) reported, but ${{ env.allowed_ncov_lines }} are allwoed." + echo "::error::Please update (lower) the allowed_ncov_lines variable to ${{ steps.stats.outputs.ncov_lines }} in order to match the new coverage level." + /bin/false + + - name: Enforce keeping coverage branch minimum up-to-date + if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_branches < env.allowed_ncov_branches }} + run: | + echo "::error::${{ steps.stats.outputs.ncov_branches }} uncovered branch(es) reported, but ${{ env.allowed_ncov_branches }} are allowed." + echo "::error::Please update (lower) the allowed_ncov_branches variable to ${{ steps.stats.outputs.ncov_branches }} in order to match the new coverage level." + /bin/false + - name: Assemble Results if: ${{ always() }} run: |