chore(ci): Use latest pr-title.yml
from hugrverse-actions
(#105)
#376
This file contains 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: Python package CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.11'] | |
action: ['lint', 'type', 'format'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- name: Cache poetry | |
uses: actions/cache@v3.3.1 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup poetry | |
run: | | |
pip install pip==22.2.1 poetry==1.6.1 | |
poetry run pip install --upgrade pip | |
- name: Install dev dependencies | |
run: | | |
poetry install --all-extras | |
- name: Check formatting with black | |
run: | | |
poetry run black --check . | |
if: ${{ matrix.action == 'format' }} | |
- name: Typecheck with mypy | |
run: | | |
poetry run mypy qnexus/ | |
poetry run mypy tests/ | |
poetry run mypy integration/ | |
if: ${{ matrix.action == 'type' }} | |
- name: Lint with pylint | |
run: | | |
poetry run pylint qnexus/ | |
poetry run pylint tests/ | |
poetry run pylint integration/ | |
if: ${{ matrix.action == 'lint' }} | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.10', '3.11'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- name: Cache poetry | |
uses: actions/cache@v3.3.1 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup poetry | |
run: | | |
pip install pip==22.2.1 poetry==1.6.1 | |
poetry run pip install --upgrade pip | |
- name: Install dev dependencies | |
run: | | |
poetry install --all-extras | |
- name: Test with pytest | |
run: | | |
poetry run pytest tests/ --doctest-modules --cov=qnexus --cov-report=html --cov-report=term | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@master | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: htmlcov/ |