-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There have been some improvements in the tooling in the cloudzero-insights-controller repository which should be brought over to cloudzero-agent-validator to avoid regressions (and smooth out the process) when we merge c-i-c. This includes: * Improvements to the Makefile * Formatting non-Go code with Prettier * Formatting Go code with gofumpt. * Consistent copyright headers in every Go file. * Adding lots of linters / static analysis and fixing the issues they uncover. * Centralize CI checks in a single workflow.
- Loading branch information
Showing
107 changed files
with
996 additions
and
540 deletions.
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
# Run tests | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Install dependencies | ||
run: | | ||
go mod download | ||
- name: Run go tests | ||
run: | | ||
make test-integration | ||
# Run golangci-lint | ||
# | ||
# golangci-lint is a linter for Go. It is a wrapper around a number of | ||
# linters, and is the default linter for this project. | ||
# | ||
# Note that we intentionally do not use the golangci-lint GitHub Action here | ||
# since there is a good chance it will get out of sync with the version used | ||
# in the Makefile. By using the version in the Makefile we make it easy to | ||
# make sure all developers are using the same version, and therefore finding | ||
# the same issues. | ||
lint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Install golangci-lint | ||
run: make install-tools-golangci-lint | ||
- name: Run golangci-lint | ||
run: make lint | ||
|
||
# Run static analysis | ||
analyze: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Install tools | ||
run: make install-tools | ||
- name: Run static analysis | ||
run: make analyze | ||
|
||
# Run govulncheck | ||
# | ||
# govulncheck checks for known vulnerabilities in Go dependencies. Typically | ||
# it would make sense to run this in a separate pipeline, perhaps on a cron | ||
# job, because if it fails it will potentially "break" the CI builds for | ||
# issues unrelated to the commit in question. However, since govulncheck has | ||
# an extremely low rate of false positives (it checks if the vulnerable code | ||
# is actually used, as opposed to there just being a vulnerability somewhere | ||
# in the dependency), I think it is appropriate to force us to fix issues it | ||
# finds ASAP. | ||
govulncheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: govulncheck | ||
uses: golang/govulncheck-action@v1 | ||
with: | ||
go-version-file: go.mod | ||
|
||
# Format code and data | ||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Install tools | ||
run: make install-tools | ||
- name: Format code | ||
run: make format | ||
- name: Check file format | ||
run: git diff --exit-code --color | ||
|
||
generate: # Generate code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Install tools | ||
run: make install-tools | ||
- name: Generate code | ||
run: make generate | ||
- name: Check for modified files | ||
run: git diff --exit-code --color | ||
- name: Debug | ||
run: git ls-files --others | ||
- name: Check for untracked files | ||
run: test -z "$(git ls-files --others --exclude-standard)" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.