From 82b9dd91876c8b91991a26a6da51aa503f25ccf7 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 26 Nov 2020 18:25:10 +0100 Subject: [PATCH 1/5] Add GitHub Actions test workflow. --- .github/workflows/test.yml | 48 ++++++++++++++++++++++++++++++++++++++ tox.ini | 3 ++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..bb8ef4a0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,48 @@ +name: Test + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 5 + matrix: + python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy3'] + + 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 3c28da7d..cfba35de 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,8 @@ ignore_outcome = commands = unittest: coverage run {envbindir}/django-admin test -v2 unittest: coverage report - pytest: pytest --cov=. --ignore=.tox --disable-pytest-warnings {toxinidir} + unittest: coverage xml + pytest: pytest --cov=. --ignore=.tox --disable-pytest-warnings --cov-report=xml --cov-append {toxinidir} setenv = PYTHONDONTWRITEBYTECODE=1 DJANGO_SETTINGS_MODULE=tests.settings From b79967581e2b7df7d190d0e2891d057adc36a86d Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 26 Nov 2020 18:28:48 +0100 Subject: [PATCH 2/5] Add version map. --- tox.ini | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tox.ini b/tox.ini index cfba35de..613553eb 100644 --- a/tox.ini +++ b/tox.ini @@ -28,3 +28,11 @@ commands = setenv = PYTHONDONTWRITEBYTECODE=1 DJANGO_SETTINGS_MODULE=tests.settings + +[gh-actions] +python = + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 + pypy3: pypy3 From 2ab7caa7b085346c5e78299c1cd244dca5266be5 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 26 Nov 2020 18:31:16 +0100 Subject: [PATCH 3/5] Fix name. --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 613553eb..9d383216 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] envlist = - py{36,37,38,39,pypy3}-django{22}-unittest - py{36,37,38,39,pypy3}-django{30,31,-master}-unittest - py{36,37,38,39,pypy3}-django{22,30,31,-master}-pytest + py{36,37,38,39,py3}-django{22}-unittest + py{36,37,38,39,py3}-django{30,31,-master}-unittest + py{36,37,38,39,py3}-django{22,30,31,-master}-pytest [testenv] deps = From d298cbf11136c05f9ca8f9a9d8aa1b2956573e27 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 27 Nov 2020 09:44:21 +0100 Subject: [PATCH 4/5] Update .github/workflows/test.yml Co-authored-by: Hugo van Kemenade --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bb8ef4a0..bcd68172 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: - ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }} + ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }} restore-keys: | ${{ matrix.python-version }}-v1- From 7d93adb9e2706999b6e4fb88d722463e5d06311a Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 27 Nov 2020 09:45:07 +0100 Subject: [PATCH 5/5] Add release workflow. --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..9e6f7fea --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + build: + if: github.repository == 'jazzband/django-constance' + 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') }}-${{ hashFiles('**/tox.ini') }} + 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-constance/upload