This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
Merge pull request #2046 from smit-modi/trigger-test-hook #2200
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: Lint and Test | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
lint_and_test: | |
name: Lint and Test - ${{ matrix.go-version }} | |
strategy: | |
matrix: | |
go-version: [1.22.x, 1.23.x, 1.x] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache: false | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Lint package | |
uses: golangci/golangci-lint-action@v5 | |
with: | |
version: latest | |
- name: Test package | |
run: | | |
go test -v ./... -coverprofile=coverage.txt -covermode count | |
go tool cover -func coverage.txt | |
- name: Update coverage report | |
uses: ncruces/go-coverage-report@v0.3.0 | |
with: | |
report: 'true' | |
amend: 'true' | |
reuse-go: 'true' | |
if: | |
# Only run for the latest Go version to avoid race conditions | |
github.event_name == 'push' && matrix.go-version == '1.20.x' | |
continue-on-error: true |