Repository: jazzband/django-simple-menu (language: python)

Issue:
Optimize GitHub Actions
Our actions currently spawn for every combination of Python and Django. Some of these run empty, since we don't have the tox envs for them. Instead, I would just leave the Python versions in the matrix and do the testing with tox. This way, we will spawn way less runners, which will result in our CI running faster.

Another idea: Upload coverage once, in a different step. Would also quicken our CI runs.

Example: https://github.com/jazzband/django-debug-toolbar/blob/0379d4a1ea6b22bfc79096c02d4a1d78896be1c0/.github/workflows/test.yml
Optimize GitHub Actions by removing Django from GitHub Actions matrix
Closes #116


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4647c9d..a933aad 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,12 +11,12 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
         with:
           fetch-depth: 0
 
       - name: Set up Python
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: 3.8
 
diff --git a/tox.ini b/tox.ini
index e0ba83d..c5523f9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -26,9 +26,9 @@ DJANGO =
 usedevelop = true
 deps =
     coverage
-    dj32: Django>=3.2,<3.3
-    dj40: Django>=4.0,<4.1
-    dj41: Django>=4.1,<4.2
+    dj32: Django~=3.2.16
+    dj40: Django~=4.0.8
+    dj41: Django~=4.1.2
     djmain: https://github.com/django/django/tarball/main
 setenv =
     DJANGO_SETTINGS_MODULE=simple_menu.test_settings


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 78f11ff..1041957 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -11,26 +11,46 @@ jobs:
       matrix:
         python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
         django-version: ['3.2', '4.0', '4.1', 'main']
+        exclude:
+          - django-version: '3.2'
+            python-version: '3.11'
+
+          - django-version: '4.0'
+            python-version: '3.6'
+          - django-version: '4.0'
+            python-version: '3.7'
+          - django-version: '4.0'
+            python-version: '3.11'
+
+          - django-version: '4.1'
+            python-version: '3.6'
+          - django-version: '4.1'
+            python-version: '3.7'
+
+          - django-version: 'main'
+            python-version: '3.6'
+          - django-version: 'main'
+            python-version: '3.7'
 
     steps:
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
 
     - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
 
     - name: Get pip cache dir
       id: pip-cache
       run: |
-        echo "::set-output name=dir::$(pip cache dir)"
+        echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
 
     - name: Cache
-      uses: actions/cache@v2
+      uses: actions/cache@v3
       with:
         path: ${{ steps.pip-cache.outputs.dir }}
         key:
-          ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }}
+          ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }}
         restore-keys: |
           ${{ matrix.python-version }}-v1-
 
@@ -46,6 +66,6 @@ jobs:
         DJANGO: ${{ matrix.django-version }}
 
     - name: Upload coverage
-      uses: codecov/codecov-action@v1
+      uses: codecov/codecov-action@v3
       with:
         name: Python ${{ matrix.python-version }}