# `jadpo ci`

Run what a change must pass.

Run, in order and each with CI set, `jadpo check`, `jadpo fmt --check`, every test, every deployable's build and, when the app has a package from the registry, `jadpo package audit`, stopping at the first that fails. The screen is the failing step's findings, as that command shows them, then each step and its state; `--json` holds each step's result. `init github` writes .github/workflows/jadpo.yml and `init gitlab` .gitlab-ci.yml, which install jadpo, keep its cache, check out the whole history and run `jadpo ci` on every push and pull or merge request, with read access to the repository and no secrets. The file is the project's once written: one already there is left as it is.

```text
jadpo ci [action] [host]
```

## Arguments

- `action` (optional): init, to write a CI service's file; every step when left out
- `host` (optional): The CI service whose file init writes

## On every command

- `--json`: Print data for tools instead of text
- `--full`: Show everything a report shortens
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo ci --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"ci"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# Run everything CI runs, here
jadpo ci
# Write the workflow GitHub runs it from
jadpo ci init github
# Write the file GitLab runs it from
jadpo ci init gitlab
```

## Errors

- [`cli.ci_arguments`](/docs/errors/cli.ci_arguments.md): A `jadpo ci` command names an action other than `init`, or `init` names no host or one it doesn't write for
- [`toolchain.ci_file_exists`](/docs/errors/toolchain.ci_file_exists.md): You ran `jadpo ci init` in a project that already has the CI file it writes
- [`toolchain.artifact_write_failed`](/docs/errors/toolchain.artifact_write_failed.md): A file Jadpo writes for you, such as a record, couldn't be written, usually because it or its folder is read-only
- [`toolchain.project_not_found`](/docs/errors/toolchain.project_not_found.md): You ran a command that works on a project in a folder with no `app.jadpo`, in it or in any folder above it
