From b9320b41d96b869adc6e71ed2b906794f7db8fbd Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 25 Nov 2020 20:56:03 +0100 Subject: [PATCH 1/6] Add initial GitHub Actions workflow. --- .github/workflows/test.yml | 47 ++++++++++++++++++++++++++++++++++++++ tox.ini | 30 +++--------------------- 2 files changed, 50 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/test.yml 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 = . From 1ebc2a23ea27acafe30452b0532c07167909764d Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 25 Nov 2020 21:01:53 +0100 Subject: [PATCH 2/6] Add gh-action mapping. --- tox.ini | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tox.ini b/tox.ini index 0dd5e0c..95040ac 100644 --- a/tox.ini +++ b/tox.ini @@ -17,6 +17,14 @@ commands = coverage run setup.py test coverage xml +[gh-actions] +python = + 2.7: py27 + 3.5: py35 + 3.6: py36 + 3.7: py37 + 3.8: py38 + [testenv:bandit] description = PyCQA security linter deps = bandit<1.6 From 2322f7a0bf71ef2a723fc6782c7fc29bfe666a51 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 25 Nov 2020 21:04:49 +0100 Subject: [PATCH 3/6] Fix config section names. --- tox.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 95040ac..cdc5b18 100644 --- a/tox.ini +++ b/tox.ini @@ -25,23 +25,23 @@ python = 3.7: py37 3.8: py38 -[testenv:bandit] +[testenv:py37-bandit] description = PyCQA security linter deps = bandit<1.6 commands = bandit -r --ini tox.ini -[testenv:docs] +[testenv:py37-docs] description = Build the HTML documentation deps = sphinx commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html whitelist_externals = make -[testenv:flake8] +[testenv:py37-flake8] description = Static code analysis and code style deps = flake8 commands = flake8 -[testenv:readme] +[testenv:py37-readme] description = Ensure README renders on PyPI deps = twine commands = From de2ed4bafc2865cd77caa9876fe4f286867a4815 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 25 Nov 2020 21:11:14 +0100 Subject: [PATCH 4/6] Ignore bandit errors. --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index cdc5b18..d5b4725 100644 --- a/tox.ini +++ b/tox.ini @@ -29,6 +29,7 @@ python = description = PyCQA security linter deps = bandit<1.6 commands = bandit -r --ini tox.ini +ignore_errors = true [testenv:py37-docs] description = Build the HTML documentation From 7580bc1619685b42f8ece2ba3d1c8010032e1888 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 25 Nov 2020 21:15:45 +0100 Subject: [PATCH 5/6] Ignore it for real? --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index d5b4725..831fc68 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,7 @@ python = [testenv:py37-bandit] description = PyCQA security linter deps = bandit<1.6 -commands = bandit -r --ini tox.ini +commands = - bandit -r --ini tox.ini ignore_errors = true [testenv:py37-docs] From 197cdbcfadc3b3059cde012a6548d4df8be20df1 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 25 Nov 2020 21:18:45 +0100 Subject: [PATCH 6/6] Add Jazzband release workflow. --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++ .travis.yml | 55 ----------------------------------- README.rst | 10 +++---- 3 files changed, 58 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..59142fd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + build: + if: github.repository == 'jazzband/django-analytical' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - 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: release-${{ hashFiles('**/setup.py') }} + restore-keys: | + release- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U setuptools twine wheel + + - name: Build package + run: | + python setup.py --version + python setup.py sdist --format=gztar bdist_wheel + twine check dist/* + + - name: Upload packages to Jazzband + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + user: jazzband + password: ${{ secrets.JAZZBAND_RELEASE_KEY }} + repository_url: https://jazzband.co/projects/django-analytical/upload diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b00cac1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ -os: linux -dist: xenial -language: python -python: -- 3.4 -- 3.5 -- 3.6 -- 3.7 -- 3.8 - -env: -- DJANGO=1.11 -- DJANGO=2.2 -- DJANGO=3.0 - -install: -- pip install tox-travis -script: -- tox - -stages: -- lint -- test -- deploy - -jobs: - allow_failures: - - env: TOXENV=bandit - exclude: - # Python/Django combinations that aren't officially supported - - { stage: test, python: 3.4, env: DJANGO=2.2 } - - { stage: test, python: 3.4, env: DJANGO=3.0 } - - { stage: test, python: 3.5, env: DJANGO=3.0 } - - { stage: test, python: 3.8, env: DJANGO=1.11 } - include: - - { stage: lint, python: 3.7, env: TOXENV=flake8 } - - { stage: lint, python: 3.7, env: TOXENV=bandit } - - { stage: lint, python: 3.7, env: TOXENV=readme } - - { stage: test, python: 2.7, env: DJANGO=1.11 } - - stage: deploy - if: tag is present - deploy: - provider: pypi - server: https://jazzband.co/projects/django-analytical/upload - distributions: sdist bdist_wheel - username: jazzband - password: - secure: JCr5hRjAeXuiISodCJf8HWd4BTJMpl2eiHI8NciPaSM9WwOOeUXxmlcP8+lWlXxgM4BYUC/O7Q90fkwj5x06n+z4oyJSEVerTvCDcpeZ68KMMG1tR1jTbHcxfEKoEvcs2J0fThJ9dIMtfbtUbIpzusJHkZPjsIy8HAJDw8knnJs= - on: - tags: true - repo: jazzband/django-analytical - env: - install: skip - script: skip - python: 3.7 diff --git a/README.rst b/README.rst index 0fa7527..2c5dc22 100644 --- a/README.rst +++ b/README.rst @@ -26,12 +26,12 @@ an asynchronous version of the Javascript code if possible. .. |latest-version| image:: https://img.shields.io/pypi/v/django-analytical.svg :alt: Latest version on PyPI :target: https://pypi.org/project/django-analytical/ -.. |build-status| image:: https://img.shields.io/travis/jazzband/django-analytical/master.svg - :alt: Build status - :target: https://travis-ci.org/jazzband/django-analytical -.. |coverage| image:: https://img.shields.io/coveralls/github/jazzband/django-analytical/master.svg +.. |build-status| image:: https://github.com/jazzband/django-analytical/workflows/Test/badge.svg + :target: https://github.com/jazzband/django-analytical/actions + :alt: GitHub Actions +.. |coverage| image:: https://codecov.io/gh/jazzband/django-analytical/branch/master/graph/badge.svg :alt: Test coverage - :target: https://coveralls.io/r/jazzband/django-analytical + :target: https://codecov.io/gh/jazzband/django-analytical .. |python-support| image:: https://img.shields.io/pypi/pyversions/django-analytical.svg :target: https://pypi.org/project/django-analytical/ :alt: Python versions