Skip to content
Closed
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
64 changes: 50 additions & 14 deletions e2e/config/test_schema_tombi
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mise use -g tombi@$TOMBI_VERSION
SCHEMA_PATH="$ROOT/schema/mise.json"
TASK_SCHEMA_PATH="$ROOT/schema/mise-task.json"
TOMBI="mise x tombi@$TOMBI_VERSION -- tombi"
TOMBI_LINT="$TOMBI lint --offline --no-cache --error-on-warnings --quiet"
assert_contains "$TOMBI --version" "tombi $TOMBI_VERSION"

# Set up tombi config pointing to local schema
Expand Down Expand Up @@ -70,27 +71,43 @@ TOML

cat >"$HOME/workdir/mise-os.toml" <<'TOML'
[tools]
node = { version = "latest", os = ["linux", "macos/arm64", "darwin/aarch64", "win/amd64"] }
node = { version = "latest", os = ["linux", "macos/arm64", "darwin/aarch64", "win/amd64"], backend_options = { nested = true } }
go = { version = "latest", os = "linux/x64" }
"aqua:casey/just" = { version = "1.46.0", symlink_bins = true, vars = { channel = "stable" }, prerelease = true }
"cargo:cargo-edit" = { version = "latest", features = "add", default-features = false, locked = false, bin = "cargo-add", crate = "cargo-edit" }
"conda:ruff" = { version = "latest", channel = "conda-forge" }
"github:jdx/mise-test-fixtures" = { version = "1.0.0", asset_pattern = "hello-world-1.0.0.tar.gz", bin_path = "hello-world-1.0.0/bin", platforms = { linux-x64 = { asset_pattern = "hello-world-1.0.0.tar.gz", checksum = "sha256:abc123" } } }
"gitlab:jdxcode/mise-test-fixtures" = { version = "1.0.0", asset_pattern = "hello-world-1.0.0.tar.gz", filter_bins = "hello-world", api_url = "https://gitlab.com/api/v4" }
"forgejo:roele/mise-test-fixtures" = { version = "1.0.0", asset_pattern = "hello-world-1.0.0.tar.gz", strip_components = 1, no_app = true }
"go:github.com/golang-migrate/migrate/v4/cmd/migrate" = { version = "latest", tags = "postgres" }
"http:hello" = { version = "1.0.0", url = "https://example.com/hello-{{ version }}.tar.gz", checksum = "sha256:abc123", size = 12345, strip_components = 1, bin = "hello", rename_exe = "hello", format = "tar.gz", version_list_url = "https://example.com/versions.json", version_json_path = ".[].version", version_expr = "split(body, '\\n')", platforms = { linux-x64-musl = { url = "https://example.com/hello-linux.tar.gz", size = 12345 } } }
"npm:prettier" = { version = "latest", npm_args = "--omit=dev", pnpm_args = "--config.foo=bar", bun_args = "--verbose", aube_args = "--reporter append-only" }
"pipx:black" = { version = "latest", extras = "colorama", pipx_args = "--include-deps", uvx = false, uvx_args = "--with rich" }
"s3:internal" = { version = "latest", url = "s3://bucket/hello-{{ version }}.tar.gz", endpoint = "http://localhost:9000", region = "us-east-1", version_list_url = "s3://bucket/versions.json", version_prefix = "hello-", version_regex = "hello-(.*)", version_json_path = ".[].version", version_expr = "split(body, '\\n')", platforms = { linux-x64 = { url = "s3://bucket/hello-linux.tar.gz", checksum = "sha256:abc123" } } }
"spm:swiftlang/swiftly" = { version = "latest", provider = "github", api_url = "https://api.github.com", filter_bins = ["swiftly"] }
"ubi:cli/cli" = { version = "latest", exe = "gh", rename_exe = "github", matching = "linux", matching_regex = "linux.*x86_64", provider = "github", api_url = "https://api.github.com", extract_all = true, bin_path = "bin", tag_regex = "^v" }
python = { version = "3.12", virtualenv = ".venv", patch_sysconfig = false }
rust = { version = "latest", profile = "minimal", components = "rustfmt,clippy", targets = "wasm32-unknown-unknown" }
dotnet = { version = "latest", runtime = "dotnet" }

