mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 12:44:15 +03:00
Add github actions to run linting and tests (#1349)
This commit is contained in:
parent
afa44e8a5f
commit
46bb1202e4
26
.github/workflows/deploy.yml
vendored
Normal file
26
.github/workflows/deploy.yml
vendored
Normal file
|
@ -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_password }}
|
26
.github/workflows/lint.yml
vendored
Normal file
26
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
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: pre-commit
|
||||
- name: Run mypy
|
||||
run: tox
|
||||
env:
|
||||
TOXENV: mypy
|
26
.github/workflows/tests.yml
vendored
Normal file
26
.github/workflows/tests.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
name: Tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
python-version: ["2.7", "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:
|
||||
TOXENV: ${{ matrix.toxenv }}
|
|
@ -18,11 +18,11 @@ repos:
|
|||
hooks:
|
||||
- id: pyupgrade
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: 18.9b0
|
||||
rev: 21.6b0
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 3.7.7
|
||||
rev: 3.9.2
|
||||
hooks:
|
||||
- id: flake8
|
||||
|
|
|
@ -54,10 +54,10 @@ for i, letter in enumerate(letter_chars):
|
|||
def edges(selected_letters):
|
||||
return [
|
||||
{
|
||||
"node": {"id": base64("Letter:%s" % l.id), "letter": l.letter},
|
||||
"cursor": base64("arrayconnection:%s" % l.id),
|
||||
"node": {"id": base64("Letter:%s" % letter.id), "letter": letter.letter},
|
||||
"cursor": base64("arrayconnection:%s" % letter.id),
|
||||
}
|
||||
for l in [letters[i] for i in selected_letters]
|
||||
for letter in [letters[i] for i in selected_letters]
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ def test_big_list_of_containers_multiple_fields_query_benchmark(benchmark):
|
|||
|
||||
|
||||
def test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark(
|
||||
benchmark
|
||||
benchmark,
|
||||
):
|
||||
class Container(ObjectType):
|
||||
x = Int()
|
||||
|
|
3
setup.py
3
setup.py
|
@ -49,6 +49,9 @@ tests_require = [
|
|||
"pytest-benchmark",
|
||||
"pytest-cov",
|
||||
"pytest-mock",
|
||||
# pinning fastdiff dep (required by snapshottest) because later versions
|
||||
# require wasmer 1.0.0 which is not compatible with Python 2.7
|
||||
"fastdiff==0.2.0",
|
||||
"snapshottest",
|
||||
"coveralls",
|
||||
"promise",
|
||||
|
|
|
@ -56,10 +56,10 @@ for i, letter in enumerate(letter_chars):
|
|||
def edges(selected_letters):
|
||||
return [
|
||||
{
|
||||
"node": {"id": base64("Letter:%s" % l.id), "letter": l.letter},
|
||||
"cursor": base64("arrayconnection:%s" % l.id),
|
||||
"node": {"id": base64("Letter:%s" % letter.id), "letter": letter.letter},
|
||||
"cursor": base64("arrayconnection:%s" % letter.id),
|
||||
}
|
||||
for l in [letters[i] for i in selected_letters]
|
||||
for letter in [letters[i] for i in selected_letters]
|
||||
]
|
||||
|
||||
|
||||
|
|
27
tox.ini
27
tox.ini
|
@ -1,20 +1,27 @@
|
|||
[tox]
|
||||
envlist = flake8,py27,py34,py35,py36,py37,pre-commit,pypy,mypy
|
||||
skipsdist = true
|
||||
envlist = py{27,36,37,38,39},flake8,pre-commit,mypy
|
||||
|
||||
[gh-actions]
|
||||
python =
|
||||
2.7: py27
|
||||
3.6: py36
|
||||
3.7: py37
|
||||
3.8: py38
|
||||
3.9: py39
|
||||
|
||||
[testenv]
|
||||
passenv = *
|
||||
usedevelop = True
|
||||
deps =
|
||||
.[test]
|
||||
py{35,36,37}: pytest-asyncio
|
||||
-e.[test]
|
||||
py{36,37,38,39}: pytest-asyncio
|
||||
setenv =
|
||||
PYTHONPATH = .:{envdir}
|
||||
commands =
|
||||
py{27,py}: py.test --cov=graphene graphene examples {posargs}
|
||||
py{35}: py.test --cov=graphene graphene examples tests_asyncio {posargs}
|
||||
py{36,37}: py.test --cov=graphene graphene examples tests_asyncio tests_py36 {posargs}
|
||||
py{27}: py.test --cov=graphene graphene examples {posargs}
|
||||
py{36,37,38,39}: py.test --cov=graphene graphene examples tests_asyncio tests_py36 {posargs}
|
||||
|
||||
[testenv:pre-commit]
|
||||
basepython=python3.7
|
||||
deps =
|
||||
pre-commit>0.12.0
|
||||
setenv =
|
||||
|
@ -23,9 +30,9 @@ commands =
|
|||
pre-commit {posargs:run --all-files}
|
||||
|
||||
[testenv:mypy]
|
||||
basepython=python3.7
|
||||
deps =
|
||||
mypy
|
||||
types-six
|
||||
commands =
|
||||
mypy graphene
|
||||
|
||||
|
@ -34,5 +41,3 @@ deps = flake8
|
|||
commands =
|
||||
pip install -e .
|
||||
flake8 graphene
|
||||
|
||||
[pytest]
|
||||
|
|
Loading…
Reference in New Issue
Block a user