lint, run ci on pr, update pre-commit #54
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: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip wheel | |
python -m pip install -U black isort flake8 bandit[toml] | |
- run: python -m black . --check | |
- run: python -m isort . --check-only | |
- run: python -m flake8 . | |
- run: python -m bandit . --recursive -c pyproject.toml | |
test: | |
needs: lint | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, macos-13, windows-2019] | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
exclude: | |
- os: windows-2019 | |
python-version: '3.12' | |
- os: windows-2019 | |
python-version: '3.13' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip wheel | |
python -m pip install -e .[test] | |
- name: Run tests | |
run: | | |
python -m unittest discover -s tests | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Build dists | |
run: | | |
python -m pip install -U pip wheel build | |
python -m build | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |