Switch from Travis CI to GitHub Actions (#336)

* Add GitHub Actions
* Remove Travis CI
* Remove known first party from isort's config
This commit is contained in:
Michael K 2020-10-20 14:44:54 +00:00 committed by GitHub
parent d0e841b41d
commit b96720390f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 72 deletions

47
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Tests
on:
push:
branches:
- master
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
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 wheel setuptools tox
- name: Run tox targets for ${{ matrix.python-version }}
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') python -m tox
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Run lint
run: tox -e qa

View File

@ -1,48 +0,0 @@
sudo: false
language: python
python:
- '3.8'
- '3.7'
- '3.6'
- '3.5'
env:
- TWISTED="twisted"
- TWISTED="twisted==18.7.0"
install:
- pip install $TWISTED -e .[tests]
- pip freeze
script:
- pytest
stages:
- lint
- test
- name: release
if: tag IS present
jobs:
include:
- stage: lint
python: 3.6
install: pip install -U -e .[tests] black pyflakes isort
script:
- pyflakes daphne tests
- black --check daphne tests
- isort --check-only --diff --recursive daphne tests
- stage: release
python: 3.6
script: skip
deploy:
provider: pypi
user: andrewgodwin_bot
on:
tags: true
distributions: sdist bdist_wheel
password:
secure: IA+dvSmMKN+fT47rgRb6zdmrExhK5QCVEDH8kheC6kAacw80ORBZKo6sMX9GQBJ3BlfhTqrzAhItHkDUxonb579rJDvmlJ7FPg7axZpsY9Fmls6q1rJC/La8iGWx20+ctberejKSH3wSwa0LH0imJXGDoKKzf1DLmk5pEEWjG2QqhKdEtyAcnzOPnDWcRCs+DKfQcMzETH7lMFN8oe3aBhHLLtcg4yA78cN5CeyyH92lmbaVp7k/b1FqXXFgf16bi5tlgLrb6DhmcnNjwLMSHRafNoPCXkWQOwh6gEHeHRR3OsHsBueyJHIikuHNrpmgpAqjYlVQ5WqmfgMlhCfRm9xL+G4G+KK9n8AJNGAszUfxVlPvMTw+nkOSd/bmxKrdCqqYnDIvDLucXJ86TstNzklfAwr3FL+wBlucRtOMLhQlHIaPTXYcNpOuh6B4ELjC+WjDGh8EdRKvcsZz7+5AS5ZaDDccuviMzQFsXVcE2d4HiosbARVrkxJ7j3MWp0OGgWVxXgRO2EQIksbgGSIjI8PqFjBqht2WT6MhVZPCc9XHUlP2CiAR5+QY8JgTIztbEDuhpgr0cRAtiHwJEAxDR9tJR/j/v4X/Pau2ZdR0C0yW77lVgD75spLL0khAnU7q+qgiF0hyQ7gRRVy0tElT0HBenVbzjzHowdJX8lSPjRg=

View File

@ -1,9 +1,6 @@
daphne
======
.. image:: https://api.travis-ci.org/django/daphne.svg
:target: https://travis-ci.org/django/daphne
.. image:: https://img.shields.io/pypi/v/daphne.svg
:target: https://pypi.python.org/pypi/daphne

View File

@ -127,8 +127,8 @@ class DaphneProcess(multiprocessing.Process):
from twisted.internet import reactor
from .server import Server
from .endpoints import build_endpoint_description_strings
from .server import Server
try:
# Create the server class
@ -266,8 +266,8 @@ class TestApplication:
def _reinstall_reactor():
import sys
import asyncio
import sys
from twisted.internet import asyncioreactor

View File

@ -1,16 +1,10 @@
[bdist_wheel]
universal=1
[tool:pytest]
addopts = tests/
[isort]
include_trailing_comma = True
multi_line_output = 3
known_first_party = channels,daphne,asgiref,channels_redis
line_length = 88
[flake8]
exclude = venv/*,tox/*,docs/*,testproject/*,js_client/*,.eggs/*
ignore = E123,E128,E266,E402,W503,E731,W601
extend-ignore = E123, E128, E266, E402, W503, E731, W601
max-line-length = 120
[isort]
profile = black
[tool:pytest]
testpaths = tests

View File

@ -3,10 +3,9 @@
import collections
from urllib import parse
from hypothesis import assume, given, settings
import http_strategies
from http_base import DaphneTestCase
from hypothesis import assume, given, settings
class TestHTTPRequest(DaphneTestCase):

View File

@ -1,9 +1,8 @@
# coding: utf8
from hypothesis import given, settings
import http_strategies
from http_base import DaphneTestCase
from hypothesis import given, settings
class TestHTTPResponse(DaphneTestCase):

View File

@ -4,10 +4,9 @@ import collections
import time
from urllib import parse
from hypothesis import given, settings
import http_strategies
from http_base import DaphneTestCase, DaphneTestingInstance
from hypothesis import given, settings
class TestWebsocket(DaphneTestCase):

23
tox.ini Normal file
View File

@ -0,0 +1,23 @@
[tox]
envlist =
py{36,37,38,39}-twisted{187,latest}
qa
[testenv]
usedevelop = true
extras = tests
commands =
pytest -v {posargs}
deps =
twisted187: twisted==18.7.0
twistedlatest: twisted>=20.3.0
[testenv:qa]
deps =
black
flake8
isort
commands =
flake8 daphne tests
black --check daphne tests
isort --check-only --diff daphne tests