microcks / microcks/microcks-cli
ci: add go test, go vet, and staticcheck gates to the build-verify workflow
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 52
- Forks
- 68
- Avg merge
- 6h 54m
- Merged PRs (30d)
- 10
Description
### Reason/Context
The current `build-verify.yml` CI workflow only compiles binaries — it never runs tests, go vet, or any static analysis. This means bugs ship silently and contributors get no automated feedback on correctness.
Proof from the current open PR queue — every one of these bugs existed in `master` and CI never caught them:
1) `req.Body` read instead of `resp.Body` in `DownloadArtifact` → PR #338 (`go vet` catches this)
2) `panic(err.Error())` in connector code → PR #341, #319 (`staticcheck` catches this)
3) `TestDeleteContext` fails on every clean checkout → PR #334 (`go test ./...` catches this)
4) OAuth2 tokens printed unconditionally to stderr → PR #345 (caught by tests with log capture)
5) String-concatenation JSON injection risk → PR #341 (`staticcheck` catches this)
The motivation: CI should be the first line of defence. Right now it is not.
### Description
Add three mandatory quality gates to `build-verify.yml` that run on every PR and push:
1) `go test ./...` — runs the existing unit test suite (currently never executed in CI)
2) `go vet ./...` — Go's built-in analyser, catches real bugs like wrong body reads, bad panic arguments, printf mismatches
3) `staticcheck` — industry-standard linter, zero config, no false positives
Also add `make test` and `make vet` targets to `Makefile` so contributors can run the same checks locally before pushing.
This is not a breaking change — it only adds new CI steps. If existing tests are currently failing on master,
those failures will need to be fixed as part of this PR.
### Implementation ideas
Add before the existing `Build Go packages` step in `.github/workflows/build-verify.yml`:
```yaml
- name: Run unit tests
run: go test ./...
- name: Run go vet
run: go vet ./...
- name: Run staticcheck
uses: dominikh/staticcheck-action@v1
with:
version: latest
install-go: false
`staticcheck` is preferred over `golangci-lint` — zero config, no false positives, directly catches the bug classes above.
Add to `Makefile`:
```makefile
.PHONY: test
test:
go test ./...
.PHONY: vet
vet:
go vet ./...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with .github/workflows/build-verify.yml and the existing Build Go packages step, then inspect Makefile and run the proposed Go checks locally. Done means the workflow runs go test ./..., go vet ./..., and staticcheck on pushes and pull requests, with matching make test and make vet targets and all existing tests passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, go
- Domain
- build-system, ci-cd, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100