Files
event/.github/workflows/go.yml
2025-12-19 13:16:45 +08:00

56 lines
1.3 KiB
YAML

name: Unit-Tests
on:
pull_request:
paths:
- 'go.mod'
- '**.go'
- '**.yml'
push:
paths:
- 'go.mod'
- '**.go'
- '**.yml'
jobs:
test:
name: Test on go ${{ matrix.go_version }}
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [1.19, 1.21, 1.22, 1.23, 1.24, 1.25]
steps:
- name: Check out code
uses: actions/checkout@v6
# https://github.com/actions/setup-go
- name: Use Go ${{ matrix.go_version }}
timeout-minutes: 3
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go_version }}
- name: Run unit tests
# run: go test -v -cover ./...
# must add " for profile.cov on Windows OS
run: go test -coverprofile="profile.cov" ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
flag-name: Go-${{ matrix.go_version }}
parallel: true
shallow: true # 忽略请求报错
# notifies that all test jobs are finished.
# https://github.com/shogo82148/actions-goveralls
finish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
shallow: true
parallel-finished: true