Skip to content

add code coverage

add code coverage #6

Workflow file for this run

name: Go Test
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: chmod
run: chmod +x ./setup-test.sh
- name: setup tests
run: ./setup-test.sh
- name: Run tests and generate coverage report
run: |
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
verbose: true
name: codecov-umbrella
file: coverage.txt
fail_ci_if_error: true
slug: knbr13/gitcs
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}