ci.yml•2.78 kB
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
# Exclude some combinations to reduce CI time
- os: windows-latest
python-version: "3.8"
- os: windows-latest
python-version: "3.9"
- os: macos-latest
python-version: "3.8"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Create mock Quarkdown JAR
run: |
python scripts/dev.py create-test-jar
- name: Run linting
run: |
python scripts/dev.py lint
- name: Run security checks
run: |
python scripts/dev.py security
- name: Run unit tests
run: |
python scripts/dev.py test --coverage
- name: Run integration tests
run: |
python scripts/dev.py test --integration
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
with:
file: ./htmlcov/coverage.xml
fail_ci_if_error: true
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
- name: Check package
run: |
twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [test, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}