test: try to get more accurate coverage #1575
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: build | |
on: | |
push: | |
branches: | |
- master | |
- renovate/** | |
paths-ignore: | |
- "**.md" | |
- ".gitignore" | |
- "samples/**" | |
- "grafana/**" | |
- "systemd/**" | |
- "renovate.json" | |
pull_request: | |
branches: | |
- master | |
paths-ignore: | |
- "**.md" | |
- ".gitignore" | |
- "samples/**" | |
- "grafana/**" | |
- "systemd/**" | |
- "renovate.json" | |
concurrency: | |
group: build-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.2.2 | |
- name: Setup Go | |
uses: actions/setup-go@v5.2.0 | |
with: | |
go-version-file: go.mod | |
- name: Ensure go.mod is already tidied | |
run: go mod tidy && git diff --no-patch --exit-code | |
- name: Run linters | |
uses: golangci/golangci-lint-action@v6.1.1 | |
with: | |
# renovate: depName=golangci/golangci-lint datasource=github-releases | |
version: v1.62.2 | |
args: --timeout=3m0s | |
- name: Run tests | |
run: go test -v -race -coverprofile ./coverage.out -covermode=atomic -timeout 20m ./... | |
- name: Print coverage results | |
run: go tool cover -func ./coverage.out | |
- name: Send coverage | |
uses: codecov/codecov-action@v5.1.2 | |
with: | |
files: coverage.out | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Build with Goreleaser | |
uses: goreleaser/goreleaser-action@v6.1.0 | |
with: | |
# renovate: depName=goreleaser/goreleaser datasource=github-releases | |
version: v2.5.0 | |
args: release --snapshot --skip=publish --clean | |
env: | |
PRIVATE_ACCESS_TOKEN: placeholder |