From 37112cda71dc40e1c237cb565ed4facdd1ed8ef2 Mon Sep 17 00:00:00 2001 From: Josep Cugat Date: Thu, 17 Feb 2022 18:32:38 +0100 Subject: [PATCH 1/3] Faster github actions --- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0190c0d..7ec51ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,20 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] - + python-version: ["3.8", "3.9", "3.10"] + django-version: ["django32", "django40", "djangomaster"] + database-version: ["mysql", "postgres", "sqlite"] + # This is needed because Python 3.7 is only supported by Django 3.2 + include: + - python-version: "3.7" + django-version: "django32" + database-version: "mysql" + - python-version: "3.7" + django-version: "django32" + database-version: "postgres" + - python-version: "3.7" + django-version: "django32" + database-version: "sqlite" services: mysql: image: mysql @@ -50,14 +62,28 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | python -m pip install --upgrade pip poetry setuptools wheel poetry install -v + + - name: Compute tox environment name + id: tox-environment-name + shell: python + run: | + import sys + python_version = "py{}{}".format(*sys.version_info[:2]) + django_version = {{ '"${{ matrix.django-version }}"' }} + database_version = {{ '"${{ matrix.database-version }}"' }} + result = "{}-{}-{}".format(python_version, django_version, database_version) + print("::set-output name=result::{}".format(result)) + - name: Run tox targets for ${{ matrix.python-version }} run: | - poetry run tox + poetry run tox -e ${{ steps.tox-environment-name.outputs.result }} From c1e39fd5be5cca63b16e67d5290ce74f9d8e9ae9 Mon Sep 17 00:00:00 2001 From: Josep Cugat Date: Thu, 17 Feb 2022 18:38:50 +0100 Subject: [PATCH 2/3] Fix yaml syntax --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ec51ad..bce07be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,8 +79,8 @@ jobs: run: | import sys python_version = "py{}{}".format(*sys.version_info[:2]) - django_version = {{ '"${{ matrix.django-version }}"' }} - database_version = {{ '"${{ matrix.database-version }}"' }} + django_version = "${{ matrix.django-version }}" + database_version = "${{ matrix.database-version }}" result = "{}-{}-{}".format(python_version, django_version, database_version) print("::set-output name=result::{}".format(result)) From 3dd333820f1829d6f387060b3c25b4680b3ac309 Mon Sep 17 00:00:00 2001 From: Josep Cugat Date: Thu, 17 Feb 2022 18:40:10 +0100 Subject: [PATCH 3/3] Better tox command in github actions --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bce07be..22884d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,6 +84,6 @@ jobs: result = "{}-{}-{}".format(python_version, django_version, database_version) print("::set-output name=result::{}".format(result)) - - name: Run tox targets for ${{ matrix.python-version }} + - name: Run tox for ${{ steps.tox-environment-name.outputs.result }} run: | - poetry run tox -e ${{ steps.tox-environment-name.outputs.result }} + poetry run tox -e '${{ steps.tox-environment-name.outputs.result }}'