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
86 changes: 72 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,114 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_call:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' }}

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Set up uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true

- name: Set up Bun
uses: oven-sh/setup-bun@v2
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: latest
bun-version: "1.3.14"

- name: Install dependencies
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
uv sync --python "${{ matrix.python-version }}" --frozen --extra test

- name: Run linter
- name: Run Python linter
run: |
ruff check .
uv run ruff check .

- name: Validate plugin manifest and assets
- name: Run shell script checks
run: |
pytest -v tests/test_plugin_manifest.py
bash -n scripts/package-plugin.sh skills/poteto-mode/scripts/worktree-audit.sh skills/show-me-your-work/scripts/log.sh
shellcheck -S warning scripts/package-plugin.sh skills/poteto-mode/scripts/worktree-audit.sh skills/show-me-your-work/scripts/log.sh

- name: Run setup runtime doctor
run: |
python skills/setup-agystack/scripts/setup_runtime.py --doctor
uv run python skills/setup-agystack/scripts/setup_runtime.py --doctor

- name: Run pytest test suite
run: |
pytest -v --timeout=60 tests/
uv run pytest -v --timeout=60 tests/

- name: Install script dependencies
working-directory: skills/poteto-mode/scripts
run: |
bun install --frozen-lockfile

- name: Typecheck TypeScript tools
working-directory: skills/poteto-mode/scripts
run: |
bun run typecheck

- name: Run TypeScript unit tests
working-directory: skills/poteto-mode/scripts
run: |
bun test

- name: Verify plugin packaging archive
run: |
pkg_dir="$RUNNER_TEMP/pkg-test"
rm -rf "$pkg_dir"
bash scripts/package-plugin.sh --output-dir "$pkg_dir"
archive=$(find "$pkg_dir" -maxdepth 1 -name '*.zip' | head -n 1)
test -n "$archive"
unzip -t "$archive" >/dev/null
python3 - "$archive" <<'PY'
import sys
import zipfile
from pathlib import Path

with zipfile.ZipFile(sys.argv[1]) as zf:
if zf.testzip() is not None:
raise SystemExit("Corrupt zip entry detected")
names = set(zf.namelist())

required = {
"plugin.json",
"README.md",
"LICENSE",
"agystack-models.md",
"agystack-runtime.json.example",
"hooks.json.example",
}
missing = sorted(required - names)
if missing:
raise SystemExit(f"Missing required root assets: {missing}")

forbidden = [
name for name in sorted(names)
if name.endswith(".test.ts")
or name.endswith(".test-helper.ts")
or "__pycache__" in Path(name).parts
or "node_modules" in Path(name).parts
]
if forbidden:
raise SystemExit(f"Forbidden entries in archive: {forbidden[:10]}")
PY
49 changes: 33 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,54 @@ on:
tags:
- "v*"

permissions:
contents: read

jobs:
ci:
uses: ./.github/workflows/ci.yml

build-and-release:
needs: ci
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Validate manifest and run test suite
- name: Verify release tag matches manifest versions
run: |
pytest -v tests/test_plugin_manifest.py
pytest -v tests/test_skill_catalog.py
tag_version="${GITHUB_REF_NAME#v}"
python3 - "$tag_version" <<'PY'
import json
import sys
import tomllib
from pathlib import Path

tag_version = sys.argv[1]
plugin_version = json.loads(Path("plugin.json").read_text(encoding="utf-8"))["version"]
pyproject_version = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]["version"]
marketplace_version = json.loads(Path("docs/marketplace-submission.json").read_text(encoding="utf-8"))["version"]

versions = {
"tag": tag_version,
"plugin.json": plugin_version,
"pyproject.toml": pyproject_version,
"docs/marketplace-submission.json": marketplace_version,
}
if len(set(versions.values())) != 1:
raise SystemExit(f"Release version mismatch: {versions}")
print(f"Verified release version parity: {tag_version}")
PY

- name: Package plugin distribution archive
run: |
bash scripts/package-plugin.sh

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
with:
files: dist/*.zip
generate_release_notes: true
Expand Down
23 changes: 19 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
.PHONY: test lint doctor clean
.PHONY: test lint typecheck doctor package-check ci clean

test:
pytest -v tests/
uv run pytest -v --timeout=60 tests/
cd skills/poteto-mode/scripts && bun test

lint:
ruff check .
uv run ruff check .
bash -n scripts/package-plugin.sh skills/poteto-mode/scripts/worktree-audit.sh skills/show-me-your-work/scripts/log.sh
@if command -v shellcheck >/dev/null 2>&1; then \
shellcheck -S warning scripts/package-plugin.sh skills/poteto-mode/scripts/worktree-audit.sh skills/show-me-your-work/scripts/log.sh; \
else \
echo "WARNING: shellcheck not found on PATH; skipping shellcheck."; \
fi

typecheck:
cd skills/poteto-mode/scripts && bun run typecheck

doctor:
python3 skills/setup-agystack/scripts/setup_runtime.py --doctor
uv run python skills/setup-agystack/scripts/setup_runtime.py --doctor

package-check:
bash scripts/package-plugin.sh --test

ci: lint typecheck doctor test package-check

clean:
rm -rf .pytest_cache .ruff_cache __pycache__ *.egg-info dist build
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ exclude = [
]

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F"]
ignore = ["E402", "E501", "E722"]
select = ["E4", "E7", "E9", "F", "W", "B"]
ignore = ["E402", "E501"]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["F401", "F841"]
"skills/poteto-mode/scripts/*" = ["ALL"]

Loading
Loading