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
59 changes: 54 additions & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ on:
push:

jobs:
check:
source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Check source data
run: node scripts/check.mjs source
typescript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -14,17 +23,44 @@ jobs:
node-version: 24
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.7.0 --activate
- name: Check TypeScript SDK
run: node scripts/check.mjs typescript
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Check Go SDKs
run: node scripts/check.mjs go
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Setup Rust
run: rustup toolchain install stable --profile minimal
- name: Check Rust SDK
run: node scripts/check.mjs rust
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- uses: astral-sh/setup-uv@v5
- name: Setup Rust
run: rustup toolchain install stable --profile minimal
- name: Check
run: make check
- name: Check Python SDK
run: node scripts/check.mjs python
python-compat:
runs-on: ubuntu-latest
strategy:
Expand All @@ -39,3 +75,16 @@ jobs:
- uses: astral-sh/setup-uv@v5
- name: Test Python SDK
run: uv run --directory python --python ${{ matrix.python-version }} pytest tests -q
check:
runs-on: ubuntu-latest
needs:
- source
- typescript
- go
- rust
- python
- python-compat
if: ${{ always() }}
steps:
- name: Check required jobs
run: test "${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}" = "true"
10 changes: 2 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,10 @@ jobs:
- name: Verify release version
run: |
version="${GITHUB_REF_NAME#v}"
VERSION="$version" node -e 'const { readFileSync } = require("node:fs"); const version = process.env.VERSION; const pkg = JSON.parse(readFileSync("ts/package.json", "utf8")); if (pkg.version !== version) { throw new Error(`ts/package.json version ${pkg.version} != ${version}`); }'
VERSION="$version" node -e 'const { readFileSync } = require("node:fs"); const version = process.env.VERSION; const pkg = JSON.parse(readFileSync("ts/package.json", "utf8")); if (pkg.version !== version) { throw new Error("ts/package.json version " + pkg.version + " != " + version); }'
rust_version="$(awk -F '"' '/^version = / { print $2; exit }' rust/Cargo.toml)"
test "$rust_version" = "$version"
python_version="$(python - <<'PY'
from pathlib import Path
import re
text = Path("python/pyproject.toml").read_text()
print(re.search(r'^version = "([^"]+)"$', text, re.M).group(1))
PY
)"
python_version="$(awk -F '"' '/^version = / { print $2; exit }' python/pyproject.toml)"
test "$python_version" = "$version"
go_cobra_core_version="$(awk '/github.com\/lathe-cli\/kitup\/go / { print $2; exit }' go-cobra/go.mod)"
test "$go_cobra_core_version" = "v$version"
Expand Down
37 changes: 32 additions & 5 deletions scripts/check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ function assert(condition, message) {
if (!condition) fail(message);
}

const knownGroups = new Set(["source", "typescript", "go", "rust", "python"]);
const selectedGroups = new Set(process.argv.slice(2));
for (const group of selectedGroups) {
assert(knownGroups.has(group), `unknown check group: ${group}`);
}

function shouldRun(group) {
return selectedGroups.size === 0 || selectedGroups.has(group);
}

function validateHosts(spec) {
assert(spec.schemaVersion === 1, "hosts schemaVersion must be 1");
assert(Array.isArray(spec.hosts), "hosts must be an array");
Expand Down Expand Up @@ -293,9 +303,16 @@ function detectedEnv(prefix) {
};
}

for (const [name, command, args, cwd, env] of [
["generated-hosts", "node", ["scripts/sync-hosts.mjs", "--check"], rootPath],
for (const [group, name, command, args, cwd, env] of [
[
"source",
"generated-hosts",
"node",
["scripts/sync-hosts.mjs", "--check"],
rootPath,
],
[
"typescript",
"typescript-format",
"pnpm",
[
Expand All @@ -312,16 +329,18 @@ for (const [name, command, args, cwd, env] of [
],
rootPath,
],
["typescript", "pnpm", ["--dir", "ts", "test"], rootPath],
["go", "go", ["test", "./..."], new URL("../go/", import.meta.url)],
["typescript", "typescript", "pnpm", ["--dir", "ts", "test"], rootPath],
["go", "go", "go", ["test", "./..."], new URL("../go/", import.meta.url)],
[
"go",
"go-cobra",
"go",
["test", "./..."],
new URL("../go-cobra/", import.meta.url),
],
["rust", "cargo", ["test"], new URL("../rust/", import.meta.url)],
["rust", "rust", "cargo", ["test"], new URL("../rust/", import.meta.url)],
[
"rust",
"rust-clippy",
"cargo",
[
Expand All @@ -336,6 +355,7 @@ for (const [name, command, args, cwd, env] of [
rootPath,
],
[
"python",
"python-format",
"uv",
[
Expand All @@ -351,46 +371,53 @@ for (const [name, command, args, cwd, env] of [
new URL("../python/", import.meta.url),
],
[
"python",
"python-lint",
"uv",
["run", "ruff", "check", "src", "tests"],
new URL("../python/", import.meta.url),
],
[
"python",
"python",
"uv",
["run", "pytest", "tests", "-q"],
new URL("../python/", import.meta.url),
],
[
"typescript",
"example-ts",
"pnpm",
["--dir", "examples/ts", "install-skill"],
rootPath,
detectedEnv("kitup-example-ts-"),
],
[
"go",
"example-go",
"go",
["run", "."],
new URL("../examples/go/", import.meta.url),
detectedEnv("kitup-example-go-"),
],
[
"rust",
"example-rust",
"cargo",
["run", "--quiet"],
new URL("../examples/rust/", import.meta.url),
detectedEnv("kitup-example-rust-"),
],
[
"python",
"example-python",
"uv",
["run", "python", "main.py"],
new URL("../examples/python/", import.meta.url),
detectedEnv("kitup-example-python-"),
],
]) {
if (!shouldRun(group)) continue;
console.log(`\n==> ${name}`);
const result = spawnSync(command, args, {
cwd,
Expand Down
Loading