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 3e12fa9 commit 35781f6
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,19 +11,20 @@ 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 }}/geospaas:0.0.4-python${{ matrix.version.python }}"
BASE_IMAGE: "${{ vars.DOCKER_ORG }}/geospaas:0.0.4-python${{ matrix.python_version }}"
IMAGE_NAME: "${{ vars.DOCKER_ORG }}/geospaas_harvesting"
METANORM_VERSION: '4.1.0'
GEOSPAAS_DB_HOST: 'db'
GEOSPAAS_DB_USER: 'test'
GEOSPAAS_DB_PASSWORD: "${{ secrets.GEOSPAAS_DB_PASSWORD }}"
latest: ${{ matrix.python_version == '3.11' && 'true' || '' }}
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
Expand Down Expand Up @@ -90,13 +91,13 @@ jobs:
run: docker stop "${{ env.GEOSPAAS_DB_HOST }}"

- 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 @@ -111,10 +112,10 @@ jobs:
GEOSPAAS_HARVESTING_RELEASE=${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}
push: ${{ github.event_name == 'release' }}
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 35781f6

Please sign in to comment.