Bump golangci/golangci-lint-action from 3 to 4 #346
Workflow file for this run
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
on: | |
push: | |
branches: [main] | |
paths-ignore: ['docs/**'] | |
pull_request: | |
branches: [main] | |
paths-ignore: ['docs/**'] | |
schedule: | |
- cron: '0 07 * * 1' # run "At 07:00 on Monday" | |
workflow_call: | |
inputs: | |
skipTests: | |
description: 'Skip tests, useful when there is a dedicated CI job for tests' | |
default: false | |
required: false | |
type: boolean | |
name: Build, lint and test | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: true | |
matrix: | |
# go: ['stable', 'oldstable'] | |
# os: ['ubuntu-22.04', 'ubuntu-latest'] | |
go: [1.21.x] | |
os: [ubuntu-22.04] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
check-latest: true | |
- name: Go Tidy | |
run: go mod tidy && git diff --exit-code | |
- name: Go Mod | |
run: go mod download | |
- name: Go Mod Verify | |
run: go mod verify | |
- name: Install go generate dependencies | |
run: | | |
GO_ENUM_VERSION=v0.5.8 | |
go install github.com/jmattheis/goverter/cmd/[email protected] | |
curl -fsSL "https://github.com/abice/go-enum/releases/download/${GO_ENUM_VERSION}/go-enum_$(uname -s)_$(uname -m)" -o $(go env GOPATH)/bin/go-enum | |
chmod +x $(go env GOPATH)/bin/go-enum | |
- name: Add go/bin to PATH | |
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Go Generate | |
run: go generate ./... && git diff --exit-code | |
- name: Go Build | |
run: go build -o /dev/null ./... | |
test: | |
name: Test | |
needs: build | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: true | |
matrix: | |
# go: ['stable', 'oldstable'] | |
# os: ['ubuntu-22.04', 'ubuntu-latest'] | |
go: [1.21.x] | |
os: [ubuntu-22.04] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
check-latest: true | |
- name: Install test dependencies | |
run: sudo apt-get -y install rrdtool | |
- name: Go Compile Tests | |
if: ${{ inputs.skipTests }} | |
run: go test -exec /bin/true ./... | |
- name: Go Test | |
if: ${{ !inputs.skipTests }} | |
# run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./... | |
run: go test -v -count=1 -race -shuffle=on ./... | |
- name: Go Benchmark | |
if: ${{ !inputs.skipTests }} | |
run: go test -v -shuffle=on -run=- -bench=. -benchtime=1x ./... | |
# - name: Upload Coverage | |
# if: ${{ !inputs.skipTests }} | |
# uses: codecov/codecov-action@v3 | |
# continue-on-error: true | |
# with: | |
# token: ${{secrets.CODECOV_TOKEN}} | |
# file: ./coverage.txt | |
# fail_ci_if_error: false | |
checks: | |
name: Check Makefile and Dockerfile | |
needs: build | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21.x | |
cache: false | |
- name: Check makefile | |
run: make && make clean | |
- name: Check Dockerfile | |
run: docker build . | |
linters: | |
name: Run linters et al | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21.x | |
cache: false | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
# Optional: golangci-lint command line arguments. | |
#args: | |
# Optional: show only new issues if it's a pull request. The default value is `false`. | |
only-new-issues: true | |
- name: Go Format | |
run: gofmt -s -w . && git diff --exit-code | |
- name: Go Vet | |
run: go vet ./... |