Skip to content

Commit

Permalink
Optimize GitHub Actions (#118)
Browse files Browse the repository at this point in the history
This optimizes and speeds up tests a bit by doing the following:

 - upgrades Actions' versions

 - sets cache dir name from setup.cfg instead of setup.py

 - excludes configurations where no tests are run (for example, py36-dj40)

Closes #116
  • Loading branch information
kytta authored Dec 7, 2022
2 parents 493cb0c + 61bc298 commit 955b872
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 26 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-
Expand All @@ -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 }}
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 955b872

Please sign in to comment.