Skip to content

Commit

Permalink
manage latest python version more elegantly
Browse files Browse the repository at this point in the history
  • Loading branch information
aperrin66 committed Dec 12, 2023
1 parent 8747677 commit 28a2f07
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ jobs:
runs-on: 'ubuntu-latest'
strategy:
matrix:
version:
- {'python': '3.7', 'latest': false}
- {'python': '3.8', 'latest': false}
- {'python': '3.9', 'latest': false}
- {'python': '3.10', 'latest': false}
- {'python': '3.11', 'latest': true}
python_version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
env:
BASE_IMAGE: "${{ vars.DOCKER_ORG }}/nansat:0.0.10-python${{ matrix.version.python }}"
BASE_IMAGE: "${{ vars.DOCKER_ORG }}/nansat:0.0.10-python${{ matrix.python_version }}"
IMAGE_NAME: "${{ vars.DOCKER_ORG }}/geospaas"
latest: ${{ matrix.python_version == '3.11' && 'true' || '' }}
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
Expand Down Expand Up @@ -72,13 +73,13 @@ jobs:
bash -c "coverage run --omit=geospaas/nansat_ingestor/tests/*,geospaas/catalog/tests/*,geospaas/vocabularies/tests/* runtests.py"
- name: 'Install Python 3.11'
if: ${{ matrix.version.latest }}
if: ${{ env.latest }}
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: 'Upload coverage to coveralls.io'
if: ${{ matrix.version.latest }}
if: ${{ env.latest }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pip install coveralls && coveralls --service=github
Expand All @@ -92,10 +93,10 @@ jobs:
DJANGO_GEO_SPAAS_RELEASE=${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}
push: ${{ github.ref_type == 'tag' }}
tags: |
${{ env.IMAGE_NAME }}:${{ github.ref_name }}-python${{ matrix.version.python }}
${{ matrix.version.latest && format('{0}:{1}', env.IMAGE_NAME, github.ref_name) || '' }}
${{ env.IMAGE_NAME }}:latest-python${{ matrix.version.python }}
${{ matrix.version.latest && format('{0}:latest', env.IMAGE_NAME) || '' }}
${{ env.IMAGE_NAME }}:${{ github.ref_name }}-python${{ matrix.python_version }}
${{ env.latest && format('{0}:{1}', env.IMAGE_NAME, github.ref_name) || '' }}
${{ env.IMAGE_NAME }}:latest-python${{ matrix.python_version }}
${{ env.latest && format('{0}:latest', env.IMAGE_NAME) || '' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

Expand Down

0 comments on commit 28a2f07

Please sign in to comment.