From d09c553b6281039ff590ff8036bfb1941fb8668d Mon Sep 17 00:00:00 2001 From: sagitchu <601096721@qq.com> Date: Wed, 19 Mar 2025 08:39:09 +0800 Subject: [PATCH] feat: add unit test --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad080332..f5061399 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,27 @@ on: - 'main' 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: name: "Build & Test PR" runs-on: ubuntu-latest