ci: update tested dependency list #278
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 | |
on: [push, pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install '.[dev]' | |
- name: Lint with flake8 | |
run: | | |
pip install flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Sort imports with isort | |
run: isort --diff --check . | |
- name: Format using black | |
run: black --check . | |
- name: Run mypy | |
run: mypy --strict aiocouch tests examples | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"] | |
couchdb: ["2.3", "3.1", "3.2", "3.3"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install '.[tests]' | |
- name: Test with pytest | |
run: | | |
python -m pytest --cov-report xml --cov aiocouch | |
env: | |
COUCHDB_USER: admin | |
COUCHDB_PASS: password | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
if: ${{ matrix.python-version == '3.9' && matrix.couchdb == '3.1' }} | |
with: | |
name: Python ${{ matrix.python-version }} | |
services: | |
couchdb: | |
image: couchdb:${{ matrix.couchdb }} | |
ports: | |
- 5984:5984 | |
env: | |
COUCHDB_USER: admin | |
COUCHDB_PASSWORD: password | |
documentation: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install '.[docs]' | |
- name: Build documentation | |
run: make html | |
working-directory: docs | |
artifacts: | |
needs: [lint, documentation, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install wheel | |
pip install . | |
- name: Build Python distribution | |
run: python setup.py sdist bdist_wheel | |
- name: Upload distribution artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: distribution-packages | |
path: dist/ | |
- name: Publish to PyPI | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
- name: Create Release | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false |