Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats committed Dec 10, 2024
1 parent 48c41ea commit a7164c7
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 71 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
run: cargo test
- name: run all examples
run: |
cargo run -- examples/hooks/ --no-input -o hooks
cargo run -- examples/complex/ --no-input -o complex
cargo run -- examples/default-from-variable/ --no-input -o default
cargo run -- examples/slugify/ --no-input -o slugify
cargo run -- examples/super-basic/ --no-input -o super-basic
cargo run -- examples/with-directory/ --no-input -o with-directory
cargo run --features=cli -- examples/hooks/ --no-input -o hooks
cargo run --features=cli -- examples/complex/ --no-input -o complex
cargo run --features=cli -- examples/default-from-variable/ --no-input -o default
cargo run --features=cli -- examples/slugify/ --no-input -o slugify
cargo run --features=cli -- examples/super-basic/ --no-input -o super-basic
cargo run --features=cli -- examples/with-directory/ --no-input -o with-directory
6 changes: 4 additions & 2 deletions src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,10 @@ mod tests {
#[test]
fn can_validate_definition() {
insta::glob!("snapshots/validation/*.toml", |path| {
let errs = TemplateDefinition::validate_file(&path);
insta::assert_debug_snapshot!(&errs);
match TemplateDefinition::validate_file(&path) {
Ok(errs) => insta::assert_debug_snapshot!(&errs),
Err(e) => insta::assert_snapshot!(&e)
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ source: src/definition.rs
expression: "&errs"
input_file: src/snapshots/validation/default_not_in_choice.toml
---
Ok(
[
"Variable `pg_version` has `10.5` as default, which isn't in the choices",
],
)
[
"Variable `pg_version` has `10.5` as default, which isn't in the choices",
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ source: src/definition.rs
expression: "&errs"
input_file: src/snapshots/validation/default_not_matching_regex.toml
---
Ok(
[
"Variable `project_name` has a default that doesn't pass its validation regex",
],
)
[
"Variable `project_name` has a default that doesn't pass its validation regex",
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ source: src/definition.rs
expression: "&errs"
input_file: src/snapshots/validation/invalid_regex.toml
---
Ok(
[
"Variable `project_name` has an invalid validation regex: **[0-9]++",
],
)
[
"Variable `project_name` has an invalid validation regex: **[0-9]++",
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ source: src/definition.rs
expression: "&errs"
input_file: src/snapshots/validation/only_if_matching_type.toml
---
Ok(
[
"Variable `pg_version` depends on `database=true`, but the type of `database` is string",
],
)
[
"Variable `pg_version` depends on `database=true`, but the type of `database` is string",
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ source: src/definition.rs
expression: "&errs"
input_file: src/snapshots/validation/only_if_not_filled_yet_var.toml
---
Ok(
[
"Variable `pg_version` depends on `database`, which wasn't asked",
],
)
[
"Variable `pg_version` depends on `database`, which wasn't asked",
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ source: src/definition.rs
expression: "&errs"
input_file: src/snapshots/validation/only_if_unknown_var.toml
---
Ok(
[
"Variable `pg_version` depends on `database`, which wasn't asked",
],
)
[
"Variable `pg_version` depends on `database`, which wasn't asked",
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ source: src/definition.rs
expression: "&errs"
input_file: src/snapshots/validation/regex_on_wrong_type.toml
---
Ok(
[
"Variable `project` has a validation regex but is not a string",
],
)
[
"Variable `project` has a validation regex but is not a string",
]
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
---
source: src/definition.rs
expression: "&errs"
expression: "&e"
input_file: src/snapshots/validation/unsupported_type.toml
---
Err(
Error {
kind: Toml {
err: Error {
inner: Error {
inner: TomlError {
message: "Value 1.2 (of type `float`) is not allowed as a value: only strings, integers and boolean are.",
raw: Some(
"name = \"Test template\"\ndescription = \"A description\"\nkickstart_version = 1\n\n[[variables]]\nname = \"project_name\"\ndefault = 1.2\nprompt = \"What's the name of your project?\"\nvalidation = \"^([a-zA-Z][a-zA-Z0-9_-]+)$\"",
),
keys: [
"variables",
"default",
],
span: Some(
122..125,
),
},
},
},
},
source: None,
},
)
Invalid TOML: TOML parse error at line 7, column 11
|
7 | default = 1.2
| ^^^
Value 1.2 (of type `float`) is not allowed as a value: only strings, integers and boolean are.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ source: src/definition.rs
expression: "&errs"
input_file: src/snapshots/validation/valid.toml
---
Ok(
[],
)
[]

0 comments on commit a7164c7

Please sign in to comment.