ci.yml•4.11 kB
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [20.x, 22.x]
python-version: ['3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js dependencies
run: pnpm install
- name: Install Python dependencies
run: |
cd packages/python-worker
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest mypy ruff
- name: TypeScript type checking
run: pnpm typecheck
- name: ESLint
run: pnpm lint
- name: Build packages
run: pnpm build
- name: Run TypeScript tests
run: pnpm test
- name: Run Python tests
run: |
cd packages/python-worker
python -m pytest tests/ -v --tb=short
- name: Python type checking (mypy)
run: |
cd packages/python-worker
python -m mypy src/ --ignore-missing-imports
- name: Python linting (ruff)
run: |
cd packages/python-worker
python -m ruff check src/
- name: Run healthcheck
run: pnpm healthcheck
continue-on-error: true
- name: Upload test artifacts on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-artifacts-${{ matrix.os }}-node${{ matrix.node-version }}-py${{ matrix.python-version }}
path: |
artifacts/
packages/*/coverage/
packages/python-worker/pytest-report.xml
retention-days: 7
coverage:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: |
pnpm install
cd packages/python-worker
pip install -r requirements.txt
pip install pytest-cov
- name: Build packages
run: pnpm build
- name: Run tests with coverage
run: |
pnpm test:coverage
cd packages/python-worker
python -m pytest tests/ --cov=src --cov-report=xml --cov-report=html
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: |
packages/*/coverage/lcov.info
packages/python-worker/coverage.xml
fail_ci_if_error: false
docs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install
- name: Build packages
run: pnpm build
- name: Generate documentation
run: pnpm docs:generate
- name: Check documentation links
run: pnpm docs:links
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site