feat: add unit test

This commit is contained in:
sagitchu 2025-03-19 08:39:09 +08:00
parent 8a3385b477
commit d09c553b62

View File

@ -22,6 +22,27 @@ on:
- 'main' - 'main'
jobs: jobs:
unit_tests:
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.22
# When you execute your unit tests, make sure to use the "-coverprofile" flag to write a
# coverage profile to a file. You will need the name of the file (e.g. "coverage.txt")
# in the next step as well as the next job.
- name: Test
run: go test -cover -coverprofile=coverage.txt ./...
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
build_tests: build_tests:
name: "Build & Test PR" name: "Build & Test PR"
runs-on: ubuntu-latest runs-on: ubuntu-latest