build: unify the gate so root make check covers the backend (closes #16)
check / check (push) Successful in 11s
check / check (push) Successful in 11s
Root make check, and with it the pre-commit hook, now gates the Go backend too. The backend's Makefile targets are shims over backend/script/*; script/cibuild builds both images and is the workflow's only build step. Root make test runs both halves within one 30-second timeout. Root make lint runs golangci-lint only in Docker, by building the lint stage of Dockerfile.backend without the cache; the .golangci.yml drift check moved into backend/script/lint. script/bootstrap installs no linter: it reuses a Go at least as new as backend/go.mod asks for, otherwise installs the pinned, hash-verified release, linked into ~/.local/bin without replacing anything it did not create. With VERSION unset or empty, the backend version falls back to git describe inside a git checkout, then to dev. Model: opus-5-5
This commit was merged in pull request #38.
This commit is contained in:
+35
-3
@@ -4,18 +4,50 @@ SPA and persists them as zstd-compressed JSONL files on disk.
|
||||
|
||||
## Getting Started
|
||||
|
||||
From this directory:
|
||||
|
||||
```bash
|
||||
# Build and run locally
|
||||
make run
|
||||
```
|
||||
|
||||
# Run tests, lint, and format check
|
||||
From the repo root, which is also the build context of `Dockerfile.backend`:
|
||||
|
||||
```bash
|
||||
# Run tests, lint, and format check over the frontend and this backend
|
||||
make check
|
||||
|
||||
# Docker
|
||||
docker build -t netwatch-server .
|
||||
# Build both images, including netwatch-server
|
||||
make docker
|
||||
docker run -p 8080:8080 netwatch-server
|
||||
```
|
||||
|
||||
## Entrypoints
|
||||
|
||||
This directory follows the same
|
||||
[Scripts to Rule Them All](https://github.com/github/scripts-to-rule-them-all)
|
||||
pattern as the repo root: the targets in `backend/Makefile` are thin shims over
|
||||
`backend/script/`. `Dockerfile.backend` runs them, and the root scripts call
|
||||
`test`, `fmt` and `fmt-check`:
|
||||
|
||||
- `script/build` — compile the static `netwatch-server` binary with its version
|
||||
and architecture stamped in. The version is `VERSION` from the environment;
|
||||
when that is unset or empty, it falls back to `git describe` inside a git
|
||||
checkout, then to `dev`
|
||||
- `script/test` — run the Go tests under a 30-second timeout
|
||||
- `script/lint` — check `.golangci.yml` against its pinned sha256, then run
|
||||
golangci-lint. It runs inside the golangci-lint image of the lint stage of
|
||||
`Dockerfile.backend`; from a checkout, run `make lint` at the repo root, which
|
||||
builds that stage
|
||||
- `script/fmt` — format the Go sources (writes)
|
||||
- `script/fmt-check` — check Go formatting (read-only)
|
||||
- `script/run` — build and run the server locally
|
||||
- `script/clean` — remove build artifacts
|
||||
|
||||
There is no `check`, `hooks` or `docker` target here: the root `make check`
|
||||
covers this directory, the root `make hooks` installs the repo's only pre-commit
|
||||
hook, and the root `make docker` builds this image.
|
||||
|
||||
## Rationale
|
||||
|
||||
The NetWatch frontend collects latency measurements from the browser but has no
|
||||
|
||||
Reference in New Issue
Block a user