Skip to content

Commit 58bf78d

Browse files
authored
docs: add agents documentation and CI validation instructions (#696)
* docs: add agents documentation and CI validation instructions * docs: correct ShellCheck capitalization and update error message in Makefile
1 parent f974104 commit 58bf78d

File tree

3 files changed

+69
-6
lines changed

3 files changed

+69
-6
lines changed

AGENTS.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Agents
2+
3+
## Before committing
4+
5+
Run all CI validations locally before committing changes:
6+
7+
```
8+
make validate-all
9+
```
10+
11+
This runs the same checks as CI:
12+
13+
1. **go mod tidy** — ensures `go.mod`/`go.sum` are clean
14+
2. **Lint** — runs `golangci-lint` (see [`.golangci.yml`](./.golangci.yml) for configuration)
15+
3. **Tests** — runs all unit tests with race detection (`go test -race ./...`)
16+
4. **ShellCheck** — validates all shell scripts
17+
18+
If any step fails, fix the issue and re-run before committing.
19+
20+
### Prerequisites
21+
22+
- **Go 1.25.6+**
23+
- **golangci-lint v2.7.2+**[Install instructions](https://golangci-lint.run/welcome/install/)
24+
- **ShellCheck**`brew install shellcheck` (macOS) or `apt-get install shellcheck` (Linux)
25+
26+
## Project documentation
27+
28+
- [README.md](./README.md) — project overview, building from source, API examples, and Makefile usage
29+
- [METRICS.md](./METRICS.md) — aggregated metrics endpoint documentation
30+
- [Model CLI README](./cmd/cli/README.md) — CLI plugin (`docker model`) documentation
31+
- [Helm chart](./charts/docker-model-runner/README.md) — Kubernetes deployment guide
32+
- [Model Specification](https://github.com/docker/model-spec/blob/main/spec.md) — model packaging specification
33+
- [Docker Docs](https://docs.docker.com/ai/model-runner/get-started/) — official Docker Model Runner documentation

Makefile

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ DOCKER_BUILD_ARGS := \
2626
BUILD_DMR ?= 1
2727

2828
# Main targets
29-
.PHONY: build run clean test integration-tests test-docker-ce-installation docker-build docker-build-multiplatform docker-run docker-build-vllm docker-run-vllm docker-build-sglang docker-run-sglang docker-run-impl help validate lint docker-build-diffusers docker-run-diffusers vllm-metal-build vllm-metal-install vllm-metal-dev vllm-metal-clean build-cli install-cli
29+
.PHONY: build run clean test integration-tests test-docker-ce-installation docker-build docker-build-multiplatform docker-run docker-build-vllm docker-run-vllm docker-build-sglang docker-run-sglang docker-run-impl help validate validate-all lint docker-build-diffusers docker-run-diffusers vllm-metal-build vllm-metal-install vllm-metal-dev vllm-metal-clean build-cli install-cli
3030
# Default target
3131
.DEFAULT_GOAL := build
3232

@@ -89,6 +89,25 @@ lint:
8989
golangci-lint run ./...
9090
@echo "✓ Go linting passed!"
9191

92+
# Run all CI validations locally (use before committing)
93+
validate-all:
94+
@echo "==> Checking go mod tidy..."
95+
@go mod tidy
96+
@git diff --exit-code go.mod go.sum || (echo "ERROR: go.mod/go.sum were not tidy. The files have been updated — please commit the changes." && exit 1)
97+
@echo "✓ go.mod is tidy"
98+
@echo ""
99+
@echo "==> Running linter..."
100+
@$(MAKE) lint
101+
@echo ""
102+
@echo "==> Running tests with race detection..."
103+
@go test -race ./...
104+
@echo "✓ All tests passed!"
105+
@echo ""
106+
@echo "==> Running shellcheck validation..."
107+
@$(MAKE) validate
108+
@echo ""
109+
@echo "==> All validations passed! ✅"
110+
92111
# Build Docker image
93112
docker-build:
94113
docker buildx build $(DOCKER_BUILD_ARGS) .
@@ -226,12 +245,16 @@ vllm-metal-clean:
226245
help:
227246
@echo "Available targets:"
228247
@echo " build - Build the Go application"
248+
@echo " build-cli - Build the CLI (docker-model plugin)"
249+
@echo " install-cli - Build and install the CLI as a Docker plugin"
250+
@echo " docs - Generate CLI documentation"
229251
@echo " run - Run the application locally"
230252
@echo " clean - Clean build artifacts"
231253
@echo " test - Run tests"
232-
@echo " integration-tests - Run integration tests"
254+
@echo " integration-tests - Run integration tests (requires Docker)"
233255
@echo " test-docker-ce-installation - Test Docker CE installation with CLI plugin"
234256
@echo " validate - Run shellcheck validation"
257+
@echo " validate-all - Run all CI validations locally (lint, test, shellcheck, go mod tidy)"
235258
@echo " lint - Run Go linting with golangci-lint"
236259
@echo " docker-build - Build Docker image for current platform"
237260
@echo " docker-build-multiplatform - Build Docker image for multiple platforms"

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,23 @@ MODEL_RUNNER_HOST=http://localhost:13434 ./model-cli list
176176

177177
## Using the Makefile
178178

179-
This project includes a Makefile to simplify common development tasks. It requires Docker Desktop >= 4.41.0
180-
The Makefile provides the following targets:
179+
This project includes a Makefile to simplify common development tasks. Docker targets require Docker Desktop >= 4.41.0.
180+
Run `make help` for a full list, but the key targets are:
181181

182182
- `build` - Build the Go application
183+
- `build-cli` - Build the CLI (`docker-model` plugin)
184+
- `install-cli` - Build and install the CLI as a Docker plugin
185+
- `docs` - Generate CLI documentation
183186
- `run` - Run the application locally
184187
- `clean` - Clean build artifacts
185188
- `test` - Run tests
186-
- `docker-build` - Build the Docker image
189+
- `validate-all` - **Run all CI validations locally** (lint, test, shellcheck, go mod tidy)
190+
- `lint` - Run Go linting with golangci-lint
191+
- `validate` - Run shellcheck validation on shell scripts
192+
- `integration-tests` - Run integration tests (requires Docker)
193+
- `docker-build` - Build the Docker image for current platform
187194
- `docker-run` - Run the application in a Docker container with TCP port access and mounted model storage
188-
- `help` - Show available targets
195+
- `help` - Show all available targets and configuration options
189196

190197
### Running in Docker
191198

0 commit comments

Comments
 (0)