added bazel builds
This commit is contained in:
1 parent
4c082aca7c
commit
e90c9f324b
23 files changed
+460
-86
No files matched your search
@@ -4,12 +4,12 @@ Rules for anyone, human or AI, changing this repo. Read [ARCHITECTURE.md](ARCHIT
|
||||
|
||||
## Environment
|
||||
|
||||
- `nix develop` (or direnv with `.envrc`) gives Go, gopls, staticcheck, delve and btrfs-progs. Use it rather than system tools.
|
||||
- `nix develop` (or direnv with `.envrc`) gives Go, gopls, staticcheck, delve, bazelisk and btrfs-progs. Use it rather than system tools.
|
||||
- Go code lives in `slackerbot/`, and that's where `go` commands run. Nix files and docs live at the repo root.
|
||||
|
||||
## Versioning
|
||||
|
||||
Versions look like `YYYY.MM.DD-<commit-sha>`. `flake.nix` builds the string from the commit date and short rev (with `-dirty` for uncommitted trees) and passes it to the binary with `-X main.version`. Don't hardcode a version anywhere. `slackerbot -version` prints it, and a plain `go build` reports `dev`.
|
||||
Versions look like `YYYY.MM.DD-<commit-sha>`. `flake.nix` builds the string from the commit date and short rev (with `-dirty` for uncommitted trees) and passes it to the binary with `-X main.version`. Don't hardcode a version anywhere. `slackerbot -version` prints it, and a plain `go build` reports `dev`. Bazel builds the same string in `tools/workspace_status.sh` and stamps it only with `--config=release`.
|
||||
|
||||
## Checks before you finish
|
||||
|
||||
@@ -31,6 +31,7 @@ nix flake check --no-build
|
||||
|
||||
- Flakes only see files tracked by git. `git add` new files before a nix build.
|
||||
- After changing Go dependencies, run `go mod tidy`, then set `vendorHash` in `flake.nix` to the `got:` hash the next `nix build .#slackerbot` prints.
|
||||
- Bazel sits alongside Nix and reads the same `go.mod`. When you add, remove or move a Go file, package or import, run `bazel run //:gazelle` from the repo root and commit the updated `BUILD.bazel` files. After changing Go dependencies, run `bazel mod tidy` as well. `bazel test //...` must pass. Gazelle keeps hand-added attributes such as `data`, `pure` and `x_defs`.
|
||||
- The Nix build skips tests (`doCheck = false`), because they open local ports and read `../config.example.toml`. `go test` is the real test run.
|
||||
- Tests need no root, btrfs or Slack. The manager and bot tests start a real master and slave over TLS on `127.0.0.1` using fake nodes (`internal/testutil`). Code that shells out to `btrfs`, `systemd-run` or D-Bus (`local`, parts of `storage`) has no automated tests, so test it by hand on a btrfs host.
|
||||
|
||||
|
||||
Reference in new issue
Block a user