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 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 26 additions & 30 deletions website/content/docs/running-staticcheck/ci/github-actions/index.md
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/staticcheck-action@v1.2.0
with:
version: "2022.1.1"
name: "Run CI"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dominikh/staticcheck-action@v1.3.0
with:
version: "2022.1.1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version: "2022.1.1"
version: "2023.1.6"

```

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/setup-go-faster@v1.7.0
with:
go-version: ${{ matrix.go }}
- run: "go test ./..."
- run: "go vet ./..."
- uses: dominikh/staticcheck-action@v1.2.0
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"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: WillAbides/setup-go-faster@v1.13.0
with:
go-version: ${{ matrix.go }}
- run: "go test ./..."
- run: "go vet ./..."
- uses: dominikh/staticcheck-action@v1.3.0
with:
version: "2022.1.1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version: "2022.1.1"
version: "2023.1.6"

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