Contributing#
kevin builds with gnob, vendored under build/. Bootstrap it once. After that, it rebuilds itself when its sources change:
go generate -C ./build -tags gnob . # bootstrap, once
./build/gnob -help # list every target, with a one-line description each
./build/gnob build # build bin/kevin and bin/kevin-plugin-echo
./bin/kevin -C examples/web run # try it, Ctrl-C to removeRun one test with go test:
go test ./internal/dag/... -run TestName -v
go test -C tests/e2e -tags e2e -run TestName ./... # an end-to-end test: tests/e2e is its own Go modulegolangci-lint (.golangci.yaml) enables every linter, then disables some. The comments in the file give the reason for each. Read them before you add a //nolint. docs/GO_CONVENTIONS.md covers the style rules that the linter cannot check.
See Architecture for how the parts of kevin fit together.
Tests#
kevin has three kinds of test: unit, integration, and end-to-end. ADR-0008 describes them.
To choose where a new test goes, pick the first case that fits:
- The test needs no daemon. Write a unit test next to the code, with fakes.
- The test needs a real dependency such as Docker or a cluster, inspects what kevin left behind, or injects a failure. Write an integration test. Put it in a
*_integration_test.gofile behind theintegrationbuild tag, as GO-017 describes. - A user can see the behavior without knowing how kevin works, and no unit or integration test already proves it. Write an end-to-end test in
tests/e2e, one suite for each user task, with the task named in its doc comment as GO-020 describes.
Run each kind with its own target:
./build/gnob test # unit tests, with the race detector
./build/gnob integration # needs Docker
./build/gnob e2e # needs Docker, drives the built kevin binary
./build/gnob coverage # merge the three runs into coverage/coverage.htmlThe k3d and minikube integration suites need those binaries on PATH. An end-to-end suite skips when a tool it needs (k3d, minikube, kubectl, or Chrome) is missing. Set KEVIN_E2E_CHROME to the path of a Chrome or Chromium binary to use it instead of the browser chromedp finds. A path that does not start a browser also skips the suite.
Changelog#
kevin tracks release notes with changie. Add an entry for each user-visible change:
go tool -modfile=tools.mod changie newPick a kind (Breaking, Added, Changed, or Fixed) and write one line for a reader of the release notes. The entry lands in .changes/unreleased/. Commit it with the change.
./build/gnob release vX.Y.Z batches the entries into .changes/vX.Y.Z.md, regenerates CHANGELOG.md, and uses that file as the GitHub release notes. The release fails when there are no entries. CHANGELOG.md is generated, so edit the entries instead.
This site#
This site is a Hugo site in docs/site/, with the hugo-book theme.
The pages under Reference > Steps and Reference > Commands are generated. Edit internal/plugins/builtin/<type>/reference.md.tmpl and the field comments in schema.cue, or internal/cmd/reference/<command>.md.tmpl, then run ./build/gnob generate.
./build/gnob docs-serve # live preview at http://localhost:1313/
./build/gnob docs-check # build, then fail on links to a missing page or #anchor
./build/gnob docs # build into the gh-pages/ worktreegh-pages/ is a git worktree of the orphan gh-pages branch. ./build/gnob gh-pages creates it, or rebuilds it, and commits the site as the only commit on the branch. To publish, push the branch:
git push --force origin gh-pages