42 lines
960 B
YAML
42 lines
960 B
YAML
name: Go Test and Coverage
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master, dev ]
|
|
pull_request:
|
|
branches: [ main, master, dev ]
|
|
|
|
jobs:
|
|
test:
|
|
name: Run Go Tests
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: ./NewProxy/go.mod
|
|
|
|
- name: Verify Go modules
|
|
working-directory: ./NewProxy
|
|
run: go mod tidy
|
|
|
|
- name: Run unit tests with coverage
|
|
working-directory: ./NewProxy
|
|
run: |
|
|
go test ./... -v -coverpkg=./... -coverprofile=coverage.out
|
|
|
|
- name: Show coverage summary
|
|
working-directory: ./NewProxy
|
|
run: go tool cover -func=coverage.out
|
|
|
|
- name: Upload coverage report
|
|
if: success()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report
|
|
path: NewProxy/coverage.out
|