ci: update config
This commit is contained in:
1 parent
dbe39fb2b4
commit
a10e205e9b
5 files changed
+121
-7
No files matched your search
+70
-7
@@ -39,7 +39,70 @@ some, write only those keys:
|
||||
|
||||
`bootvine defaults` prints every key with its default as TOML, and
|
||||
`bootvine defaults --format nix` prints the same as a Nix attribute set to
|
||||
paste into `services.bootvine.settings`.
|
||||
paste into `services.bootvine.settings`:
|
||||
|
||||
```toml
|
||||
[colors.header]
|
||||
origin = "white"
|
||||
separators = "dark-gray"
|
||||
total-time = "white"
|
||||
|
||||
[colors.stages]
|
||||
branches = "dark-gray"
|
||||
finished-label = "gray"
|
||||
finished-time = "green"
|
||||
unit-count = "gray"
|
||||
failed-count = "light-red"
|
||||
current = "white"
|
||||
|
||||
[colors.tree]
|
||||
branches = "dark-gray"
|
||||
columns = "dark-gray"
|
||||
target = "cyan"
|
||||
current-stage = "yellow"
|
||||
reached-stage = "green"
|
||||
running-unit = "white"
|
||||
running-marker = "yellow"
|
||||
waiting-unit = "gray"
|
||||
finished-unit = "dark-gray"
|
||||
finished-marker = "green"
|
||||
failed-unit = "light-red"
|
||||
overflow = "gray"
|
||||
|
||||
[colors.timeline]
|
||||
rule = "dark-gray"
|
||||
title = "gray"
|
||||
axis = "dark-gray"
|
||||
milestone = "green"
|
||||
finished = "green"
|
||||
finished-label = "gray"
|
||||
failed = "light-red"
|
||||
queued-bar = "gray"
|
||||
running = "yellow"
|
||||
running-label = "white"
|
||||
|
||||
[colors.footer]
|
||||
rule = "dark-gray"
|
||||
done = "green"
|
||||
running = "yellow"
|
||||
waiting = "gray"
|
||||
failed = "light-red"
|
||||
no-failures = "gray"
|
||||
|
||||
[colors.password]
|
||||
frame = "yellow"
|
||||
message = "white"
|
||||
hint = "dark-gray"
|
||||
checking = "gray"
|
||||
rejected = "light-red"
|
||||
backdrop = "dark-gray"
|
||||
|
||||
[timing]
|
||||
keep-finished-units-for = "2s"
|
||||
hide-runs-shorter-than = "1s"
|
||||
keep-final-frame-for = "1s"
|
||||
wait-for-display-manager = "10s"
|
||||
```
|
||||
|
||||
## Colours
|
||||
|
||||
@@ -61,12 +124,12 @@ palette instead: `console.colors` on NixOS, or the `vt.default_red`,
|
||||
|
||||
## Timing
|
||||
|
||||
| Key | Default | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `keep-finished-units-for` | `2s` | How long a finished unit stays in the tree, faded, before it leaves. |
|
||||
| `hide-runs-shorter-than` | `1s` | Runs shorter than this get no timer and no timeline bar. |
|
||||
| `keep-final-frame-for` | `1s` | How long the last frame stays before the console is handed back. |
|
||||
| `wait-for-display-manager` | `10s` | When a display manager is starting, how long to wait for it to switch to its own terminal instead, so the console's status lines never show in between. |
|
||||
| Key | Meaning |
|
||||
| --- | --- |
|
||||
| `keep-finished-units-for` | How long a finished unit stays in the tree, faded, before it leaves. |
|
||||
| `hide-runs-shorter-than` | Runs shorter than this get no timer and no timeline bar. |
|
||||
| `keep-final-frame-for` | How long the last frame stays before the console is handed back. |
|
||||
| `wait-for-display-manager` | When a display manager is starting, how long to wait for it to switch to its own terminal instead, so the console's status lines never show in between. |
|
||||
|
||||
## Early kernel messages
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ exports libraries that clash with [QEMU](https://www.qemu.org) or Chromium.
|
||||
|
||||
- `nix run .#record-screencasts` re-records the README animations from the
|
||||
scripted demos and copies the passphrase screenshot from the VM check.
|
||||
- `cargo xtask sync-default-config` rewrites the defaults block in
|
||||
[configuration](configuration.md#defaults) from `bootvine defaults`.
|
||||
- `cargo run -- install --destdir <dir> --initrd dracut` stages an install
|
||||
without touching the system; `cargo run -- uninstall --destdir <dir>` removes
|
||||
it again.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
mod record_screencasts;
|
||||
mod sync_default_config;
|
||||
mod task_error;
|
||||
|
||||
use std::{path::PathBuf, process::ExitCode};
|
||||
@@ -19,6 +20,10 @@ enum Task {
|
||||
recordings/"
|
||||
)]
|
||||
RecordScreencasts(RecordScreencastsOptions),
|
||||
#[command(
|
||||
about = "Rewrite the defaults block in docs/configuration.md from `bootvine defaults`"
|
||||
)]
|
||||
SyncDefaultConfig,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
@@ -32,6 +37,7 @@ fn main() -> ExitCode {
|
||||
Task::RecordScreencasts(options) => {
|
||||
record_screencasts::record_screencasts(&options.passphrase_png)
|
||||
}
|
||||
Task::SyncDefaultConfig => sync_default_config::sync_default_config(),
|
||||
};
|
||||
match outcome {
|
||||
Ok(()) => ExitCode::SUCCESS,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
use std::{fs, path::Path};
|
||||
|
||||
use xshell::{Shell, cmd};
|
||||
|
||||
use crate::task_error::TaskError;
|
||||
|
||||
const CONFIGURATION_DOC: &str = "docs/configuration.md";
|
||||
const DEFAULTS_HEADING: &str = "## Defaults\n";
|
||||
const TOML_FENCE_OPEN: &str = "```toml\n";
|
||||
const FENCE_CLOSE: &str = "```\n";
|
||||
|
||||
pub fn sync_default_config() -> Result<(), TaskError> {
|
||||
let doc_path = Path::new(CONFIGURATION_DOC);
|
||||
let doc_file_error = |source| TaskError::File {
|
||||
path: doc_path.to_path_buf(),
|
||||
source,
|
||||
};
|
||||
let doc_text = fs::read_to_string(doc_path).map_err(doc_file_error)?;
|
||||
let shell = Shell::new()?;
|
||||
let printed_defaults =
|
||||
cmd!(shell, "cargo run --quiet --package bootvine -- defaults").read()?;
|
||||
let synced_text = replace_defaults_block(&doc_text, &printed_defaults)
|
||||
.ok_or(TaskError::DefaultsBlockMissing(CONFIGURATION_DOC))?;
|
||||
if synced_text != doc_text {
|
||||
fs::write(doc_path, synced_text).map_err(doc_file_error)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn replace_defaults_block(doc_text: &str, printed_defaults: &str) -> Option<String> {
|
||||
let section_start = doc_text.find(DEFAULTS_HEADING)?;
|
||||
let block_start =
|
||||
section_start + doc_text[section_start..].find(TOML_FENCE_OPEN)? + TOML_FENCE_OPEN.len();
|
||||
let block_end = block_start + doc_text[block_start..].find(FENCE_CLOSE)?;
|
||||
Some(format!(
|
||||
"{}{}\n{}",
|
||||
&doc_text[..block_start],
|
||||
printed_defaults.trim_end(),
|
||||
&doc_text[block_end..]
|
||||
))
|
||||
}
|
||||
@@ -10,4 +10,6 @@ pub enum TaskError {
|
||||
File { path: PathBuf, source: io::Error },
|
||||
#[error("no recordings directory here; run from the repository root")]
|
||||
NotInRepositoryRoot,
|
||||
#[error("{0} has no ```toml block under its Defaults heading")]
|
||||
DefaultsBlockMissing(&'static str),
|
||||
}
|
||||
Reference in new issue
Block a user