diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f8f8a5a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,47 @@ +name: Test + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 5 + matrix: + python-version: [2.7, 3.5, 3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + -${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }} + restore-keys: | + -${{ matrix.python-version }}-v1- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade tox tox-gh-actions + + - name: Tox tests + run: | + tox -v + + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + name: Python ${{ matrix.python-version }} diff --git a/tox.ini b/tox.ini index d67f7c9..0dd5e0c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,45 +1,27 @@ [tox] envlist = # Python/Django combinations that are officially supported - py{27,34,35,36,37}-django111 + py{27,35,36,37}-django111 py{35,36,37,38}-django22 py{36,37,38}-django30 - flake8 - bandit - readme - docs - clean + py37-{flake8,bandit,readme,docs} [testenv] description = Unit tests deps = coverage - coveralls django111: Django>=1.11,<2.0 django22: Django>=2.2,<3.0 django30: Django>=3.0,<3.1 commands = coverage run setup.py test - sh -c 'coveralls | true' -passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH -whitelist_externals = sh + coverage xml [testenv:bandit] description = PyCQA security linter deps = bandit<1.6 commands = bandit -r --ini tox.ini -[testenv:clean] -description = Clean up bytecode and build artifacts -deps = -commands = - rm -rf .tox/ django_analytical.egg-info/ build/ dist/ docs/_build/ - find {toxinidir} -type f -name '*.pyc' -delete - find {toxinidir} -type d -name '__pycache__' -delete -whitelist_externals = - find - rm - [testenv:docs] description = Build the HTML documentation deps = sphinx @@ -58,12 +40,6 @@ commands = {envpython} setup.py -q sdist bdist_wheel twine check dist/* -[travis:env] -DJANGO = - 1.11: django111 - 2.2: django22 - 3.0: django30 - [bandit] exclude = .cache,.git,.tox,build,dist,docs,tests targets = .