Skip to content

Commit

Permalink
ci: Use govulncheck task to use same version of go as project
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Apr 10, 2024
1 parent 1c49cd5 commit e269f2f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
run: devbox run -- task pre-commit:run
Expand All @@ -171,8 +171,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- id: govulncheck
uses: golang/govulncheck-action@v1
- name: Install devbox
uses: jetpack-io/devbox-install-action@v0.8.0
with:
go-version-file: go.mod
check-latest: true
enable-cache: true

- id: govulncheck
run: devbox run -- task go:vulncheck
1 change: 1 addition & 0 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"golines@latest",
"goreleaser@latest",
"gotestsum@latest",
"govulncheck@latest",
"ko@latest",
"kubernetes-helm@latest",
"pre-commit@latest",
Expand Down
48 changes: 48 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,54 @@
}
}
},
"govulncheck@latest": {
"last_modified": "2024-03-22T11:26:23Z",
"resolved": "github:NixOS/nixpkgs/a3ed7406349a9335cb4c2a71369b697cecd9d351#govulncheck",
"source": "devbox-search",
"version": "1.0.4",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/w6n78s03arv75ymqhzb4lgbi3kx5kx5x-govulncheck-1.0.4",
"default": true
}
],
"store_path": "/nix/store/w6n78s03arv75ymqhzb4lgbi3kx5kx5x-govulncheck-1.0.4"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/vzmbb40a0xy6hr9zw6r4jqhy786qpiaz-govulncheck-1.0.4",
"default": true
}
],
"store_path": "/nix/store/vzmbb40a0xy6hr9zw6r4jqhy786qpiaz-govulncheck-1.0.4"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/zgcyah07vgd222pw8lksr7d4mys2gx1d-govulncheck-1.0.4",
"default": true
}
],
"store_path": "/nix/store/zgcyah07vgd222pw8lksr7d4mys2gx1d-govulncheck-1.0.4"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/6lxqgj80bhikfq3a9azk6mfrlskb4rv2-govulncheck-1.0.4",
"default": true
}
],
"store_path": "/nix/store/6lxqgj80bhikfq3a9azk6mfrlskb4rv2-govulncheck-1.0.4"
}
}
},
"ko@latest": {
"last_modified": "2024-03-22T11:26:23Z",
"resolved": "github:NixOS/nixpkgs/a3ed7406349a9335cb4c2a71369b697cecd9d351#ko",
Expand Down
22 changes: 22 additions & 0 deletions tasks/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,25 @@ tasks:
task: clean-macro
vars:
MODULE_DIR: '{{.GO_SUBMODULE_PATH}}'

vulncheck-macro:
internal: true
dir: '{{.MODULE_DIR}}'
requires:
vars:
- MODULE_DIR
cmds:
- govulncheck ./...

vulncheck:
desc: Runs govulncheck for all modules in repository
vars:
GO_SUBMODULES: '$fd go.mod --min-depth 2 --strip-cwd-prefix --exec echo {//}/'
cmds:
- task: vulncheck-macro
vars:
MODULE_DIR: .
- for: {var: GO_SUBMODULES, as: GO_SUBMODULE_PATH}
task: vulncheck-macro
vars:
MODULE_DIR: '{{.GO_SUBMODULE_PATH}}'

0 comments on commit e269f2f

Please sign in to comment.