Merge pull request #16 from nullhack/feat/template-release-ai-themed-… #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Template CI | |
| on: | |
| pull_request: | |
| branches: [main, develop] | |
| push: | |
| branches: [main, develop] | |
| jobs: | |
| template-validation: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install dependencies | |
| run: pip install cookiecutter pyyaml | |
| - name: Validate cookiecutter.json | |
| run: python3 scripts/validate_cookiecutter.py | |
| - name: Check template directory exists | |
| run: test -d "{{cookiecutter.project_slug}}" || exit 1 | |
| - name: Generate project from template | |
| run: cookiecutter . --no-input | |
| - name: Generate project with custom values | |
| run: | | |
| rm -rf custom-test-project | |
| cookiecutter . --no-input \ | |
| full_name="CI Test" \ | |
| email="ci@test.com" \ | |
| github_username="ci-test" \ | |
| project_name="Custom Test Project" \ | |
| project_short_description="CI test project" \ | |
| minimum_coverage="95" \ | |
| license="MIT" \ | |
| version="0.1.0" | |
| - name: Validate generated pyproject.toml | |
| run: python3 scripts/validate_projects.py | |
| - name: Validate YAML frontmatter | |
| run: python3 scripts/validate_yaml.py | |
| - name: Check for unsubstituted variables | |
| run: python3 scripts/check_variables.py | |
| - name: Verify required files | |
| run: python3 scripts/check_files.py | |
| generated-project-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| needs: template-validation | |
| strategy: | |
| matrix: | |
| include: | |
| - project: python-project-example | |
| - project: custom-test-project | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Generate default project | |
| if: matrix.project == 'python-project-example' | |
| run: cookiecutter . --no-input | |
| - name: Generate custom project | |
| if: matrix.project == 'custom-test-project' | |
| run: | | |
| cookiecutter . --no-input \ | |
| full_name="CI Test" \ | |
| email="ci@test.com" \ | |
| github_username="ci-test" \ | |
| project_name="Custom Test Project" \ | |
| project_short_description="CI test project" \ | |
| minimum_coverage="95" \ | |
| license="MIT" \ | |
| version="0.1.0" | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| working-directory: ./${{ matrix.project }} | |
| run: uv venv && uv pip install -e '.[dev]' | |
| - name: Run linter | |
| working-directory: ./${{ matrix.project }} | |
| run: uv run ruff check . | |
| - name: Run type checker | |
| working-directory: ./${{ matrix.project }} | |
| run: uv run pyright . | |
| - name: Run tests | |
| working-directory: ./${{ matrix.project }} | |
| run: uv run pytest tests/ -v | |
| - name: Build documentation | |
| working-directory: ./${{ matrix.project }} | |
| run: uv run mkdocs build | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| needs: template-validation | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Generate project | |
| run: cookiecutter . --no-input | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker test image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./python-project-example | |
| target: test | |
| load: true | |
| tags: python-project-template:test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Run Docker tests | |
| run: docker run python-project-template:test pytest tests/ -v | |
| - name: Build Docker production image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./python-project-example | |
| target: prod | |
| load: true | |
| tags: python-project-template:prod | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Verify production image | |
| run: docker run python-project-template:prod --help || true | |
| template-release-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Test template meta agents exist | |
| run: | | |
| test -d .opencode | |
| test -f .opencode/agents/template-manager.md | |
| test -f .opencode/skills/template-test/SKILL.md | |
| test -f .opencode/skills/template-release/SKILL.md | |
| test -f AGENTS.md | |
| test -f scripts/template_test.sh | |
| test -x scripts/template_test.sh |