From 94f79f234503c4f6a21091888aeaadcdc24fd403 Mon Sep 17 00:00:00 2001 From: Arthur Meyre Date: Wed, 21 Jul 2021 13:52:10 +0200 Subject: [PATCH] chore(tools): update coverage.sh script --- .github/workflows/continuous-integration.yaml | 3 +-- script/actions_utils/coverage.sh | 13 ++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) mode change 100644 => 100755 script/actions_utils/coverage.sh diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index f4a8e1efc..4a35a7038 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -56,8 +56,7 @@ jobs: id: coverage if: ${{ steps.pytest.outcome != 'skipped' && !cancelled() }} run: | - bash --noprofile --norc -o pipefail \ - script/actions_utils/coverage.sh ${{ github.base_ref }} + ./script/actions_utils/coverage.sh ${{ github.base_ref }} - name: Archive test coverage uses: actions/upload-artifact@v2 if: ${{ steps.coverage.outcome != 'skipped' && !cancelled() }} diff --git a/script/actions_utils/coverage.sh b/script/actions_utils/coverage.sh old mode 100644 new mode 100755 index 1882ea005..6389a4e64 --- a/script/actions_utils/coverage.sh +++ b/script/actions_utils/coverage.sh @@ -1,3 +1,8 @@ +#!/usr/bin/env bash + +set -o pipefail +set +e + CURR_DIR=`dirname $0` # Run diff-coverage @@ -9,11 +14,9 @@ poetry run diff-cover coverage.xml --fail-under 100 \ TEST_EXIT_CODE="$?" # Format diff-coverage.txt for PR comment -poetry run python script/actions_utils/coverage_report_format.py \ +poetry run python "$CURR_DIR"/coverage_report_format.py \ --diff-cover-exit-code "$TEST_EXIT_CODE" \ --diff-cover-output diff-coverage.txt -# Set exit code if test failed -if [[ "$TEST_EXIT_CODE" != "0" ]]; then - exit "$TEST_EXIT_CODE" -fi +# Set exit code to the diff coverage check +exit "$TEST_EXIT_CODE"