Update pre-commit hook asottile/pyupgrade to v3 #117
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Validate | |
#on: [push] | |
#on: [push, pull_request] | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 black | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --select=E9,F63,F7,F82,F841,E266 | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --exit-zero --max-complexity=10 --max-line-length=127 | |
- name: Lint with black | |
#uses: psf/black@stable | |
run: | | |
black --check --diff --color . | |
test-n-build: | |
name: Test and Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest build twine setuptools setuptools_scm | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi | |
- name: Test with pytest | |
run: | | |
pytest | |
- name: Test build package | |
run: | | |
python -m build --outdir dist/ | |
python -m twine check dist/* | |
python -m setuptools_scm --strip-dev |