[tasks.build.tools]
rust = { version = "latest", os = ["linux/x64", "macos/arm64"] }
rust = { version = "latest", os = ["linux/x64", "macos/arm64"], profile = "release" }
TOML

cat >"$HOME/workdir/mise-task-os.toml" <<'TOML'
[build]
run = "echo ok"

[build.tools]
node = { version = "latest", os = ["linux/x64", "macos/arm64"] }
node = { version = "latest", os = ["linux/x64", "macos/arm64"], profile = "release" }
TOML

# tombi lint should succeed with no errors (warnings about table order are ok)
cd "$HOME/workdir"
assert_succeed "$TOMBI lint --offline --no-cache --quiet mise.toml"
assert_succeed "$TOMBI lint --offline --no-cache --quiet mise-age.toml"
assert_succeed "$TOMBI lint --offline --no-cache --quiet mise-os.toml"
assert_succeed "$TOMBI lint --offline --no-cache --quiet mise-task-os.toml"
assert_succeed "$TOMBI_LINT mise.toml"
assert_succeed "$TOMBI_LINT mise-age.toml"
assert_succeed "$TOMBI_LINT mise-os.toml"
assert_succeed "$TOMBI_LINT mise-task-os.toml"

# Verify that invalid properties on tasks are rejected
cat >"$HOME/workdir/mise-bad.toml" <<'TOML'
Expand All @@ -109,22 +126,22 @@ strict = true

[[schemas]]
path = "file://$SCHEMA_PATH"
include = ["mise-bad.toml", "mise-bad-age.toml", "mise-bad-tmpl.toml", "mise-bad-os.toml"]
include = ["mise-bad.toml", "mise-bad-age.toml", "mise-bad-tmpl.toml", "mise-bad-os.toml", "mise-bad-tool-opts.toml"]

[[schemas]]
path = "file://$TASK_SCHEMA_PATH"
include = ["mise-bad-task-os.toml"]
include = ["mise-bad-task-os.toml", "mise-bad-task-tool-extra.toml"]
EOF

assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad.toml"
assert_fail "$TOMBI_LINT mise-bad.toml"

# Verify that options for complex age values must be nested inside age
cat >"$HOME/workdir/mise-bad-age.toml" <<'TOML'
[env]
SECRET = { age = { value = "AGE-SECRET" }, tools = true }
TOML

assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad-age.toml"
assert_fail "$TOMBI_LINT mise-bad-age.toml"

# Verify that extends is rejected on task_templates (not supported at runtime)
cat >"$HOME/workdir/mise-bad-tmpl.toml" <<'TOML'
Expand All @@ -133,14 +150,23 @@ extends = "base"
quiet = true
TOML

assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad-tmpl.toml"
assert_fail "$TOMBI_LINT mise-bad-tmpl.toml"

cat >"$HOME/workdir/mise-bad-os.toml" <<'TOML'
[tools]
node = { version = "latest", os = true }
TOML

assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad-os.toml"
assert_fail "$TOMBI_LINT mise-bad-os.toml"

cat >"$HOME/workdir/mise-bad-tool-opts.toml" <<'TOML'
[tools]
"aqua:casey/just" = { version = "latest", vars = { channel = true } }
"cargo:cargo-edit" = { version = "latest", features = ["add"] }
dotnet = { version = "latest", runtime = "invalid-runtime" }
TOML

assert_fail "$TOMBI_LINT mise-bad-tool-opts.toml"

cat >"$HOME/workdir/mise-bad-task-os.toml" <<'TOML'
[build]
Expand All @@ -150,4 +176,14 @@ run = "echo ok"
node = { version = "latest", os = true }
TOML

assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad-task-os.toml"
assert_fail "$TOMBI_LINT mise-bad-task-os.toml"

cat >"$HOME/workdir/mise-bad-task-tool-extra.toml" <<'TOML'
[build]
run = "echo ok"

[build.tools]
node = { version = "latest", os = "linux/x64", backend_options = { nested = true } }
TOML

assert_fail "$TOMBI_LINT mise-bad-task-tool-extra.toml"
73 changes: 52 additions & 21 deletions schema/mise-task.json

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

Loading
Loading