Skip to content

Commit

Permalink
Use 'latest' dev Docker image by default, but make it customizable
Browse files Browse the repository at this point in the history
To this end, add separate development Docker image tag output.
Indeed, `env` is not accessible in the `image` context, because it's not
in a step (see
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/contexts#env-context).
  • Loading branch information
popescu-v committed Aug 7, 2024
1 parent c7c6820 commit d82e70e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
name: API Docs
env:
DEFAULT_IMAGE_REVISION: latest
on:
workflow_dispatch:
inputs:
Expand All @@ -8,6 +10,9 @@ on:
required: true
type: boolean
default: false
image-revision:
default: latest
description: Development Docker image revision
pull_request:
paths:
- doc/**.rst
Expand All @@ -29,10 +34,20 @@ concurrency:
group: pages
cancel-in-progress: false
jobs:
set-image-tag:
runs-on: ubuntu-22.04
outputs:
image-tag: ${{ inputs.image-revision || env.DEFAULT_IMAGE_REVISION }}
steps:
- name: Set Docker image tag
run: |
echo "Setting development Docker image tag"
build:
needs: set-image-tag
runs-on: ubuntu-22.04
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:latest
image: |-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ needs.set-image-tag.outputs.image-tag }}
# Use the 'runner' user (1001) from github so checkout actions work properly
# https://github.com/actions/runner/issues/2033#issuecomment-1598547465
options: --user 1001
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
name: Pip Package
env:
DEFAULT_SAMPLES_REVISION: main
DEFAULT_IMAGE_REVISION: latest
on:
workflow_dispatch:
inputs:
samples-revision:
default: main
description: khiops-samples repo revision
image-revision:
default: latest
description: Development Docker image revision
pull_request:
push:
tags: ['*']
Expand All @@ -17,6 +21,8 @@ concurrency:
jobs:
build:
runs-on: ubuntu-22.04
outputs:
image-tag: ${{ inputs.image-revision || env.DEFAULT_IMAGE_REVISION }}
permissions:
checks: write
contents: read
Expand Down Expand Up @@ -49,7 +55,8 @@ jobs:
matrix:
container: [ubuntu22.04, rocky9]
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:latest
image: |-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ needs.build.outputs.image-tag }}
steps:
- name: Set parameters as env
run: |
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
name: Unit Tests
env:
DEFAULT_SAMPLES_REVISION: main
DEFAULT_IMAGE_REVISION: latest
on:
workflow_dispatch:
inputs:
samples-revision:
default: main
description: Git tag, branch or commit for the khiops-samples repository
image-revision:
default: latest
description: Development Docker image revision
run-long-tests:
type: boolean
required: false
Expand All @@ -18,14 +22,24 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
set-image-tag:
runs-on: ubuntu-22.04
outputs:
image-tag: ${{ inputs.image-revision || env.DEFAULT_IMAGE_REVISION }}
steps:
- name: Set Docker image tag
run: |
echo "Setting development Docker image tag"
run:
needs: set-image-tag
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:latest
image: |-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ needs.set-image-tag.outputs.image-tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -141,13 +155,15 @@ jobs:
tests/resources/general_options/general_options/*/*._kh
retention-days: 7
check-mpiexec-on-linux:
needs: set-image-tag
strategy:
fail-fast: false
matrix:
container: [ubuntu22.04, rocky8, rocky9]
runs-on: ubuntu-latest
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:latest
image: |-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ needs.set-image-tag.outputs.image-tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit d82e70e

Please sign in to comment.