Merge pull request #11 from pandazki/main #29
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4 | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Install dependencies | |
| run: uv sync --extra lint | |
| - name: Ruff check | |
| run: uv run ruff check . | |
| - name: Ruff format check | |
| run: uv run ruff format --check . | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| HAS_API_KEY: ${{ secrets.ANTHROPIC_API_KEY != '' }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4 | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Install dependencies | |
| run: uv sync --extra test | |
| - name: Run tests (without API key) | |
| if: env.HAS_API_KEY != 'true' | |
| run: uv run pytest -v -m "not requires_api_key" | |
| - name: Run tests (with API key) | |
| if: env.HAS_API_KEY == 'true' | |
| run: uv run pytest -v | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| docs-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4 | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Install dependencies | |
| run: uv sync --extra docs | |
| - name: Build pattern docs | |
| run: uv run python -m scripts.build_docs | |
| - name: Build docs (English) | |
| run: uv run mkdocs build --strict -f mkdocs.en.yml | |
| - name: Build docs (Chinese) | |
| run: uv run mkdocs build --strict -f mkdocs.zh.yml | |
| # ───────────────────────────────────────────────────────────────────────── | |
| # New Astro site (site/) — runs alongside the MkDocs build during migration. | |
| # When the Astro site replaces MkDocs, drop the `docs-build` job above. | |
| # ───────────────────────────────────────────────────────────────────────── | |
| site: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: site | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: site/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Unit test — content transforms | |
| run: npm run test:sync | |
| - name: Build (sync + astro + pagefind index) | |
| run: npm run build | |
| env: | |
| # Production build target: GitHub Pages under the repo path. | |
| # Keep this in lockstep with astro.config.mjs `base` when it's re-enabled. | |
| SITE_BASE: /advanced-agentic-dev-patterns | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
| with: | |
| name: site-dist | |
| path: site/dist | |
| retention-days: 7 |