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:
2
.github/workflows/make.yaml
vendored
2
.github/workflows/make.yaml
vendored
@@ -395,7 +395,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
make stack-up &
|
make stack-up &
|
||||||
STACK_PID=$!
|
STACK_PID=$!
|
||||||
SKIP_APPS=1 make bin/probod
|
make bin/probod
|
||||||
wait $STACK_PID
|
wait $STACK_PID
|
||||||
- run: "make stack-ps"
|
- run: "make stack-ps"
|
||||||
- name: "Run e2e tests"
|
- name: "Run e2e tests"
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ Signed-off-by: John Doe <john.doe@example.org>
|
|||||||
4. Build the project:
|
4. Build the project:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
make generate WITH_APPS=1
|
||||||
make build
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ Signed-off-by: John Doe <john.doe@example.org>
|
|||||||
npm -w @probo/console run dev
|
npm -w @probo/console run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
The application should now be running at `http://localhost:3000`
|
The application should now be running at `http://localhost:5173`
|
||||||
|
|
||||||
For detailed information about all Docker services in the development stack, see [Docker Services Documentation](docs/DOCKER_SERVICES.md).
|
For detailed information about all Docker services in the development stack, see [Docker Services Documentation](docs/DOCKER_SERVICES.md).
|
||||||
|
|
||||||
|
|||||||
29
GNUmakefile
29
GNUmakefile
@@ -44,7 +44,7 @@ E2E_COVER_DIR ?= $(CURDIR)/coverage/e2e
|
|||||||
DOCKER_IMAGE_NAME= ghcr.io/getprobo/probo
|
DOCKER_IMAGE_NAME= ghcr.io/getprobo/probo
|
||||||
DOCKER_TAG_NAME?= latest
|
DOCKER_TAG_NAME?= latest
|
||||||
|
|
||||||
PROBOD_BIN_DEPS= pkg/server/api/connect/v1/schema/schema.go \
|
GENERATED= pkg/server/api/connect/v1/schema/schema.go \
|
||||||
pkg/server/api/connect/v1/types/types.go \
|
pkg/server/api/connect/v1/types/types.go \
|
||||||
pkg/server/api/console/v1/schema/schema.go \
|
pkg/server/api/console/v1/schema/schema.go \
|
||||||
pkg/server/api/console/v1/types/types.go \
|
pkg/server/api/console/v1/types/types.go \
|
||||||
@@ -52,7 +52,8 @@ PROBOD_BIN_DEPS= pkg/server/api/connect/v1/schema/schema.go \
|
|||||||
pkg/server/api/trust/v1/types/types.go \
|
pkg/server/api/trust/v1/types/types.go \
|
||||||
pkg/server/api/mcp/v1/server/server.go \
|
pkg/server/api/mcp/v1/server/server.go \
|
||||||
pkg/server/api/mcp/v1/types/types.go \
|
pkg/server/api/mcp/v1/types/types.go \
|
||||||
apps/console/dist/index.html \
|
|
||||||
|
EMBEDDED= apps/console/dist/index.html \
|
||||||
apps/trust/dist/index.html \
|
apps/trust/dist/index.html \
|
||||||
@probo/emails
|
@probo/emails
|
||||||
|
|
||||||
@@ -66,8 +67,9 @@ PRB_SRC= cmd/prb/main.go
|
|||||||
PROBOD_BOOTSTRAP_BIN= bin/probod-bootstrap
|
PROBOD_BOOTSTRAP_BIN= bin/probod-bootstrap
|
||||||
PROBOD_BOOTSTRAP_SRC= cmd/probod-bootstrap/main.go
|
PROBOD_BOOTSTRAP_SRC= cmd/probod-bootstrap/main.go
|
||||||
|
|
||||||
ifndef SKIP_APPS
|
ifdef WITH_APPS
|
||||||
PROBOD_BIN_EXTRA_DEPS += \
|
GENERATED += relay
|
||||||
|
EMBEDDED += \
|
||||||
@probo/console \
|
@probo/console \
|
||||||
@probo/trust
|
@probo/trust
|
||||||
endif
|
endif
|
||||||
@@ -85,7 +87,7 @@ lint-go: vet go-fmt go-fix go-lint
|
|||||||
lint-js: npm-lint
|
lint-js: npm-lint
|
||||||
|
|
||||||
.PHONY: vet
|
.PHONY: vet
|
||||||
vet: generate apps/console/dist/index.html apps/trust/dist/index.html @probo/emails
|
vet: generate embed
|
||||||
$(GO_VET) ./...
|
$(GO_VET) ./...
|
||||||
|
|
||||||
.PHONY: npm-lint
|
.PHONY: npm-lint
|
||||||
@@ -102,7 +104,7 @@ go-fmt:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
.PHONY: go-fix
|
.PHONY: go-fix
|
||||||
go-fix: generate apps/console/dist/index.html apps/trust/dist/index.html @probo/emails
|
go-fix: generate embed
|
||||||
@output="$$($(GO_BASE) fix -diff -omitzero=false ./apps/... ./cmd/... ./packages/... ./pkg/... ./e2e/...)"; \
|
@output="$$($(GO_BASE) fix -diff -omitzero=false ./apps/... ./cmd/... ./packages/... ./pkg/... ./e2e/...)"; \
|
||||||
if [ -n "$$output" ]; then \
|
if [ -n "$$output" ]; then \
|
||||||
echo "error: 'go fix' suggests changes; please apply them"; \
|
echo "error: 'go fix' suggests changes; please apply them"; \
|
||||||
@@ -233,7 +235,7 @@ docker-build:
|
|||||||
$(DOCKER_BUILD) --tag $(DOCKER_IMAGE_NAME):$(DOCKER_TAG_NAME) --file Dockerfile .
|
$(DOCKER_BUILD) --tag $(DOCKER_IMAGE_NAME):$(DOCKER_TAG_NAME) --file Dockerfile .
|
||||||
|
|
||||||
.PHONY: $(PROBOD_BIN)
|
.PHONY: $(PROBOD_BIN)
|
||||||
$(PROBOD_BIN): $(PROBOD_BIN_DEPS) $(PROBOD_BIN_EXTRA_DEPS)
|
$(PROBOD_BIN): generate embed
|
||||||
$(GO_BUILD) -o $(PROBOD_BIN) $(PROBOD_SRC)
|
$(GO_BUILD) -o $(PROBOD_BIN) $(PROBOD_SRC)
|
||||||
|
|
||||||
.PHONY: bin/prb
|
.PHONY: bin/prb
|
||||||
@@ -285,15 +287,10 @@ pkg/server/api/trust/v1/schema.graphql: pkg/server/api/trust/v1/graphql $(TRUST_
|
|||||||
$(NPM) --workspace $@ run build
|
$(NPM) --workspace $@ run build
|
||||||
|
|
||||||
.PHONY: generate
|
.PHONY: generate
|
||||||
generate: pkg/server/api/connect/v1/schema/schema.go \
|
generate: $(GENERATED)
|
||||||
pkg/server/api/connect/v1/types/types.go \
|
|
||||||
pkg/server/api/console/v1/schema/schema.go \
|
.PHONY: embed
|
||||||
pkg/server/api/console/v1/types/types.go \
|
embed: $(EMBEDDED)
|
||||||
pkg/server/api/trust/v1/schema/schema.go \
|
|
||||||
pkg/server/api/trust/v1/types/types.go \
|
|
||||||
pkg/server/api/mcp/v1/server/server.go \
|
|
||||||
pkg/server/api/mcp/v1/types/types.go \
|
|
||||||
relay
|
|
||||||
|
|
||||||
pkg/server/api/connect/v1/schema/schema.go \
|
pkg/server/api/connect/v1/schema/schema.go \
|
||||||
pkg/server/api/connect/v1/types/types.go: pkg/server/api/connect/v1/gqlgen.yaml pkg/server/api/connect/v1/graphql $(CONNECT_GQL)
|
pkg/server/api/connect/v1/types/types.go: pkg/server/api/connect/v1/gqlgen.yaml pkg/server/api/connect/v1/graphql $(CONNECT_GQL)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ E2E tests live in `e2e/console/` (package `console_test`) and run against a live
|
|||||||
## Running tests
|
## Running tests
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
SKIP_APPS=1 make build # Build the binary (backend only)
|
make build # Build the binary (backend only)
|
||||||
make test-e2e # Run all e2e tests
|
make test-e2e # Run all e2e tests
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ Each call creates a unique identity with a fresh email. Available roles: `RoleOw
|
|||||||
## Client methods
|
## Client methods
|
||||||
|
|
||||||
| Method | API | Purpose |
|
| Method | API | Purpose |
|
||||||
|--------|-----|---------|
|
| ----------------------------------------------------- | ------- | --------------------------------- |
|
||||||
| `c.Execute(query, vars, &result)` | Console | Execute and unmarshal into result |
|
| `c.Execute(query, vars, &result)` | Console | Execute and unmarshal into result |
|
||||||
| `c.MustExecute(query, vars, &result)` | Console | Execute, fail test on error |
|
| `c.MustExecute(query, vars, &result)` | Console | Execute, fail test on error |
|
||||||
| `c.ExecuteShouldFail(query, vars)` | Console | Expect error, fail if succeeds |
|
| `c.ExecuteShouldFail(query, vars)` | Console | Expect error, fail if succeeds |
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
|||||||
## Everyday targets
|
## Everyday targets
|
||||||
|
|
||||||
| Target | Purpose |
|
| Target | Purpose |
|
||||||
|---|---|
|
| ---------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||||
| `make build` | Build `bin/probod`, `bin/prb`, and `bin/probod-bootstrap` (includes frontend apps, codegen, and Relay) |
|
| `make build` | Build `bin/probod`, `bin/prb`, and `bin/probod-bootstrap` (does not include frontend apps, codegen, and Relay) |
|
||||||
| `SKIP_APPS=1 make build` | Build without frontend apps (faster for backend-only work) |
|
| `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` | Run tests with race detection and coverage |
|
||||||
| `make test MODULE=./pkg/foo` | Run tests for a single module |
|
| `make test MODULE=./pkg/foo` | Run tests for a single module |
|
||||||
| `make test-verbose` | Tests with verbose output |
|
| `make test-verbose` | Tests with verbose output |
|
||||||
@@ -22,7 +22,7 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
|||||||
## Infrastructure
|
## Infrastructure
|
||||||
|
|
||||||
| Target | Purpose |
|
| Target | Purpose |
|
||||||
|---|---|
|
| ----------------- | ------------------------------------------------------------- |
|
||||||
| `make stack-up` | Start Docker Compose infra (Postgres, Pebble, Keycloak, etc.) |
|
| `make stack-up` | Start Docker Compose infra (Postgres, Pebble, Keycloak, etc.) |
|
||||||
| `make stack-down` | Stop Docker Compose infra |
|
| `make stack-down` | Stop Docker Compose infra |
|
||||||
| `make stack-ps` | List running containers |
|
| `make stack-ps` | List running containers |
|
||||||
@@ -30,7 +30,10 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
|||||||
|
|
||||||
## Codegen
|
## 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/console/v1` — Console GraphQL (gqlgen)
|
||||||
- `go generate ./pkg/server/api/connect/v1` — Connect GraphQL (gqlgen)
|
- `go generate ./pkg/server/api/connect/v1` — Connect GraphQL (gqlgen)
|
||||||
@@ -43,7 +46,7 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
|||||||
## Coverage
|
## Coverage
|
||||||
|
|
||||||
| Target | Purpose |
|
| Target | Purpose |
|
||||||
|---|---|
|
| ------------------------ | ----------------------------------------------------- |
|
||||||
| `make coverage-report` | Unit test HTML coverage report (`coverage.html`) |
|
| `make coverage-report` | Unit test HTML coverage report (`coverage.html`) |
|
||||||
| `make test-e2e-coverage` | E2E coverage report (`coverage-e2e.html`) |
|
| `make test-e2e-coverage` | E2E coverage report (`coverage-e2e.html`) |
|
||||||
| `make coverage-combined` | Combined unit + e2e report (`coverage-combined.html`) |
|
| `make coverage-combined` | Combined unit + e2e report (`coverage-combined.html`) |
|
||||||
@@ -51,7 +54,7 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
|||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
| Target | Purpose |
|
| Target | Purpose |
|
||||||
|---|---|
|
| ------------------- | ------------------------------------------------- |
|
||||||
| `make docker-build` | Build the Docker image (`ghcr.io/getprobo/probo`) |
|
| `make docker-build` | Build the Docker image (`ghcr.io/getprobo/probo`) |
|
||||||
| `make sbom` | Source SBOM (CycloneDX) |
|
| `make sbom` | Source SBOM (CycloneDX) |
|
||||||
| `make sbom-docker` | Docker image SBOM |
|
| `make sbom-docker` | Docker image SBOM |
|
||||||
@@ -61,7 +64,7 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
|||||||
## Sandbox (Lima)
|
## Sandbox (Lima)
|
||||||
|
|
||||||
| Target | Purpose |
|
| Target | Purpose |
|
||||||
|---|---|
|
| --------------------- | ------------------------------------------ |
|
||||||
| `make sandbox-create` | Create a Lima sandbox VM for this worktree |
|
| `make sandbox-create` | Create a Lima sandbox VM for this worktree |
|
||||||
| `make sandbox-start` | Start the VM |
|
| `make sandbox-start` | Start the VM |
|
||||||
| `make sandbox-stop` | Stop (hibernate) the VM |
|
| `make sandbox-stop` | Stop (hibernate) the VM |
|
||||||
@@ -72,8 +75,8 @@ The project uses a `GNUmakefile` at the root. Builds run with `--jobs=$(nproc)`
|
|||||||
## Overridable variables
|
## Overridable variables
|
||||||
|
|
||||||
| Variable | Default | Purpose |
|
| Variable | Default | Purpose |
|
||||||
|---|---|---|
|
| -------------------- | ----------------------------------------- | ------------------------------------------ |
|
||||||
| `SKIP_APPS` | (unset) | Set to `1` to skip frontend app builds |
|
| `WITH_APPS` | (unset) | Set to `1` to generate/build frontend apps |
|
||||||
| `CGO_ENABLED` | `0` | Enable/disable CGO |
|
| `CGO_ENABLED` | `0` | Enable/disable CGO |
|
||||||
| `GOOS` | (host) | Cross-compile target OS |
|
| `GOOS` | (host) | Cross-compile target OS |
|
||||||
| `TEST_FLAGS` | `-race -cover -coverprofile=coverage.out` | Extra flags passed to `go test` |
|
| `TEST_FLAGS` | `-race -cover -coverprofile=coverage.out` | Extra flags passed to `go test` |
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ Use a sandbox when you need to:
|
|||||||
# Start an existing sandbox
|
# Start an existing sandbox
|
||||||
./contrib/lima/sandbox.sh start
|
./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
|
# Get the VM IP and service URLs
|
||||||
./contrib/lima/sandbox.sh status
|
./contrib/lima/sandbox.sh status
|
||||||
|
|
||||||
@@ -39,7 +35,7 @@ Use a sandbox when you need to:
|
|||||||
After `sandbox.sh status`, use the VM IP to access services from the host:
|
After `sandbox.sh status`, use the VM IP to access services from the host:
|
||||||
|
|
||||||
| Service | URL |
|
| Service | URL |
|
||||||
|---|---|
|
| ---------- | --------------------------- |
|
||||||
| Console | `http://<vm-ip>:5173` |
|
| Console | `http://<vm-ip>:5173` |
|
||||||
| Trust | `http://<vm-ip>:5174` |
|
| Trust | `http://<vm-ip>:5174` |
|
||||||
| API | `http://<vm-ip>:8080` |
|
| API | `http://<vm-ip>:8080` |
|
||||||
@@ -75,7 +71,7 @@ This file is sourced during provisioning before `probod-bootstrap` runs. Any var
|
|||||||
The sandbox provisions four systemd services:
|
The sandbox provisions four systemd services:
|
||||||
|
|
||||||
| Service | Description | Starts on boot |
|
| Service | Description | Starts on boot |
|
||||||
|---|---|---|
|
| --------------- | ---------------------------------------------------------- | -------------- |
|
||||||
| `probo-stack` | Docker Compose stack (Postgres, SeaweedFS, Keycloak, etc.) | Yes |
|
| `probo-stack` | Docker Compose stack (Postgres, SeaweedFS, Keycloak, etc.) | Yes |
|
||||||
| `probod` | Probo API server (depends on `probo-stack`) | No |
|
| `probod` | Probo API server (depends on `probo-stack`) | No |
|
||||||
| `probo-console` | Console frontend dev server | No |
|
| `probo-console` | Console frontend dev server | No |
|
||||||
|
|||||||
@@ -145,8 +145,9 @@ if [ -z "$(ls -A /var/lib/probo/node_modules 2>/dev/null)" ]; then
|
|||||||
su - "${LIMA_USER}" -c "cd /workspace && npm ci"
|
su - "${LIMA_USER}" -c "cd /workspace && npm ci"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build bin/probod to get dependencies, notably embedded files
|
# Generate go and ts files for probod and apps, and create embedded files for probod
|
||||||
make -C /workspace bin/probod SKIP_APPS=1
|
make -C /workspace generate WITH_APPS=1
|
||||||
|
make -C /workspace embed
|
||||||
|
|
||||||
echo "VITE_API_URL=http://${VM_IP}:8080" > /workspace/apps/console/.env
|
echo "VITE_API_URL=http://${VM_IP}:8080" > /workspace/apps/console/.env
|
||||||
echo "VITE_API_URL=http://${VM_IP}:8080" > /workspace/apps/trust/.env
|
echo "VITE_API_URL=http://${VM_IP}:8080" > /workspace/apps/trust/.env
|
||||||
|
|||||||
Reference in New Issue
Block a user