Re-vendor the shared files from sneak/prompts at dd4027b (closes #113)
check / check (push) Waiting to run
check / check (push) Waiting to run
The shared files are the sneak/prompts copies at dd4027b, plus this repository's own entries. make lint and make test each build one Dockerfile phase without the cache, both covering the frontend; the builder stage waits on both and takes its version from git describe unless VERSION is given. The test phase keeps Go's module and build caches in memory, out of the image make test tags. golangci-lint moves to v2.14.0 with the new .golangci.yml; one test spells X-Request-ID as canonicalheader asks. prettier formats only JavaScript, CSS, HTML and Markdown, so .golangci.yml stays as fetched. script/fmt and script/fmt-check put ~/.local/bin on PATH. script/bootstrap keeps a Go only if it is exactly GO_VERSION, and re-checks the go on PATH after installing. Model: opus-5-5
This commit is contained in:
@@ -41,12 +41,12 @@ halves, so the root `make check` fails if either one is broken. We provide:
|
||||
|
||||
- `script/bootstrap` — install all dependencies (the pinned node via nvm unless
|
||||
one new enough for the frontend's dependencies is installed, yarn via
|
||||
corepack, `yarn install --frozen-lockfile`, the pinned Go unless one at least
|
||||
as new as `backend/go.mod` asks for is installed, the Go modules, and gcc with
|
||||
the C library headers unless gcc is installed, for the race detector in
|
||||
`make test`), linking what it installs itself into `~/.local/bin`, which has
|
||||
to be on `PATH`. It installs no Go linter and not Docker: `make lint` runs
|
||||
both linters in Docker
|
||||
corepack, `yarn install --frozen-lockfile`, Go `GO_VERSION` unless the `go` on
|
||||
`PATH` is exactly that version, the Go modules, and gcc with the C library
|
||||
headers unless gcc is installed, for the race detector in `make test` in
|
||||
`backend/`), linking what it installs itself into `~/.local/bin`, which has to
|
||||
be on `PATH`. It installs no Go linter and not Docker: `make test` and
|
||||
`make lint` run in Docker
|
||||
- `script/setup` — make a fresh clone ready for development: bootstrap plus the
|
||||
git pre-commit hook
|
||||
- `script/dev` — run the Vite dev server, which proxies `/api` to a locally
|
||||
@@ -54,11 +54,14 @@ halves, so the root `make check` fails if either one is broken. We provide:
|
||||
- `script/build` — build the frontend for production into `dist/`;
|
||||
`backend/script/build` builds the Go server
|
||||
- `script/projectname` — print the project name (used for the Docker image tag)
|
||||
- `script/test` — run `script/frontend-test`, then `backend/script/test`, the
|
||||
- `script/test` — build the `test` phase of `Dockerfile` without the cache: the
|
||||
frontend's unit tests and production build in its `frontend` stage, and the
|
||||
backend's Go tests with the race detector and coverage
|
||||
- `script/lint` — run eslint, then golangci-lint, both in Docker, by building
|
||||
the `frontend-lint` and `lint` stages of `Dockerfile` without the cache
|
||||
- `script/fmt` — format all files (writes): prettier, then gofmt over `backend/`
|
||||
- `script/lint` — build the `lint` phase of `Dockerfile` without the cache:
|
||||
eslint in its `frontend-lint` stage, and golangci-lint over `backend/`
|
||||
- `script/fmt` — format all files (writes): prettier over the JavaScript, CSS,
|
||||
HTML and Markdown, then gofmt over `backend/`. It runs on the host, as
|
||||
`script/fmt-check` does, with `~/.local/bin` put on `PATH`
|
||||
- `script/fmt-check` — check formatting (read-only): prettier, then gofmt
|
||||
- `script/check` — run test, lint, and fmt-check
|
||||
- `script/add-dependency` — add a frontend package, or move one to another
|
||||
@@ -68,23 +71,18 @@ halves, so the root `make check` fails if either one is broken. We provide:
|
||||
- `script/tidy` — run `go mod tidy` in `backend/`: to add a Go module, import it
|
||||
and run `make tidy`; to move one to another version, edit its `require` line
|
||||
in `backend/go.mod`, then run `make tidy`
|
||||
- `script/frontend-test` — run the unit tests in `test/unit/` with Node's
|
||||
built-in test runner, through the `test` script in `package.json`, and if any
|
||||
fails, run them again listing every test, and fail; then the production build.
|
||||
Each run has a 30-second timeout
|
||||
- `script/frontend-lint` — run eslint with the rules in `eslint.config.js`; it
|
||||
runs inside the `frontend-lint` stage of `Dockerfile`, which `make lint`
|
||||
builds
|
||||
- `script/frontend-fmt` — format everything prettier understands (writes), the
|
||||
markdown in `backend/` included
|
||||
- `script/frontend-test` — run the unit tests in `test/unit/` on the host with
|
||||
Node's built-in test runner, through the `test` script in `package.json`, and
|
||||
if any fails, run them again listing every test, and fail; then the production
|
||||
build. Each test run has a 90-second timeout. `make test` runs the same in
|
||||
Docker
|
||||
- `script/frontend-fmt` — format the JavaScript, CSS, HTML and Markdown with
|
||||
prettier (writes), the markdown in `backend/` included
|
||||
- `script/frontend-fmt-check` — check prettier formatting (read-only)
|
||||
- `script/frontend-check` — run `script/frontend-test` and
|
||||
`script/frontend-fmt-check`, for the frontend stage of `Dockerfile`, which has
|
||||
neither Go nor Docker
|
||||
- `script/frontend-viewport-test` — responsive-layout verification of the built
|
||||
frontend in a containerised headless Chrome (see
|
||||
[test/viewport/README.md](test/viewport/README.md)). Not part of
|
||||
`script/check`: it needs Docker and takes minutes.
|
||||
`script/check`: it takes minutes.
|
||||
- `script/docker` — build the image from `Dockerfile` without the build cache,
|
||||
tagged `netwatch` via `script/projectname`
|
||||
- `script/cibuild` — CI entrypoint: runs `script/bootstrap` and `script/check`,
|
||||
@@ -164,11 +162,11 @@ and when it stops. Its routes:
|
||||
`METRICS_USERNAME` and `METRICS_PASSWORD` are set; each client address may
|
||||
make a limited number of requests to it a minute
|
||||
|
||||
In the image, the `builder` stage of `Dockerfile` tests it and builds it with
|
||||
`backend/script/build`, and `bin/entrypoint.sh` runs it as user `netwatch` on
|
||||
`127.0.0.1:8081`, behind nginx. Outside the image, `make run` in `backend/`
|
||||
builds it and runs it on port 8080. Its settings, report storage and limits are
|
||||
in [backend/README.md](backend/README.md).
|
||||
In the image, the `test` phase of `Dockerfile` tests it, the `builder` stage
|
||||
builds it with `backend/script/build`, and `bin/entrypoint.sh` runs it as user
|
||||
`netwatch` on `127.0.0.1:8081`, behind nginx. Outside the image, `make run` in
|
||||
`backend/` builds it and runs it on port 8080. Its settings, report storage and
|
||||
limits are in [backend/README.md](backend/README.md).
|
||||
|
||||
### Monitoring targets
|
||||
|
||||
|
||||
Reference in New Issue
Block a user