Skip to content

Commit b36add3

Browse files
committed
Streamline the environment matrix for Pip package tests
Keep: - Ubuntu 24.04: with / without virtualenv - Debian 13: with virtualenv - MacOS 15 (ARM): with virtualenv - Rocky Linux 10: with / without virtualenv - Windows (2025): with / without virtualenv.
1 parent 1eda5dc commit b36add3

1 file changed

Lines changed: 17 additions & 28 deletions

File tree

.github/workflows/pip.yml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,14 @@ jobs:
6060
fail-fast: false
6161
matrix:
6262
env:
63-
- {os: ubuntu-22.04, json-image: '{"image": "ubuntu:20.04"}'}
64-
- {os: ubuntu-22.04, json-image: '{"image": null}'}
65-
- {os: ubuntu-24.04, json-image: '{"image": null}'}
66-
- {os: ubuntu-22.04, json-image: '{"image": "debian:trixie"}'}
67-
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux/rockylinux:8"}'}
68-
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux/rockylinux:9"}'}
69-
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux/rockylinux:10"}'}
70-
- {os: windows-2022, json-image: '{"image": null}'}
71-
- {os: windows-2025, json-image: '{"image": null}'}
72-
- {os: macos-14, json-image: '{"image": null}'}
73-
- {os: macos-15, json-image: '{"image": null}'}
74-
- {os: macos-15-intel, json-image: '{"image": null}'}
75-
use-virtualenv: [true, false]
63+
- {os: ubuntu-24.04, json-image: '{"image": null}', use-virtualenv: true}
64+
- {os: ubuntu-24.04, json-image: '{"image": null}', use-virtualenv: false}
65+
- {os: ubuntu-22.04, json-image: '{"image": "debian:trixie"}', use-virtualenv: true}
66+
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux/rockylinux:10"}', use-virtualenv: true}
67+
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux/rockylinux:10"}', use-virtualenv: false}
68+
- {os: windows-2025, json-image: '{"image": null}', use-virtualenv: true}
69+
- {os: windows-2025, json-image: '{"image": null}', use-virtualenv: false}
70+
- {os: macos-15, json-image: '{"image": null}', use-virtualenv: true}
7671
runs-on: ${{ matrix.env.os }}
7772
container: ${{ fromJSON(matrix.env.json-image) }}
7873
steps:
@@ -101,12 +96,6 @@ jobs:
10196
VENV_ACTIVATE="khiops-venv/bin/activate"
10297
fi
10398
echo "VENV_ACTIVATE=$VENV_ACTIVATE" >> "$GITHUB_ENV"
104-
# Centralise the venv condition
105-
if [[ "${{ fromJSON(matrix.env.json-image).image }}" == "debian:trixie" || "${{ matrix.use-virtualenv }}" == "true" ]]; then
106-
echo "USE_VENV=true" >> "$GITHUB_ENV"
107-
else
108-
echo "USE_VENV=false" >> "$GITHUB_ENV"
109-
fi
11099
# Setup Python (be portable wrt. python vs python3 in runners and
111100
# containers; either python3 or python is present as per the Python
112101
# installation step in the Docker container contexts)
@@ -140,8 +129,8 @@ jobs:
140129
141130
# Install the Khiops Python library
142131
143-
# Use a virtualenv if running on Debian 13 (mandatory) or if required
144-
if [[ "$USE_VENV" == "true" ]]; then
132+
# Use a virtualenv if required
133+
if [[ "${{ matrix.env.use-virtualenv }}" == "true" ]]; then
145134
$PYTHON -m venv khiops-venv
146135
source "$VENV_ACTIVATE"
147136
fi
@@ -162,7 +151,7 @@ jobs:
162151
rm -f requires-khiops.txt requires-no-khiops.txt
163152
# Lastly, install khiops-python
164153
$PYTHON -m pip install khiops*.tar.gz
165-
if [[ "$USE_VENV" == "true" ]]; then
154+
if [[ "${{ matrix.env.use-virtualenv }}" == "true" ]]; then
166155
deactivate
167156
fi
168157
- name: Run tests
@@ -182,8 +171,8 @@ jobs:
182171
# modules are currently not initializing the shell anyway
183172
if [ -n "$MODULESHOME" ]; then module unload mpi; fi
184173
185-
# Use a virtualenv if running on Debian 13 (mandatory) or if required
186-
if [[ "$USE_VENV" == "true" ]]; then
174+
# Use a virtualenv if required
175+
if [[ "${{ matrix.env.use-virtualenv }}" == "true" ]]; then
187176
source "$VENV_ACTIVATE"
188177
fi
189178
if [[ -n "${{ fromJSON(matrix.env.json-image).image }}" ]]; then
@@ -206,7 +195,7 @@ jobs:
206195
# The MPI command is not always named mpiexec, but can be orterun etc
207196
# (as given by khiops_env)
208197
kh-status | grep "MPI command" | grep -vwq "<empty>"
209-
if [[ "$USE_VENV" == "true" ]]; then
198+
if [[ "${{ matrix.env.use-virtualenv }}" == "true" ]]; then
210199
deactivate
211200
fi
212201
- name: Test package / Git tag version coherence
@@ -215,14 +204,14 @@ jobs:
215204
run: |
216205
# Don't exit on first error: print relevant error message
217206
set +e
218-
# Use a virtualenv if running on Debian 13 (mandatory) or if required
219-
if [[ "$USE_VENV" == "true" ]]; then
207+
# Use a virtualenv if required
208+
if [[ "${{ matrix.env.use-virtualenv }}" == "true" ]]; then
220209
source "$VENV_ACTIVATE"
221210
fi
222211
# Convert pre-release version specification in the Git tag to the Pip
223212
# format and check that it matches the Pip package version
224213
PACKAGE_VERSION=$($PYTHON -m pip show khiops | awk 'BEGIN {FS = ": "} $1 ~ /^Version$/ {print $2}')
225-
if [[ "$USE_VENV" == "true" ]]; then
214+
if [[ "${{ matrix.env.use-virtualenv }}" == "true" ]]; then
226215
deactivate
227216
fi
228217
echo "${{ github.ref_name }}" | tr -d '-' | rev | sed -E 's/\.([^0-9].*)/\1/' | rev | \

0 commit comments

Comments
 (0)