mirror of
https://seed.radicle.dev/rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE.git
synced 2026-11-12 14:40:43 +08:00
This adapter is only ever run by the Radicle CI broker, and that can now limit CI run duration itself. Thus having this adapter do it too is pointless duplication. Further, this removes the run time dependency on an external "timeout" command, which turns out not to be portable: it isn't available on Macs, by default. Signed-off-by: Lars Wirzenius <liw@liw.fi>
87 lines
2.3 KiB
Markdown
87 lines
2.3 KiB
Markdown
# radicle-native-ci
|
|
|
|
This is an adapter for the [Radicle CI broker], for performing CI runs
|
|
locally. This means it reads a JSON message from its stdin, and writes
|
|
two JSON messages to its stdout. Its configured via a configuration
|
|
file specified in the `RADICLE_NATIVE_CI` environment variable. There
|
|
is currently no logging.
|
|
|
|
The CI run is performed locally, without any isolation. This is not
|
|
safe and secure, but it's simple, and easy to get working. Do not use
|
|
this unless you trust the repository and its dependencies.
|
|
|
|
The repository must contain a file `./radicle/native.yaml` that
|
|
specifies how CI is run for the repository. For example:
|
|
|
|
```yaml
|
|
shell: |
|
|
cargo test --locked --workspace
|
|
```
|
|
|
|
[Radicle CI broker]: https://app.radicle.xyz/nodes/radicle.liw.fi/rad:zwTxygwuz5LDGBq255RA2CbNGrz8
|
|
|
|
This crate also includes the program `rad-ci`, which runs the commands
|
|
the adapter runs when invoked by the CI broker. To use: install it on
|
|
your `$PATH` (using `cargo install`) and run:
|
|
|
|
```sh
|
|
rad ci
|
|
```
|
|
|
|
This will read `.radicle/native.yaml` and run the shell commands
|
|
specified there.
|
|
|
|
(No command line arguments or options needed, nor any environment
|
|
variables for this.)
|
|
|
|
## Architecture
|
|
|
|
See the [documentation](doc) directory for an architecture document.
|
|
|
|
|
|
## Configuration
|
|
|
|
The adapter requires the `RADICLE_NATIVE_CI` environment variable to
|
|
be set to the filename of a configuration file in YAML. For example:
|
|
|
|
~~~yaml
|
|
base_url: https://ci.example.org/state
|
|
state: /srv/http
|
|
log: /home/_rad/native-ci.log
|
|
~~~
|
|
|
|
The fields are:
|
|
|
|
* `base_url` --- base URL for build logs (mandatory for access from CI broker page)
|
|
* `state` --- required, directory where per-run directories are stored
|
|
* `log` --- required, file where native CI should write a log
|
|
|
|
|
|
## Packaging
|
|
|
|
There is simple, simplistic, rudimentary, personal-use-only packaging
|
|
for Debian in the `debian` directory, used by Lars to build packages
|
|
for his own use.
|
|
|
|
|
|
## Running tests
|
|
|
|
To run the test suite for the CI broker:
|
|
|
|
~~~sh
|
|
cargo test
|
|
~~~
|
|
|
|
(The usual way, for a Rust program.)
|
|
|
|
Also, there is `.radicle/native.yaml` for testing this with itself in
|
|
Radicle CI. You may want to run those manually.
|
|
|
|
|
|
## License
|
|
|
|
Radicle native CI is distributed under the terms of both the MIT
|
|
license and the Apache License (Version 2.0).
|
|
|
|
See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details.
|