Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: run go vet and staticcheck separately #133

Merged
merged 5 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,17 @@ jobs:
security-events: write

steps:
- name: Checkout repository
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- name: initialize codeql
uses: github/codeql-action/init@v3
with:
languages: go
build-mode: autobuild

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
- name: perform codeql analysis
uses: github/codeql-action/analyze@v3
39 changes: 29 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,52 @@ on:

jobs:
lint:
name: GolangCI Lint
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up go
uses: actions/setup-go@v5
- name: set up go
uses: WillAbides/setup-go-faster@v1
with:
go-version-file: go.mod
- name: Run linter
- name: lint
uses: golangci/golangci-lint-action@v6
with:
version: latest

check:
name: go vet and staticcheck
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: set up go
uses: WillAbides/setup-go-faster@v1
with:
go-version-file: go.mod
- name: run go vet
run: go vet ./...
- name: run staticcheck
uses: dominikh/staticcheck-action@v1
with:
version: latest

tests:
name: Run unit tests with the race detector enabled
name: unit tests with race detector enabled
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up go
uses: actions/setup-go@v5
- name: set up go
uses: WillAbides/setup-go-faster@v1
with:
go-version-file: go.mod
- name: Run unit tests
- name: run unit tests
run: go test -v -race ./...
7 changes: 5 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ linters:
- depguard # enforces that only deps on a whitelist can be used (meant for orgs, not small projects)
- execinquery # deprecated
- exhaustruct
- exportloopref # deprecated
- forbidigo # we need to use fmt.Print*()
- gomnd
- nolintlint
- nonamedreturns
- govet # we run the official go vet separately
- nolintlint # we do occasionally need to suppress linter false positives
- nonamedreturns # named returns often help readability
- paralleltest # tests only take 2.5s to run. no need to parallelize
- staticcheck # dominickh doesn't recommend running staticcheck as part of golangci-lint, so we run Real Staticcheck™ separately
- testpackage
- varnamelen # makes bad suggestions
- wsl
Expand Down
Loading