diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index acc62ac..b3f206d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: check-yaml - id: debug-statements - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 21.6b0 hooks: - id: black language_version: python3.9 @@ -21,17 +21,18 @@ repos: - id: autoflake args: [ '--in-place', '--remove-all-unused-imports', '--remove-unused-variable' ] - repo: https://github.com/PyCQA/isort - rev: 5.9.3 + rev: 5.9.1 hooks: - id: isort args: ['--line-length=79'] language_version: python3.9 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910-1 + rev: v0.902 hooks: - id: mypy + additional_dependencies: [types-requests, types-PyYAML, types-Flask, types-Werkzeug] - repo: https://github.com/asottile/pyupgrade - rev: v2.29.0 + rev: v2.19.4 hooks: - id: pyupgrade args: [--py36-plus] diff --git a/pyproject.toml b/pyproject.toml index bd35b30..4a25e75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ exclude = ''' | \.mypy_cache | \.tox | \.venv + | \.direnv | venv | _build | buck-out diff --git a/python.yml b/python.yml new file mode 100644 index 0000000..3839b59 --- /dev/null +++ b/python.yml @@ -0,0 +1,48 @@ +name: python + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ 3.7, 3.8, 3.9, 3.10 ] + + steps: + - 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 }} + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install build tools + run: | + python -m pip install --upgrade pip + pip install -U black pylama wheel pip tox + pip install . + - name: Set build name + run: echo "::set-output name=${GITHUB_REPOSITORY}-$(python setup.py --version)" + - name: Lint + run: | + - name: Run Tox + # Run tox using the version of Python in `PATH` + run: tox -e py + - name: Build Package + if: matrix.python-version == 3.9 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + run: | + python setup.py sdist bdist_wheel + - name: Publish package + if: matrix.python-version == 3.9 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} diff --git a/tox.ini b/tox.ini index abbe33a..c8289ec 100644 --- a/tox.ini +++ b/tox.ini @@ -9,5 +9,5 @@ deps= commands= pip install .[test] black --verbose -l 79 --check --diff . - pylama --ignore E501,W503 --skip 'venv/*,.tox/*,.eggs/*' + pylama --ignore E501,W503,E203 --skip 'venv/*,.direnv/*,.tox/*,.eggs/*' py.test