新增 Github Actions

This commit is contained in:
dragon
2025-09-25 10:19:13 +08:00
parent abba011a61
commit 9a425a057e
4 changed files with 95 additions and 4 deletions

36
.github/workflows/go-test.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Go Test
on:
push:
branches: [ "main" ]
paths:
- '**.go'
- 'go.mod'
pull_request:
branches: [ "main" ]
paths:
- '**.go'
- 'go.mod'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Install dependencies
run: go mod download
- name: Run tests with coverage
run: go test -v -coverprofile=coverage.txt ./...
- uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}