consolidated repo commands in a justfile.
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
# go-heartwood
|
||||
|
||||
## Commands
|
||||
- List available repo commands with `just`
|
||||
|
||||
## Testing
|
||||
- Baseline: `./test dev -race -gcflags "all=-d=checkptr=0" ./...`
|
||||
- Bring up the dev environment: `just up`
|
||||
- Baseline: `just test-race`
|
||||
- During iteration:
|
||||
- All tests: `just test`
|
||||
- Specific tests: `just test -run TestName -v`
|
||||
- Only when analyzing race conditions: `just test-race`
|
||||
- `boltdb/bolt@v1.3.1` triggers a `checkptr` panic under race instrumentation; this is an upstream bug, not a project defect.
|
||||
- Use `just fixtures` to regenerate test fixtures.
|
||||
|
||||
## Quality gate
|
||||
- Run `just fmt && just ci` before staging any changes.
|
||||
|
||||
@@ -24,7 +24,7 @@ const (
|
||||
)
|
||||
|
||||
type fixtureEvent struct {
|
||||
Description string `json:"description"`
|
||||
Description string `json:"description"`
|
||||
Event roots.Event `json:"event"`
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ type Fixtures struct {
|
||||
|
||||
// FixtureEvent is a single entry from the fixtures file.
|
||||
type FixtureEvent struct {
|
||||
Description string `json:"description"`
|
||||
Description string `json:"description"`
|
||||
Event roots.Event `json:"event"`
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# list commands
|
||||
default:
|
||||
just --list
|
||||
|
||||
# build the library
|
||||
build:
|
||||
go build ./...
|
||||
|
||||
# format source files
|
||||
fmt:
|
||||
go fmt ./...
|
||||
|
||||
# check formatting
|
||||
fmt-check:
|
||||
test -z "$(gofmt -l .)"
|
||||
|
||||
# vet source files
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
# tidy go modules
|
||||
tidy:
|
||||
go mod tidy
|
||||
|
||||
# cut a new release version
|
||||
bump *args:
|
||||
./scripts/bump.sh {{ args }}
|
||||
|
||||
# set up the dev environment
|
||||
up:
|
||||
docker compose up -d --wait
|
||||
|
||||
# tear down the dev environment
|
||||
down:
|
||||
docker compose down
|
||||
|
||||
# check the dev environment status
|
||||
ps:
|
||||
docker compose ps -a
|
||||
|
||||
# run tests in the dev environment
|
||||
test *args="./...":
|
||||
docker compose exec test go test {{ args }}
|
||||
|
||||
raceargs := '-race -gcflags "all=-d=checkptr=0"'
|
||||
|
||||
# run race tests in the dev environment
|
||||
test-race *args="./...":
|
||||
docker compose exec test go test {{ raceargs }} {{ args }}
|
||||
|
||||
# run ci tests in a one-shot environment
|
||||
test-ci *args="./...":
|
||||
docker compose run --rm test go test {{ raceargs }} {{ args }}
|
||||
|
||||
# run all checks
|
||||
ci: fmt-check vet test-ci
|
||||
|
||||
# regenerate test fixtures
|
||||
fixtures:
|
||||
go run ./cmd/gen-fixtures
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eou pipefail
|
||||
case "${1:-dev}" in
|
||||
dev) docker compose up -d --wait && docker compose exec test go test "${@:2}" ;;
|
||||
ci) docker compose run --rm test go test "${@:2}" ;;
|
||||
*)
|
||||
echo "Usage: $0 [dev|ci] [go test arguments...]"
|
||||
echo
|
||||
echo "Commands:"
|
||||
echo " dev Start services and run tests in the existing test container (default)."
|
||||
echo " ci Execute tests in a new, one-off container and clean up."
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo " $0 dev ./... -v"
|
||||
echo " $0 ci -run TestSpecificFunction"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user