Skip to content

Add test coverage

Add test coverage #25

Workflow file for this run

name: Tests
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
run-tests:
name: "Run Go tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
- name: Display Go version
run: go version
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: '8.0'
- name: Print env
run: |
echo ${{ github.ref_name }}
echo ${{ github.head_ref }}
- name: Run Test
run: |
go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: Check test coverage
uses: vladopajic/go-test-coverage@v2
with:
profile: cover.out
git-token: ${{ secrets.GITHUB_TOKEN }}
git-branch: badges
git-file-name: .badges/${{ github.head_ref || github.ref_name }}/coverage.svg