diff --git a/.github/workflows/validate-org-template.yml b/.github/workflows/validate-org-template.yml index 7da6040..7c1e908 100644 --- a/.github/workflows/validate-org-template.yml +++ b/.github/workflows/validate-org-template.yml @@ -1,19 +1,19 @@ name: Validate Org Template on: workflow_call: + jobs: validate: name: Org template validation runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v4 - - uses: actions/checkout@v4 - with: - repository: Molecule-AI/molecule-ci - path: .molecule-ci - uses: actions/setup-python@v5 with: python-version: "3.11" + cache: "pip" + cache-dependency-path: .molecule-ci/scripts/requirements.txt - run: pip install pyyaml -q - run: python3 .molecule-ci/scripts/validate-org-template.py - name: Check for secrets diff --git a/.github/workflows/validate-plugin.yml b/.github/workflows/validate-plugin.yml index 527063d..1306167 100644 --- a/.github/workflows/validate-plugin.yml +++ b/.github/workflows/validate-plugin.yml @@ -1,19 +1,19 @@ name: Validate Plugin on: workflow_call: + jobs: validate: name: Plugin validation runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v4 - - uses: actions/checkout@v4 - with: - repository: Molecule-AI/molecule-ci - path: .molecule-ci - uses: actions/setup-python@v5 with: python-version: "3.11" + cache: "pip" + cache-dependency-path: .molecule-ci/scripts/requirements.txt - run: pip install pyyaml -q - run: python3 .molecule-ci/scripts/validate-plugin.py - name: Check for secrets diff --git a/.github/workflows/validate-workspace-template.yml b/.github/workflows/validate-workspace-template.yml index 1a61858..b943a8e 100644 --- a/.github/workflows/validate-workspace-template.yml +++ b/.github/workflows/validate-workspace-template.yml @@ -1,19 +1,19 @@ name: Validate Workspace Template on: workflow_call: + jobs: validate: name: Template validation runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - - uses: actions/checkout@v4 - with: - repository: Molecule-AI/molecule-ci - path: .molecule-ci - uses: actions/setup-python@v5 with: python-version: "3.11" + cache: "pip" + cache-dependency-path: .molecule-ci/scripts/requirements.txt - run: pip install pyyaml -q - run: python3 .molecule-ci/scripts/validate-workspace-template.py - name: Docker build smoke test diff --git a/scripts/requirements.txt b/scripts/requirements.txt new file mode 100644 index 0000000..3aecde9 --- /dev/null +++ b/scripts/requirements.txt @@ -0,0 +1 @@ +pyyaml>=6.0 diff --git a/scripts/validate-plugin.py b/scripts/validate-plugin.py index 4ec5d43..c42e916 100644 --- a/scripts/validate-plugin.py +++ b/scripts/validate-plugin.py @@ -33,6 +33,13 @@ found = [p for p in content_paths if os.path.exists(p)] if not found: errors.append("Plugin must contain at least one of: SKILL.md, hooks/, skills/, rules/") +# 6. SKILL.md formatting check +if os.path.isfile("SKILL.md"): + with open("SKILL.md") as f: + first_line = f.readline().strip() + if first_line and not first_line.startswith("#"): + print("::warning::SKILL.md should start with a markdown heading (e.g., # Plugin Name)") + if errors: for e in errors: print(f"::error::{e}") diff --git a/scripts/validate-workspace-template.py b/scripts/validate-workspace-template.py index df7aefe..5d87063 100644 --- a/scripts/validate-workspace-template.py +++ b/scripts/validate-workspace-template.py @@ -21,6 +21,20 @@ runtime = config.get("runtime", "") if runtime and runtime not in known: print(f"::warning::Runtime '{runtime}' is not in the known set. OK for custom runtimes.") +# Check for legacy imports +if os.path.isfile("adapter.py"): + with open("adapter.py") as f: + content = f.read() + if "molecule_runtime" in content: + print("::warning::adapter.py imports 'molecule_runtime' — legacy import, use 'molecule_ai' or platform SDK") + +# Check for missing molecule-ai-workspace-runtime dependency hint +if os.path.isfile("Dockerfile"): + with open("Dockerfile") as f: + content = f.read() + if "molecule-ai-workspace-runtime" not in content: + print("::warning::Dockerfile does not reference 'molecule-ai-workspace-runtime' — may need base runtime package") + sv = config.get("template_schema_version") if sv is None: errors.append("Missing template_schema_version (add: template_schema_version: 1)")