From 31a63d54564a892e7c0d43e516870093ac97fa2f Mon Sep 17 00:00:00 2001 From: chris48s Date: Fri, 13 Oct 2023 08:23:39 +0100 Subject: [PATCH] clean up build matrix with tox-gh-actions (#59) --- .../.github/workflows/test.yml | 43 ++++--------------- .../pyproject.toml | 4 ++ .../tox.ini | 12 ++++++ 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml b/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml index 5b982a6..6c2cce4 100644 --- a/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml +++ b/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml @@ -34,17 +34,6 @@ jobs: strategy: matrix: python: ['3.8', '3.9', '3.10', '3.11'] - django: ['3.2', '4.0', '4.1', '4.2'] - wagtail: ['4.1', '4.2', '5.0', '5.1'] - exclude: - - django: '4.0' - wagtail: '5.0' - - django: '4.0' - wagtail: '5.1' - - django: '4.2' - wagtail: '4.1' - - django: '4.2' - wagtail: '4.2' steps: - uses: actions/checkout@v3 @@ -52,15 +41,14 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - - name: Install Tox + - name: Install run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox + python -m pip install .[ci] - name: Test - run: | - tox + run: tox env: - TOXENV: python${{ matrix.python }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}-sqlite + DB: sqlite test-postgres: runs-on: ubuntu-latest @@ -68,18 +56,6 @@ jobs: strategy: matrix: python: ['3.8', '3.9', '3.10', '3.11'] - django: ['3.2', '4.0', '4.1', '4.2'] - wagtail: ['4.1', '4.2', '5.0', '5.1'] - experimental: [false] - exclude: - - django: '4.0' - wagtail: '5.0' - - django: '4.0' - wagtail: '5.1' - - django: '4.2' - wagtail: '4.1' - - django: '4.2' - wagtail: '4.2' services: postgres: @@ -96,13 +72,12 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - - name: Install Tox + - name: Install run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox + python -m pip install .[ci] - name: Test - run: | - tox + run: tox env: - DATABASE_URL: postgres://postgres:postgres@localhost:5432/{% endraw %}{{ cookiecutter.__project_name_snake }}{% raw %} - TOXENV: python${{ matrix.python }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}-postgres{% endraw %} + DATABASE_URL: postgres://postgres:postgres@localhost:5432/{% endraw %}{{ cookiecutter.__project_name_snake }} + DB: postgres diff --git a/{{ cookiecutter.__project_name_kebab }}/pyproject.toml b/{{ cookiecutter.__project_name_kebab }}/pyproject.toml index b03aa67..7e317c6 100644 --- a/{{ cookiecutter.__project_name_kebab }}/pyproject.toml +++ b/{{ cookiecutter.__project_name_kebab }}/pyproject.toml @@ -54,6 +54,10 @@ testing = [ "dj-database-url==2.1.0", "pre-commit==3.4.0" ] +ci = [ + "tox==4.11.3", + "tox-gh-actions==3.1.3" +] [project.urls] Home = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.__project_name_kebab }}" diff --git a/{{ cookiecutter.__project_name_kebab }}/tox.ini b/{{ cookiecutter.__project_name_kebab }}/tox.ini index 87d56ec..4d8b095 100644 --- a/{{ cookiecutter.__project_name_kebab }}/tox.ini +++ b/{{ cookiecutter.__project_name_kebab }}/tox.ini @@ -6,6 +6,18 @@ envlist = python{3.8,3.9,3.10,3.11}-django{3.2,4.0,4.1}-wagtail{4.1,4.2}-{sqlite,postgres} python{3.8,3.9,3.10,3.11}-django{3.2,4.1,4.2}-wagtail{5.0,5.1,main}-{sqlite,postgres} +[gh-actions] +python = + 3.8: python3.8 + 3.9: python3.9 + 3.10: python3.10 + 3.11: python3.11 + +[gh-actions:env] +DB = + sqlite: sqlite + postgres: postgres + [testenv] install_command = pip install -e ".[testing]" -U {opts} {packages} commands = coverage run testmanage.py test --deprecation all {posargs: -v 2}