Files
upstream-ory-keto/DEVELOP.md
upstream-mirror 9456a4e922
Some checks failed
CI / Run lints and checks (push) Failing after 47s
CI / Run tests (push) Failing after 1s
CI / Run race tests (push) Failing after 5s
CI / Build CLI docs (push) Has been skipped
CI / Run buf actions (push) Failing after 5s
CodeQL / Analyze (go) (push) Failing after 3s
CodeQL / Analyze (javascript) (push) Failing after 2s
Docker Image Scanners / scanners (push) Failing after 3s
Format / format (push) Failing after 3s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Draft newsletter (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped
snapshot of https://github.com/ory/keto.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:08:34 +05:00

113 lines
2.1 KiB
Markdown

# Development
This document explains how to develop Ory Keto, run tests, and work with the
tooling around it.
## Upgrading and changelog
New releases might introduce breaking changes. To help you identify and
incorporate those changes, we document these changes in
[UPGRADE.md](./UPGRADE.md) and [CHANGELOG.md](./CHANGELOG.md).
## Command line documentation
To see available commands and flags, run:
```shell
keto -h
# or
keto help
```
## Contribution guidelines
We encourage all contributions. Before opening a pull request, read the
[contribution guidelines](./CONTRIBUTING.md).
## Prerequisites
You need Go 1.19+ and, for the test suites:
- Docker and Docker Compose
- GNU Make 4.3
- Node.js and npm >= v7
It is possible to develop Ory Keto on Windows, but please be aware that all
guides assume a Unix shell like bash or zsh.
## Install from source
To install Keto from source:
```shell
make install
```
## Formatting code
Format all code using:
```shell
make format
```
The continuous integration pipeline checks code formatting.
## Running tests
There are two types of tests:
- Short tests that do not require a SQL database like PostgreSQL
- Regular tests that require PostgreSQL, MySQL, and CockroachDB
### Short tests
Short tests run fairly quickly and use SQLite in-memory.
Run all short tests:
```shell
go test -short ./...
```
Run short tests in a specific module:
```shell
go test -short ./internal/check/...
```
### Regular tests
Regular tests require a database setup.
The test suite can work with docker directly using
[ory/dockertest](https://github.com/ory/dockertest), but we encourage using the
script instead. Using dockertest can bloat the number of Docker Images on your
system and starting them on each run is quite slow.
Run the full test suite:
```shell
source ./scripts/test-resetdb.sh
go test ./...
```
### End-to-end tests
The e2e tests are part of the normal `go test`. To only run the e2e test, use:
```shell
source ./scripts/test-resetdb.sh
go test ./internal/e2e/...
```
or add the `-short` tag to only test against sqlite in-memory.
## Build Docker image
To build a development Docker image:
```shell
make docker
```