diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..50ffc6ad --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,26 @@ +name: 🚀 Deploy to PyPI + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Build wheel and source tarball + run: | + pip install wheel + python setup.py sdist bdist_wheel + - name: Publish a Python distribution to PyPI + uses: pypa/gh-action-pypi-publish@v1.1.0 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..3fc35f9d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: Lint + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Run lint 💅 + run: tox + env: + TOXENV: flake8 \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..4adb26f6 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,38 @@ +name: Tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + max-parallel: 10 + matrix: + sql-alchemy: ["1.2", "1.3"] + python-version: ["3.6", "3.7", "3.8", "3.9"] + + steps: + - uses: actions/checkout@v2 + - 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 tox tox-gh-actions + - name: Test with tox + run: tox + env: + SQLALCHEMY: ${{ matrix.sql-alchemy }} + TOXENV: ${{ matrix.toxenv }} + - name: Upload coverage.xml + if: ${{ matrix.sql-alchemy == '1.3' && matrix.python-version == '3.9' }} + uses: actions/upload-artifact@v2 + with: + name: graphene-sqlalchemy-coverage + path: coverage.xml + if-no-files-found: error + - name: Upload coverage.xml to codecov + if: ${{ matrix.sql-alchemy == '1.3' && matrix.python-version == '3.9' }} + uses: codecov/codecov-action@v1 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5a988428..00000000 --- a/.travis.yml +++ /dev/null @@ -1,47 +0,0 @@ -language: python -matrix: - include: - # Python 2.7 - - env: TOXENV=py27 - python: 2.7 - # Python 3.5 - - env: TOXENV=py35 - python: 3.5 - # Python 3.6 - - env: TOXENV=py36 - python: 3.6 - # Python 3.7 - - env: TOXENV=py37 - python: 3.7 - dist: xenial - # SQLAlchemy 1.1 - - env: TOXENV=py37-sql11 - python: 3.7 - dist: xenial - # SQLAlchemy 1.2 - - env: TOXENV=py37-sql12 - python: 3.7 - dist: xenial - # SQLAlchemy 1.3 - - env: TOXENV=py37-sql13 - python: 3.7 - dist: xenial - # Pre-commit - - env: TOXENV=pre-commit - python: 3.7 - dist: xenial -install: pip install .[dev] -script: tox -after_success: coveralls -cache: - directories: - - $HOME/.cache/pip - - $HOME/.cache/pre-commit -deploy: - provider: pypi - user: syrusakbary - on: - tags: true - password: - secure: q0ey31cWljGB30l43aEd1KIPuAHRutzmsd2lBb/2zvD79ReBrzvCdFAkH2xcyo4Volk3aazQQTNUIurnTuvBxmtqja0e+gUaO5LdOcokVdOGyLABXh7qhd2kdvbTDWgSwA4EWneLGXn/SjXSe0f3pCcrwc6WDcLAHxtffMvO9gulpYQtUoOqXfMipMOkRD9iDWTJBsSo3trL70X1FHOVr6Yqi0mfkX2Y/imxn6wlTWRz28Ru94xrj27OmUnCv7qcG0taO8LNlUCquNFAr2sZ+l+U/GkQrrM1y+ehPz3pmI0cCCd7SX/7+EG9ViZ07BZ31nk4pgnqjmj3nFwqnCE/4IApGnduqtrMDF63C9TnB1TU8oJmbbUCu4ODwRpBPZMnwzaHsLnrpdrB89/98NtTfujdrh3U5bVB+t33yxrXVh+FjgLYj9PVeDixpFDn6V/Xcnv4BbRMNOhXIQT7a7/5b99RiXBjCk6KRu+Jdu5DZ+3G4Nbr4oim3kZFPUHa555qbzTlwAfkrQxKv3C3OdVJR7eGc9ADsbHyEJbdPNAh/T+xblXTXLS3hPYDvgM+WEGy3CytBDG3JVcXm25ZP96EDWjweJ7MyfylubhuKj/iR1Y1wiHeIsYq9CqRrFQUWL8gFJBfmgjs96xRXXXnvyLtKUKpKw3wFg5cR/6FnLeYZ8k= - distributions: "sdist bdist_wheel" diff --git a/setup.py b/setup.py index 7b350c39..e20a1750 100644 --- a/setup.py +++ b/setup.py @@ -60,8 +60,8 @@ extras_require={ "dev": [ "tox==3.7.0", # Should be kept in sync with tox.ini - "coveralls==1.10.0", "pre-commit==1.14.4", + "flake8==3.7.9", ], "test": tests_require, }, diff --git a/tox.ini b/tox.ini index 562da2dc..69d84f92 100644 --- a/tox.ini +++ b/tox.ini @@ -1,20 +1,40 @@ [tox] -envlist = pre-commit,py{27,35,36,37}-sql{11,12,13} +envlist = pre-commit,py{27,35,36,37,38,39}-sql{12,13},flake8 skipsdist = true minversion = 3.7.0 +[gh-actions] +python = + 2.7: py27 + 3.5: py35 + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 + +[gh-actions:env] +SQLALCHEMY = + 1.2: sql12 + 1.3: sql13 + [testenv] +passenv = GITHUB_* deps = .[test] - sql11: sqlalchemy>=1.1,<1.2 sql12: sqlalchemy>=1.2,<1.3 sql13: sqlalchemy>=1.3,<1.4 commands = - pytest graphene_sqlalchemy --cov=graphene_sqlalchemy {posargs} + pytest graphene_sqlalchemy --cov=graphene_sqlalchemy --cov-report=term --cov-report=xml {posargs} [testenv:pre-commit] -basepython=python3.7 +basepython=python3.9 deps = .[dev] commands = pre-commit {posargs:run --all-files} + +[testenv:flake8] +basepython = python3.9 +deps = -e.[dev] +commands = + flake8 --exclude setup.py,docs,examples,tests,.tox --max-line-length 120 \ No newline at end of file