From 374ad736b764aa0cc763d9645d6c12284c86c03d Mon Sep 17 00:00:00 2001 From: chris48s Date: Thu, 21 Sep 2023 12:30:59 +0100 Subject: [PATCH 1/3] clean up build matrix with tox-gh-actions --- .../.github/workflows/test.yml | 41 ++++--------------- .../requirements-ci.txt | 2 + .../tox.ini | 12 ++++++ 3 files changed, 22 insertions(+), 33 deletions(-) create mode 100644 {{ cookiecutter.__project_name_kebab }}/requirements-ci.txt diff --git a/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml b/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml index dc3c668..83a1946 100644 --- a/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml +++ b/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml @@ -36,17 +36,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 @@ -54,15 +43,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 -r requirements-ci.txt - 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 @@ -70,18 +58,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: @@ -98,13 +74,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 -r requirements-ci.txt - 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 %} + DB: postgres diff --git a/{{ cookiecutter.__project_name_kebab }}/requirements-ci.txt b/{{ cookiecutter.__project_name_kebab }}/requirements-ci.txt new file mode 100644 index 0000000..3e9dcb8 --- /dev/null +++ b/{{ cookiecutter.__project_name_kebab }}/requirements-ci.txt @@ -0,0 +1,2 @@ +tox==4.11.3 +tox-gh-actions==3.1.3 diff --git a/{{ cookiecutter.__project_name_kebab }}/tox.ini b/{{ cookiecutter.__project_name_kebab }}/tox.ini index afa7224..8e9418d 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,main}-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} From 472a73cef7f02ba151d7ba8d837be9a1183021d3 Mon Sep 17 00:00:00 2001 From: chris48s Date: Thu, 21 Sep 2023 12:36:18 +0100 Subject: [PATCH 2/3] fixup --- .../.github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml b/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml index 83a1946..85c227c 100644 --- a/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml +++ b/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml @@ -81,5 +81,5 @@ jobs: - name: Test run: tox env: - DATABASE_URL: postgres://postgres:postgres@localhost:5432/{% endraw %}{{ cookiecutter.__project_name_snake }}{% raw %} + DATABASE_URL: postgres://postgres:postgres@localhost:5432/{% endraw %}{{ cookiecutter.__project_name_snake }} DB: postgres From e3b9175b7d922f11f4100181ffb2b7bfc6190b68 Mon Sep 17 00:00:00 2001 From: chris48s Date: Sat, 23 Sep 2023 21:12:17 +0100 Subject: [PATCH 3/3] make ci requirements and extras group --- .../.github/workflows/test.yml | 4 ++-- {{ cookiecutter.__project_name_kebab }}/pyproject.toml | 4 ++++ {{ cookiecutter.__project_name_kebab }}/requirements-ci.txt | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 {{ cookiecutter.__project_name_kebab }}/requirements-ci.txt diff --git a/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml b/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml index 85c227c..810b5ce 100644 --- a/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml +++ b/{{ cookiecutter.__project_name_kebab }}/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: - name: Install run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install -r requirements-ci.txt + python -m pip install .[ci] - name: Test run: tox env: @@ -77,7 +77,7 @@ jobs: - name: Install run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install -r requirements-ci.txt + python -m pip install .[ci] - name: Test run: tox env: 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 }}/requirements-ci.txt b/{{ cookiecutter.__project_name_kebab }}/requirements-ci.txt deleted file mode 100644 index 3e9dcb8..0000000 --- a/{{ cookiecutter.__project_name_kebab }}/requirements-ci.txt +++ /dev/null @@ -1,2 +0,0 @@ -tox==4.11.3 -tox-gh-actions==3.1.3