Create targets for generate and embed, replace SKIP_APPS with WITH_APPS
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -5,8 +5,8 @@ E2E tests live in `e2e/console/` (package `console_test`) and run against a live
|
||||
## Running tests
|
||||
|
||||
```bash
|
||||
SKIP_APPS=1 make build # Build the binary (backend only)
|
||||
make test-e2e # Run all e2e tests
|
||||
make build # Build the binary (backend only)
|
||||
make test-e2e # Run all e2e tests
|
||||
```
|
||||
|
||||
## Client setup
|
||||
@@ -26,16 +26,16 @@ Each call creates a unique identity with a fresh email. Available roles: `RoleOw
|
||||
|
||||
## Client methods
|
||||
|
||||
| Method | API | Purpose |
|
||||
|--------|-----|---------|
|
||||
| `c.Execute(query, vars, &result)` | Console | Execute and unmarshal into result |
|
||||
| `c.MustExecute(query, vars, &result)` | Console | Execute, fail test on error |
|
||||
| `c.ExecuteShouldFail(query, vars)` | Console | Expect error, fail if succeeds |
|
||||
| `c.Do(query, vars)` | Console | Low-level, returns raw response |
|
||||
| `c.ExecuteConnect(query, vars, &result)` | Connect | For auth operations |
|
||||
| `c.ExecuteWithFile(query, vars, path, file, &result)` | Console | Single file upload |
|
||||
| `c.GetOrganizationID()` | — | Current org GID |
|
||||
| `c.GetUserID()` | — | Current user GID |
|
||||
| Method | API | Purpose |
|
||||
| ----------------------------------------------------- | ------- | --------------------------------- |
|
||||
| `c.Execute(query, vars, &result)` | Console | Execute and unmarshal into result |
|
||||
| `c.MustExecute(query, vars, &result)` | Console | Execute, fail test on error |
|
||||
| `c.ExecuteShouldFail(query, vars)` | Console | Expect error, fail if succeeds |
|
||||
| `c.Do(query, vars)` | Console | Low-level, returns raw response |
|
||||
| `c.ExecuteConnect(query, vars, &result)` | Connect | For auth operations |
|
||||
| `c.ExecuteWithFile(query, vars, path, file, &result)` | Console | Single file upload |
|
||||
| `c.GetOrganizationID()` | — | Current org GID |
|
||||
| `c.GetUserID()` | — | Current user GID |
|
||||
|
||||
## Test data factories
|
||||
|
||||
|
||||
@@ -4,33 +4,36 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
||||
|
||||
## Everyday targets
|
||||
|
||||
| Target | Purpose |
|
||||
|---|---|
|
||||
| `make build` | Build `bin/probod`, `bin/prb`, and `bin/probod-bootstrap` (includes frontend apps, codegen, and Relay) |
|
||||
| `SKIP_APPS=1 make build` | Build without frontend apps (faster for backend-only work) |
|
||||
| `make test` | Run tests with race detection and coverage |
|
||||
| `make test MODULE=./pkg/foo` | Run tests for a single module |
|
||||
| `make test-verbose` | Tests with verbose output |
|
||||
| `make test-short` | Short tests only |
|
||||
| `make test-bench` | Run benchmarks |
|
||||
| `make test-e2e` | Run console end-to-end tests (requires `bin/probod`) |
|
||||
| `make lint` | Run all linters: `vet` + `go-fmt` + `go-fix` + `go-lint` + `npm-lint` |
|
||||
| `make fmt` | Format Go code (`go fmt ./...`) |
|
||||
| `make clean` | Remove all build artifacts, `node_modules`, generated files, and coverage |
|
||||
| `make help` | List targets with `##` doc comments |
|
||||
| Target | Purpose |
|
||||
| ---------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| `make build` | Build `bin/probod`, `bin/prb`, and `bin/probod-bootstrap` (does not include frontend apps, codegen, and Relay) |
|
||||
| `make build WITH_APPS=1` | Build `bin/probod`, `bin/prb`, and `bin/probod-bootstrap` (includes frontend apps, codegen, and Relay) |
|
||||
| `make test` | Run tests with race detection and coverage |
|
||||
| `make test MODULE=./pkg/foo` | Run tests for a single module |
|
||||
| `make test-verbose` | Tests with verbose output |
|
||||
| `make test-short` | Short tests only |
|
||||
| `make test-bench` | Run benchmarks |
|
||||
| `make test-e2e` | Run console end-to-end tests (requires `bin/probod`) |
|
||||
| `make lint` | Run all linters: `vet` + `go-fmt` + `go-fix` + `go-lint` + `npm-lint` |
|
||||
| `make fmt` | Format Go code (`go fmt ./...`) |
|
||||
| `make clean` | Remove all build artifacts, `node_modules`, generated files, and coverage |
|
||||
| `make help` | List targets with `##` doc comments |
|
||||
|
||||
## Infrastructure
|
||||
|
||||
| Target | Purpose |
|
||||
|---|---|
|
||||
| `make stack-up` | Start Docker Compose infra (Postgres, Pebble, Keycloak, etc.) |
|
||||
| `make stack-down` | Stop Docker Compose infra |
|
||||
| `make stack-ps` | List running containers |
|
||||
| `make psql` | Open a `psql` shell to the dev Postgres database |
|
||||
| Target | Purpose |
|
||||
| ----------------- | ------------------------------------------------------------- |
|
||||
| `make stack-up` | Start Docker Compose infra (Postgres, Pebble, Keycloak, etc.) |
|
||||
| `make stack-down` | Stop Docker Compose infra |
|
||||
| `make stack-ps` | List running containers |
|
||||
| `make psql` | Open a `psql` shell to the dev Postgres database |
|
||||
|
||||
## Codegen
|
||||
|
||||
`make generate` runs all code generation (GraphQL + MCP + Relay). Individual codegen is driven by `go generate`:
|
||||
`make generate` runs go code generation (GraphQL + MCP without Relay).
|
||||
`make generate WITH_APPS=1` runs all code generation (GraphQL + MCP + Relay).
|
||||
|
||||
Individual codegen is driven by `go generate`:
|
||||
|
||||
- `go generate ./pkg/server/api/console/v1` — Console GraphQL (gqlgen)
|
||||
- `go generate ./pkg/server/api/connect/v1` — Connect GraphQL (gqlgen)
|
||||
@@ -42,39 +45,39 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
||||
|
||||
## Coverage
|
||||
|
||||
| Target | Purpose |
|
||||
|---|---|
|
||||
| `make coverage-report` | Unit test HTML coverage report (`coverage.html`) |
|
||||
| `make test-e2e-coverage` | E2E coverage report (`coverage-e2e.html`) |
|
||||
| Target | Purpose |
|
||||
| ------------------------ | ----------------------------------------------------- |
|
||||
| `make coverage-report` | Unit test HTML coverage report (`coverage.html`) |
|
||||
| `make test-e2e-coverage` | E2E coverage report (`coverage-e2e.html`) |
|
||||
| `make coverage-combined` | Combined unit + e2e report (`coverage-combined.html`) |
|
||||
|
||||
## Docker
|
||||
|
||||
| Target | Purpose |
|
||||
|---|---|
|
||||
| Target | Purpose |
|
||||
| ------------------- | ------------------------------------------------- |
|
||||
| `make docker-build` | Build the Docker image (`ghcr.io/getprobo/probo`) |
|
||||
| `make sbom` | Source SBOM (CycloneDX) |
|
||||
| `make sbom-docker` | Docker image SBOM |
|
||||
| `make scan` | Vulnerability scan (Grype) on source + Docker |
|
||||
| `make scan-license` | License compliance scan (Trivy) |
|
||||
| `make sbom` | Source SBOM (CycloneDX) |
|
||||
| `make sbom-docker` | Docker image SBOM |
|
||||
| `make scan` | Vulnerability scan (Grype) on source + Docker |
|
||||
| `make scan-license` | License compliance scan (Trivy) |
|
||||
|
||||
## Sandbox (Lima)
|
||||
|
||||
| Target | Purpose |
|
||||
|---|---|
|
||||
| Target | Purpose |
|
||||
| --------------------- | ------------------------------------------ |
|
||||
| `make sandbox-create` | Create a Lima sandbox VM for this worktree |
|
||||
| `make sandbox-start` | Start the VM |
|
||||
| `make sandbox-stop` | Stop (hibernate) the VM |
|
||||
| `make sandbox-delete` | Delete the VM |
|
||||
| `make sandbox-ssh` | Open a shell in the VM |
|
||||
| `make sandbox-status` | Show VM status and IP |
|
||||
| `make sandbox-start` | Start the VM |
|
||||
| `make sandbox-stop` | Stop (hibernate) the VM |
|
||||
| `make sandbox-delete` | Delete the VM |
|
||||
| `make sandbox-ssh` | Open a shell in the VM |
|
||||
| `make sandbox-status` | Show VM status and IP |
|
||||
|
||||
## Overridable variables
|
||||
|
||||
| Variable | Default | Purpose |
|
||||
|---|---|---|
|
||||
| `SKIP_APPS` | (unset) | Set to `1` to skip frontend app builds |
|
||||
| `CGO_ENABLED` | `0` | Enable/disable CGO |
|
||||
| `GOOS` | (host) | Cross-compile target OS |
|
||||
| `TEST_FLAGS` | `-race -cover -coverprofile=coverage.out` | Extra flags passed to `go test` |
|
||||
| `DOCKER_BUILD_FLAGS` | (empty) | Extra flags for `docker build` |
|
||||
| Variable | Default | Purpose |
|
||||
| -------------------- | ----------------------------------------- | ------------------------------------------ |
|
||||
| `WITH_APPS` | (unset) | Set to `1` to generate/build frontend apps |
|
||||
| `CGO_ENABLED` | `0` | Enable/disable CGO |
|
||||
| `GOOS` | (host) | Cross-compile target OS |
|
||||
| `TEST_FLAGS` | `-race -cover -coverprofile=coverage.out` | Extra flags passed to `go test` |
|
||||
| `DOCKER_BUILD_FLAGS` | (empty) | Extra flags for `docker build` |
|
||||
|
||||
@@ -17,10 +17,6 @@ Use a sandbox when you need to:
|
||||
# Start an existing sandbox
|
||||
./contrib/lima/sandbox.sh start
|
||||
|
||||
# Build and start the app (probo-stack starts automatically on boot)
|
||||
./contrib/lima/sandbox.sh exec -- make build
|
||||
./contrib/lima/sandbox.sh exec -- sudo systemctl start probod probo-console probo-trust
|
||||
|
||||
# Get the VM IP and service URLs
|
||||
./contrib/lima/sandbox.sh status
|
||||
|
||||
@@ -38,14 +34,14 @@ Use a sandbox when you need to:
|
||||
|
||||
After `sandbox.sh status`, use the VM IP to access services from the host:
|
||||
|
||||
| Service | URL |
|
||||
|---|---|
|
||||
| Console | `http://<vm-ip>:5173` |
|
||||
| Trust | `http://<vm-ip>:5174` |
|
||||
| API | `http://<vm-ip>:8080` |
|
||||
| Grafana | `http://<vm-ip>:3001` |
|
||||
| Mailpit | `http://<vm-ip>:8025` |
|
||||
| Keycloak | `http://<vm-ip>:8082` |
|
||||
| Service | URL |
|
||||
| ---------- | --------------------------- |
|
||||
| Console | `http://<vm-ip>:5173` |
|
||||
| Trust | `http://<vm-ip>:5174` |
|
||||
| API | `http://<vm-ip>:8080` |
|
||||
| Grafana | `http://<vm-ip>:3001` |
|
||||
| Mailpit | `http://<vm-ip>:8025` |
|
||||
| Keycloak | `http://<vm-ip>:8082` |
|
||||
| PostgreSQL | `psql -h <vm-ip> -U probod` |
|
||||
|
||||
## Auto-generated configuration
|
||||
@@ -74,12 +70,12 @@ This file is sourced during provisioning before `probod-bootstrap` runs. Any var
|
||||
|
||||
The sandbox provisions four systemd services:
|
||||
|
||||
| Service | Description | Starts on boot |
|
||||
|---|---|---|
|
||||
| `probo-stack` | Docker Compose stack (Postgres, SeaweedFS, Keycloak, etc.) | Yes |
|
||||
| `probod` | Probo API server (depends on `probo-stack`) | No |
|
||||
| `probo-console` | Console frontend dev server | No |
|
||||
| `probo-trust` | Trust frontend dev server | No |
|
||||
| Service | Description | Starts on boot |
|
||||
| --------------- | ---------------------------------------------------------- | -------------- |
|
||||
| `probo-stack` | Docker Compose stack (Postgres, SeaweedFS, Keycloak, etc.) | Yes |
|
||||
| `probod` | Probo API server (depends on `probo-stack`) | No |
|
||||
| `probo-console` | Console frontend dev server | No |
|
||||
| `probo-trust` | Trust frontend dev server | No |
|
||||
|
||||
`probo-stack` starts automatically when the VM boots. `probod`, `probo-console`, and `probo-trust` must be started manually after building.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user