Skip to content

Commit

Permalink
Move from travis to github actions (#316)
Browse files Browse the repository at this point in the history
* move from travis to github actions

* add flake8 to tox

* add flake8 as env in tox

* add flake8 to setup

* remove sqlalchemy 1.1 in tests

* fix flake8 exclude

* move coveralls to github action

* fix coverall github action config

* move coveralls to tox

* move coveralls dep to test list

* add coverage command

* move coveralls back into github action

* modify coverage output
  • Loading branch information
mvanlonden authored Sep 16, 2021
1 parent 20ecaea commit cba727c
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 52 deletions.
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
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

0 comments on commit cba727c

Please sign in to comment.