Skip to content

docs: introduce Docusaurus docs site and simplify wiki (#151) #303

docs: introduce Docusaurus docs site and simplify wiki (#151)

docs: introduce Docusaurus docs site and simplify wiki (#151) #303

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
if: |
github.event_name != 'push' ||
(
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.message, '[skip-release]')
)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: 'requirements.txt'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Lint with Ruff
run: |
ruff check . --ignore C901,D417
test:
if: |
github.event_name != 'push' ||
(
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.message, '[skip-release]')
)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- lane: fast
marker: "not slow"
timeout: 10
- lane: slow
marker: "slow"
timeout: 10
timeout-minutes: ${{ matrix.timeout }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: 'requirements.txt'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pytest pytest-timeout pytest-cov pytest-xdist
- name: Run ${{ matrix.lane }} tests
run: |
pytest -v --tb=short -m "${{ matrix.marker }}" \
-n auto \
--cov=src --cov-report=xml:coverage-${{ matrix.lane }}.xml \
--cov-report=term-missing
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@v5
with:
files: coverage-${{ matrix.lane }}.xml
flags: ${{ matrix.lane }}
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload .coverage data
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.lane }}
path: .coverage
include-hidden-files: true
ci:
runs-on: ubuntu-latest
needs: [lint, test]
if: always()
steps:
- name: Check required jobs
run: |
if [[ "${{ needs.lint.result }}" != "success" || "${{ needs.test.result }}" != "success" ]]; then
echo "Required jobs failed: lint=${{ needs.lint.result }}, test=${{ needs.test.result }}"
exit 1
fi
coverage-badge:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install coverage
run: pip install "coverage[toml]"
- name: Download fast coverage data
uses: actions/download-artifact@v4
with:
name: coverage-data-fast
path: cov-fast
- name: Download slow coverage data
uses: actions/download-artifact@v4
with:
name: coverage-data-slow
path: cov-slow
- name: Combine coverage and generate JSON
run: |
cp cov-fast/.coverage .coverage.fast
cp cov-slow/.coverage .coverage.slow
coverage combine .coverage.fast .coverage.slow
coverage json -o coverage.json --include="src/*"
- name: Update coverage.json and push
run: |
if [ -f coverage.json ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add coverage.json
if git diff --cached --quiet; then
echo "No coverage changes to commit"
else
git commit -m "chore: update coverage.json [skip ci]"
git pull --rebase
git push
fi
fi