Skip to content

Commit

Permalink
Merge pull request #226 from KhiopsML/191-test-khiopspydev-docker-ima…
Browse files Browse the repository at this point in the history
…ges-before-pushing-them-to-the-registry

191 test khiopspydev docker images before pushing them to the registry
  • Loading branch information
popescu-v authored Aug 23, 2024
2 parents 427c1d8 + 36cee90 commit 81a7415
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 25 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
required: true
type: boolean
default: false
image-tag:
default: latest
description: Development Docker Image Tag
pull_request:
paths:
- doc/**.rst
Expand All @@ -32,7 +35,11 @@ jobs:
build:
runs-on: ubuntu-22.04
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:latest
# 'latest' default image tag cannot be set as an environment variable,
# because the `env` context is only accessible at the step level;
# hence, it is hard-coded
image: |-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || 'latest' }}
# 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
35 changes: 17 additions & 18 deletions .github/workflows/dev-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: Dev Docker
env:
DEFAULT_KHIOPS_REVISION: 10.2.2
DEFAULT_IMAGE_INCREMENT: 0
DEFAULT_SERVER_REVISION: main
DEFAULT_PYTHON_VERSIONS: 3.8 3.9 3.10 3.11 3.12
on:
Expand All @@ -13,13 +14,16 @@ on:
type: string
default: main
description: Khiops Revision
image-increment:
type: string
description: Docker Image Tag Increment
server-revision:
type: string
default: main
description: Khiops Server Revision
push:
type: boolean
default: true
default: false
description: Push to GH Registry
python-versions:
type: string
Expand All @@ -43,8 +47,10 @@ jobs:
run: |
set -x
echo "KHIOPS_REVISION=${{ inputs.khiops-revision || env.DEFAULT_KHIOPS_REVISION }}" >> "$GITHUB_ENV"
echo "IMAGE_INCREMENT=${{ inputs.image-increment || env.DEFAULT_IMAGE_INCREMENT }}" >> "$GITHUB_ENV"
echo "KHIOPSDEV_OS_CODENAME=$(echo '${{ matrix.khiopsdev-os }}' | tr -d '0-9.')" >> "$GITHUB_ENV"
echo "SERVER_REVISION=${{ inputs.server-revision || env.DEFAULT_SERVER_REVISION }}" >> "$GITHUB_ENV"
echo "IMAGE_URL=ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.khiopsdev-os }}" >> "$GITHUB_ENV"
- name: Checkout khiops-python sources
uses: actions/checkout@v4
- name: Set up Docker Buildx
Expand All @@ -56,6 +62,15 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up the Docker Image Tags
run: |
set -x
if [[ $GITHUB_REF == '/refs/heads/main' || $GITHUB_REF == '/refs/heads/dev' ]]; then
TAGS="$IMAGE_URL:latest,$IMAGE_URL:$KHIOPS_REVISION.$IMAGE_INCREMENT"
else
TAGS="$IMAGE_URL:$KHIOPS_REVISION.$IMAGE_INCREMENT"
fi
echo "DOCKER_IMAGE_TAGS=$TAGS" >> "$GITHUB_ENV"
- name: Build image and push it to GitHub Container Registry
uses: docker/build-push-action@v5
with:
Expand All @@ -66,24 +81,8 @@ jobs:
"KHIOPSDEV_OS=${{ matrix.khiopsdev-os }}"
"SERVER_REVISION=${{ env.SERVER_REVISION }}"
"PYTHON_VERSIONS=${{ inputs.python-versions || env.DEFAULT_PYTHON_VERSIONS }}"
tags: ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.khiopsdev-os }}:latest
tags: ${{ env.DOCKER_IMAGE_TAGS }}
# Push only on manual request
push: ${{ inputs.push || false }}
- name: Display the image digest
run: echo ${{ steps.docker-build.outputs.digest }}
test:
# Test only when manually pushed an requested
if: ${{ inputs.push || false }}
needs: build-push
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
khiopsdev-os: [ubuntu22.04, rocky8, rocky9]
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.khiopsdev-os }}:latest
steps:
- name: Check Khiops executables
run: |-
khiops -v
khiops_coclustering -v
9 changes: 8 additions & 1 deletion .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
samples-revision:
default: main
description: khiops-samples repo revision
image-tag:
default: latest
description: Development Docker Image Tag
pull_request:
push:
tags: ['*']
Expand Down Expand Up @@ -49,7 +52,11 @@ jobs:
matrix:
container: [ubuntu22.04, rocky9]
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:latest
# 'latest' default image tag cannot be set as an environment variable,
# because the `env` context is only accessible at the step level;
# hence, it is hard-coded
image: |-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || 'latest' }}
steps:
- name: Set parameters as env
run: |
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
samples-revision:
default: main
description: Git tag, branch or commit for the khiops-samples repository
image-tag:
default: latest
description: Development Docker Image Tag
run-long-tests:
type: boolean
required: false
Expand All @@ -25,7 +28,11 @@ jobs:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:latest
# 'latest' default image tag cannot be set as an environment variable,
# because the `env` context is only accessible at the step level;
# hence, it is hard-coded
image: |-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || 'latest' }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -147,7 +154,11 @@ jobs:
container: [ubuntu22.04, rocky8, rocky9]
runs-on: ubuntu-latest
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:latest
# 'latest' default image tag cannot be set as an environment variable,
# because the `env` context is only accessible at the step level;
# hence, it is hard-coded
image: |-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || 'latest' }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ repos:
hooks:
- id: yamlfix
exclude: packaging/conda/meta.yaml
language: python
additional_dependencies: [maison<2.0.0]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion doc/samples/samples_sklearn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ Samples
print(f"Features evaluated: {khe.n_features_evaluated_}")
print("Top 3 evaluated features")
for i, feature in enumerate(khe.feature_evaluated_names_[:3]):
print(f"{feature} - Level: {khe.feature_evaluated_importances_[i][0]}")
print(f"{feature} - Level: {khe.feature_evaluated_importances_[i]}")
print("---")
# Transform the train dataset
Expand Down
2 changes: 1 addition & 1 deletion khiops/samples/samples_sklearn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
"print(f\"Features evaluated: {khe.n_features_evaluated_}\")\n",
"print(\"Top 3 evaluated features\")\n",
"for i, feature in enumerate(khe.feature_evaluated_names_[:3]):\n",
" print(f\"{feature} - Level: {khe.feature_evaluated_importances_[i][0]}\")\n",
" print(f\"{feature} - Level: {khe.feature_evaluated_importances_[i]}\")\n",
"print(\"---\")\n",
"\n",
"# Transform the train dataset\n",
Expand Down
2 changes: 1 addition & 1 deletion khiops/samples/samples_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def khiops_encoder_multitable_snowflake():
print(f"Features evaluated: {khe.n_features_evaluated_}")
print("Top 3 evaluated features")
for i, feature in enumerate(khe.feature_evaluated_names_[:3]):
print(f"{feature} - Level: {khe.feature_evaluated_importances_[i][0]}")
print(f"{feature} - Level: {khe.feature_evaluated_importances_[i]}")
print("---")

# Transform the train dataset
Expand Down

0 comments on commit 81a7415

Please sign in to comment.