Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .github/workflows/ci.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,28 +74,3 @@ jobs:

- name: "Build project"
run: cargo build --verbose --all-features

report:
name: "[RUST] Report"
needs: [build]
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v7

- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@stable

- name: "Cache cargo registry"
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-report-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: "Generate report"
run: cargo run report
25 changes: 22 additions & 3 deletions .github/workflows/release.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,11 @@ name: Publish YML
on:
push:
tags:
- '*'
- 'cli-*'
- 'def-*'

jobs:
publish-defintions:
publish-definitions:
permissions:
contents: write
packages: read
Expand All@@ -19,6 +20,9 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

# Shared with the producer builds `poll` kicks off below: they are
# separate cargo projects in a scratch directory, but they resolve
# against this same registry and git checkout cache.
- name: Cache cargo registry
uses: actions/cache@v6
with:
Expand All@@ -30,6 +34,21 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-

# Assembles ./definitions by cloning every producer in collector.toml at
# its pinned ref and running its export. Nothing is read from this
# repository -- the definitions live in taurus and the centaurus actions,
# and only exist as files once this step has run.
- name: Poll definitions from the producers
run: cargo run -- poll

# A producer only ever sees its own modules, so cross-module references
# (an action pointing at a taurus data type) cannot be checked until the
# whole set is assembled. This is the only place that validation is
# possible, which is why it gates the release rather than each producer's
# own CI.
- name: Validate the assembled definitions
run: cargo run -- report

- name: Generate published definitions
run: |
VERSION="${{ github.ref_name }}"
Expand DownExpand Up@@ -59,7 +78,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/cli-')
defaults:
run:
working-directory: "./crates/cli"
working-directory: "./cli"
steps:
- name: Checkout Code
uses: actions/checkout@v7
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,3 +9,6 @@ reader/**/*.js
*.d.ts
**/dist
/out
# Assembled by `code0-cli poll`, never hand-maintained.
/definitions
/definitions.zip
85 changes: 73 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["crates/cli"]
members = ["cli"]
resolver = "3"

[workspace.package]
Expand All@@ -8,7 +8,8 @@ edition = "2024"
[workspace.dependencies]
serde = "1.0.219"
serde_json = "1.0.140"
tucana = "0.0.76"
toml = "0.9.8"
tucana = "0.0.80"
clap = "4.5.41"
colored = "3.0"
tabled = "0.21"
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,25 @@ code0-cli
### Usage
Stay inside the repository root when running commands against the local `definitions` folder. Most commands use `./definitions` by default.

The `definitions` folder is not committed. It is assembled by `poll` from the repositories that own the definitions, so run that first — every other command reads what it produced.

#### Poll
Assembles `./definitions` by running the producers declared in `collector.toml`. Each source is cloned at its pinned ref into a scratch directory, its export command is run, the result is copied into the output tree, and the clone is deleted.

Polling fails if a producer does not emit a module it declares, or emits one whose identifier does not match.

-c (--config) selects a different collector config.
-o (--out) writes somewhere other than the configured output.
-n (--only) polls a subset of the configured sources.
-k (--keep) keeps the checkouts for inspection instead of deleting them.

```bash
code0-cli poll
code0-cli poll -n taurus
code0-cli poll -n rest-action cron-action
code0-cli poll -c /path/to/collector.toml -o /path/to/definitions
```

#### Download
Downloads `definitions.zip` from the Code0 definition GitHub releases and extracts it into `./definitions`.

Expand Down
4 changes: 2 additions & 2 deletions crates/cli/Cargo.toml → cli/Cargo.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@ description = "The CLI for managing the CodeZero's definitions"
repository = "https://github.com/code0-tech/code0-definitions"
homepage = "https://code0.tech"
license = "Apache-2.0"
readme = "../../README.md"
readme = "../README.md"

[dependencies]
clap = { workspace = true, features = ["derive"] }
Expand All@@ -15,6 +15,7 @@ colored = { workspace = true }
tabled = { workspace = true }
notify = { workspace = true }
serde_json = { workspace = true }
toml = { workspace = true }
reqwest = { workspace = true, features = ["json", "stream"] }
serde = { workspace = true, features = ["derive"] }
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros"] }
Expand All@@ -24,4 +25,3 @@ bytes = { workspace = true }
prost = { workspace = true }
tonic = { workspace = true }
log = { workspace = true }

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions crates/cli/src/command/mod.rs → cli/src/command/mod.rs
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
pub mod download;
pub mod parse_errors;
pub mod poll;
pub mod publish;
pub mod push;
pub mod report;
Expand Down
File renamed without changes.
Loading