mirror of
https://github.com/agresdominik/ci-pipelines.git
synced 2026-07-21 23:30:55 +00:00
45 lines
1.1 KiB
YAML
45 lines
1.1 KiB
YAML
name: Go Test
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
go-version-file:
|
|
description: "Path to go.mod for version resolution"
|
|
type: string
|
|
default: "go.mod"
|
|
run-race:
|
|
description: "Enable race detector"
|
|
type: boolean
|
|
default: true
|
|
timeout:
|
|
description: "Test timeout (go test -timeout)"
|
|
type: string
|
|
default: "20m"
|
|
coverage:
|
|
description: "Upload coverage report as artifact"
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
test:
|
|
name: go test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Run tests
|
|
run: go test -timeout 20m -race -coverprofile=coverage.out -covermode=atomic ./...
|
|
|
|
- name: Upload coverage report
|
|
if: ${{ inputs.coverage }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report
|
|
path: coverage.out
|
|
retention-days: 7
|