From ffce93eb5d5043f43381b0a7d3046a34f2185068 Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Tue, 13 Feb 2024 13:20:18 +0000 Subject: [PATCH 1/7] Move build strategy to top of CI config --- .github/workflows/tests.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 52a0e5e..f32bf7b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -11,6 +11,10 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: 5 + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + services: postgres: image: postgres @@ -24,10 +28,6 @@ jobs: ports: - 5432:5432 - strategy: - matrix: - python-version: ["3.10", "3.11", "3.12"] - steps: - name: Clone the code uses: actions/checkout@v4 From 9724a14f52088f41eb6ebfc5a77cec273f70d64d Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Tue, 13 Feb 2024 13:24:36 +0000 Subject: [PATCH 2/7] Run CI against multiple versions of Postgres --- .github/workflows/tests.yaml | 8 +++++++- README.md | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f32bf7b..5186416 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,10 +14,16 @@ jobs: strategy: matrix: python-version: ["3.10", "3.11", "3.12"] + postgres-image: + - "postgres:12" + - "postgres:13" + - "postgres:14" + - "postgres:15" + - "postgres:16" services: postgres: - image: postgres + image: ${{ matrix.postgres-image }} env: POSTGRES_PASSWORD: postgres options: >- diff --git a/README.md b/README.md index 7210e83..2437037 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ This package is tested against: - Python 3.10, 3.11, or 3.12. - Django 4.1, 4.2, or 5.0. +- PostgreSQL 12 to 16 ## Local development From e17ce58ed8a7a6b9b46aa692b6fb99c5e2c7dcce Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Tue, 13 Feb 2024 13:33:57 +0000 Subject: [PATCH 3/7] Run tox tests in parallel --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5186416..3bd33f3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -47,6 +47,6 @@ jobs: run: make install - name: Run the tests - run: tox + run: tox --parallel --parallel-no-spinner env: DATABASE_URL: postgres://postgres:postgres@localhost/django_integrity From 726fe6adee9196e75f731c0119d63ed40d60d71a Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Tue, 13 Feb 2024 13:35:49 +0000 Subject: [PATCH 4/7] Add cache for pip dependencies --- .github/workflows/tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3bd33f3..c983e3b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,6 +42,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install requirements run: make install From 9258dbf2c059af4dec33d8b93f605f9116a367fc Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Tue, 13 Feb 2024 13:37:57 +0000 Subject: [PATCH 5/7] Install multiple versions of Python at once in CI --- .github/workflows/tests.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c983e3b..c94e31a 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -13,7 +13,6 @@ jobs: strategy: matrix: - python-version: ["3.10", "3.11", "3.12"] postgres-image: - "postgres:12" - "postgres:13" @@ -38,10 +37,13 @@ jobs: - name: Clone the code uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python versions uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: | + 3.12 + 3.11 + 3.10 cache: 'pip' - name: Install requirements From 2f5a097138c9d0ad111fb385d410f2c2bedf5f45 Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Tue, 13 Feb 2024 13:45:11 +0000 Subject: [PATCH 6/7] Fail in CI when Python version not found --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c94e31a..46d9573 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -50,6 +50,6 @@ jobs: run: make install - name: Run the tests - run: tox --parallel --parallel-no-spinner + run: tox --parallel --parallel-no-spinner --skip-missing-interpreters=false env: DATABASE_URL: postgres://postgres:postgres@localhost/django_integrity From 125ec15c04f4cef8288c10935cc1a4c8a41c29c7 Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Tue, 13 Feb 2024 18:14:03 +0000 Subject: [PATCH 7/7] Don't install unused requirements in CI Before this change, we installed all the requirements used to run the tests, when we only needed tox. Tox would then install those same requirements in each of the virtual environments it created. This change installs only tox in CI, trusting that it's the only package required to run the tests. --- .github/workflows/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 46d9573..d6faefc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -46,8 +46,8 @@ jobs: 3.10 cache: 'pip' - - name: Install requirements - run: make install + - name: Install tox + run: pip install tox - name: Run the tests run: tox --parallel --parallel-no-spinner --skip-missing-interpreters=false