Skip to content

Commit

Permalink
github: backend-test: Add tracing to steps for easy debugging
Browse files Browse the repository at this point in the history
So we can see which of the bash commands in a run block are failing.

Signed-off-by: René Dudfield <renedudfield@microsoft.com>
  • Loading branch information
illume committed Jul 2, 2024
1 parent 219a481 commit 4e75623
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/backend-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
- name: Run tests and calculate code coverage
run: |
set -x
cd backend
go test ./... -coverprofile=coverage.out -covermode=atomic -coverpkg=./...
testcoverage=$(go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+')
Expand All @@ -72,6 +73,12 @@ jobs:
- name: Get base branch code coverage
if: ${{ github.event_name }} == 'pull_request'
run: |
set -x
if [[ -z "${{ github.base_ref }}" ]]; then
echo "Base branch is empty. Skipping code coverage comparison."
exit 0
fi
cd backend
base_branch="${{ github.base_ref }}"
testcoverage="${{ env.coverage }}"
Expand All @@ -86,6 +93,12 @@ jobs:
- name: Compare code coverage
if: ${{ github.event_name }} == 'pull_request'
run: |
set -x
if [[ -z "${{ github.base_ref }}" ]]; then
echo "Base branch is empty. Skipping code coverage comparison."
exit 0
fi
testcoverage="${{ env.coverage }}"
base_coverage="${{ env.base_coverage }}"
if [[ -z $testcoverage || -z $base_coverage ]]; then
Expand All @@ -105,6 +118,11 @@ jobs:
- name: Comment on PR
if: ${{ github.event_name }} == 'pull_request'
run: |
set -x
if [[ -z "${{ github.base_ref }}" ]]; then
echo "Base branch is empty. Skipping code coverage comparison."
exit 0
fi
testcoverage="${{ env.coverage }}"
base_coverage="${{ env.base_coverage }}"
coverage_diff="${{ env.coverage_diff }}"
Expand Down

0 comments on commit 4e75623

Please sign in to comment.