Skip to content

Test coverage in PRs #450

Test coverage in PRs

Test coverage in PRs #450

Workflow file for this run

name: Unit tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Check style
run: |
make check_style
echo ${{ github.event }}
- name: Install Go Test Coverage
run: make install-go-test-coverage
- name: Build
run: make bin
- name: Test
run: make test
- name: Check test coverage
uses: vladopajic/go-test-coverage@v2
id: go-test-coverage
with:
config: ./.testcoverage.yml
- name: Comment test coverage
if: ${{ github.event.type == 'pull_request' }}
uses: actions/github-script@v7
env:
TOTAL_COVERAGE: ${{ steps.go-test-coverage.outputs.total-coverage }}
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Total test coverage: $TOTAL_COVERAGE%'
})