Files
claude-howto/.github/workflows/ci.yml
T
Luong NGUYEN 3a1f45e5e9 fix(ci): Use virtual environments instead of --system flag
The --system flag fails on GitHub Actions runners because Python is
externally managed. Using uv venv + uv pip install instead.
2025-12-10 23:54:08 +01:00

112 lines
2.5 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Cancel in-progress runs for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.11
- name: Create venv and install Ruff
run: |
uv venv
uv pip install ruff
- name: Ruff Format Check
run: uv run ruff format --check scripts/
- name: Ruff Lint Check
run: uv run ruff check scripts/
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.11
- name: Create venv and install Bandit
run: |
uv venv
uv pip install "bandit[toml]"
- name: Run Bandit Security Scan
run: uv run bandit -c pyproject.toml -r scripts/ --exclude scripts/tests/
test:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.11
- name: Create venv and install dependencies
run: |
uv venv
uv pip install -r requirements.txt
uv pip install pytest pytest-asyncio
- name: Run Tests
run: uv run pytest scripts/tests/ -v --tb=short
build:
name: Build EPUB
runs-on: ubuntu-latest
needs: [lint, security, test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Build EPUB
run: uv run scripts/build_epub.py
- name: Verify EPUB Created
run: |
if [ -f claude-howto-guide.epub ]; then
echo "EPUB built successfully"
ls -lh claude-howto-guide.epub
else
echo "EPUB file not found!"
exit 1
fi
- name: Upload EPUB Artifact
uses: actions/upload-artifact@v4
with:
name: claude-howto-guide-epub
path: claude-howto-guide.epub
retention-days: 7