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

Update staticcheck x GitHub action guide #1487

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
56 changes: 26 additions & 30 deletions website/content/docs/running-staticcheck/ci/github-actions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ on: ["push", "pull_request"]

jobs:
ci:
name: "Run CI"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: dominikh/[email protected]
with:
version: "2022.1.1"
name: "Run CI"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dominikh/[email protected]
with:
version: "2022.1.1"
novalagung marked this conversation as resolved.
Show resolved Hide resolved
```

A more advanced example that runs tests, go vet and Staticcheck on multiple OSs and Go versions looks like this:
Expand All @@ -37,27 +35,25 @@ on: ["push", "pull_request"]

jobs:
ci:
name: "Run CI"
strategy:
fail-fast: false
matrix:
os: ["windows-latest", "ubuntu-latest", "macOS-latest"]
go: ["1.16.x", "1.17.x"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: WillAbides/[email protected]
with:
go-version: ${{ matrix.go }}
- run: "go test ./..."
- run: "go vet ./..."
- uses: dominikh/[email protected]
with:
version: "2022.1.1"
install-go: false
cache-key: ${{ matrix.go }}
name: "Run CI"
strategy:
fail-fast: false
matrix:
os: ["windows-latest", "ubuntu-latest", "macOS-latest"]
go: ["1.17.x", "1.18.x"]
novalagung marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: WillAbides/[email protected]
with:
go-version: ${{ matrix.go }}
- run: "go test ./..."
- run: "go vet ./..."
- uses: dominikh/[email protected]
with:
version: "2022.1.1"
novalagung marked this conversation as resolved.
Show resolved Hide resolved
install-go: false
cache-key: ${{ matrix.go }}
```

Note that this example could benefit from further improvements, such as caching of Go's build cache.
Expand Down