refactor: use make in CI, pull module in make docs
Instead of duplicating test logic in both the CI and the Makefile, I made the CI call the Makefile. Also, updated `make docs` so it dynamically pulls the module name from `go list -m`.
This commit is contained in:
@@ -34,7 +34,7 @@ jobs:
|
|||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: go test ./... -cover -v
|
run: name test-unit
|
||||||
|
|
||||||
fuzz-test:
|
fuzz-test:
|
||||||
name: Fuzz Tests
|
name: Fuzz Tests
|
||||||
@@ -47,10 +47,7 @@ jobs:
|
|||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Run fuzz tests
|
- name: Run fuzz tests
|
||||||
run: |
|
run: make test-fuzz
|
||||||
for func in $(grep -r --include='*_test.go' -oh 'func Fuzz\w*' . | sed 's/func //'); do
|
|
||||||
go test ./... -fuzz="^${func}$" -fuzztime=30s
|
|
||||||
done
|
|
||||||
|
|
||||||
mutation-test:
|
mutation-test:
|
||||||
name: Mutation Tests
|
name: Mutation Tests
|
||||||
@@ -66,4 +63,4 @@ jobs:
|
|||||||
run: go install github.com/go-gremlins/gremlins/cmd/gremlins@latest
|
run: go install github.com/go-gremlins/gremlins/cmd/gremlins@latest
|
||||||
|
|
||||||
- name: Run mutation tests
|
- name: Run mutation tests
|
||||||
run: gremlins unleash
|
run: make test-mutation
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -33,7 +33,7 @@ lint-makefile: ## Lint the Makefile
|
|||||||
lint: lint-go lint-makefile ## Lint all code
|
lint: lint-go lint-makefile ## Lint all code
|
||||||
|
|
||||||
docs: ## Serve godoc locally
|
docs: ## Serve godoc locally
|
||||||
@echo ">>> Visit: http://localhost:6060/pkg/git.maximhutz.com/tools/dsa/"
|
@echo ">>> Visit: http://localhost:6060/pkg/$$(go list -m)"
|
||||||
godoc -http=:6060
|
godoc -http=:6060
|
||||||
|
|
||||||
clean: ## Clean build and test caches
|
clean: ## Clean build and test caches
|
||||||
|
|||||||
Reference in New Issue
Block a user