File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,24 @@ jobs:
238238 # See the upload-artifact step in the build job for the explanation of this pattern
239239 name : khiops-conda
240240 path : ./khiops-conda
241+ - name : Check Conda package / Git tag version coherence
242+ run : |
243+ # Don't exit on first error: print relevant error message
244+ set +e
245+ # Extract Conda package version from the package artifact
246+ PACKAGE_VERSION=$( \
247+ unzip -p ./khiops-conda/noarch/*.conda info-*.tar.zst \
248+ | tar --zstd -axf - info/index.json -O \
249+ | jq -r ".version" \
250+ )
251+ # Convert pre-release version specification in the Git tag to the
252+ # Conda format and check that it matches the Conda package version
253+ echo ${{ github.ref_name }} | tr -d '-' | grep -wq $PACKAGE_VERSION
254+ if [[ $? -ne 0 ]]
255+ then
256+ echo "::error::Conda package version $PACKAGE_VERSION does not match Git tag ${{ github.ref_name }}"
257+ false
258+ fi
241259 - name : Install Miniforge
242260 uses : conda-incubator/setup-miniconda@v3
243261 with :
Original file line number Diff line number Diff line change 9090 name : pip-package
9191 - name : Install package
9292 run : |
93+ # Allow Pip to write to its cache
94+ mkdir -p /github/home/.cache/pip
95+ chown -R $(whoami) /github/home/.cache/pip
96+ # Install the Khiops Python library
9397 pip install --upgrade pip
9498 pip install $(ls khiops*.tar.gz)
9599 - name : Run tests
@@ -120,6 +124,22 @@ jobs:
120124 # The MPI command is not always named mpiexec, but can be orterun etc
121125 # (as given by khiops_env)
122126 kh-status | grep "MPI command" | grep -vwq "<empty>"
127+ - name : Test package / Git tag version coherence
128+ shell : bash
129+ if : github.ref_type == 'tag'
130+ run : |
131+ # Don't exit on first error: print relevant error message
132+ set +e
133+ # Convert pre-release version specification in the Git tag to the Pip
134+ # format and check that it matches the Pip package version
135+ PACKAGE_VERSION=$(pip show khiops | awk 'BEGIN {FS = ": "} $1 ~ /^Version$/ {print $2}')
136+ echo ${{ github.ref_name }} | tr -d '-' | rev | sed 's/\.//' | rev | \
137+ grep -wq $PACKAGE_VERSION
138+ if [[ $? -ne 0 ]]
139+ then
140+ echo "::error::Python package version $PACKAGE_VERSION does not match Git tag ${{ github.ref_name }}"
141+ false
142+ fi
123143 # The implementation of a unique release job with multiple conditional steps
124144 # for each publishing mode is not chosen
125145 # because of the required job environment verified for Trusted Publishing
You can’t perform that action at this time.
0 commit comments