Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from travis to github actions #316

Merged
merged 13 commits into from
Sep 16, 2021
26 changes: 26 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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 }}
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
47 changes: 0 additions & 47 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
28 changes: 24 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +8 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can probably be removed since they're not being tested against.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will follow up with coverage fix and removing these tests

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