Skip to content

Merge pull request #22 from harbor-framework/feature/testing-28r #92

Merge pull request #22 from harbor-framework/feature/testing-28r

Merge pull request #22 from harbor-framework/feature/testing-28r #92

Workflow file for this run

name: CI
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
jobs:
lint-and-format:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python 3.13
run: uv python pin 3.13
- name: Run ruff linting
run: uv run ruff check .
- name: Run ruff formatting
run: uv run ruff format --check .
validate-recipes:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate recipe structure
run: |
status=0
for recipe in harbor_cookbook/recipes/*/; do
name=$(basename "$recipe")
echo "Checking $name..."
# Task recipes must have the required structure
if [ -f "$recipe/task.toml" ]; then
for required in task.toml instruction.md environment/Dockerfile tests/test.sh; do
if [ ! -f "$recipe$required" ]; then
echo " MISSING: $required"
status=1
fi
done
fi
done
exit $status
- name: Validate registry.json
run: |
python3 -c "
import json, glob, os, sys
with open('harbor_cookbook/recipes/registry.json') as f:
data = json.load(f)
errors = []
if not data.get('git_url'):
errors.append('registry.json is missing git_url')
registry_names = {r['name'] for r in data['recipes']}
recipe_dirs = {os.path.basename(d.rstrip('/')) for d in glob.glob('harbor_cookbook/recipes/*/')}
for name in recipe_dirs - registry_names:
errors.append(f'recipe \"{name}\" has no entry in registry.json')
for r in data['recipes']:
if not os.path.isdir(os.path.join('harbor_cookbook', r['path'])):
errors.append(f'registry entry \"{r[\"name\"]}\" points to non-existent path: {r[\"path\"]}')
for e in errors:
print(f'ERROR: {e}')
sys.exit(1 if errors else 0)
"