171 implement multi table helper functions (second round) #427
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Unit Tests | |
env: | |
DEFAULT_SAMPLES_REVISION: main | |
on: | |
workflow_dispatch: | |
inputs: | |
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 | |
default: false | |
description: Execute long tests | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
container: | |
# '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 }} | |
permissions: | |
id-token: write | |
contents: read | |
checks: write | |
packages: read | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
# Get Git tags so that versioneer can function correctly | |
# See issue https://github.com/actions/checkout/issues/701 | |
fetch-depth: 0 | |
# We move SAMPLES_REVISION to the environment so that we can use | |
# them in both push and workflow_dispatch events | |
- name: Move SAMPLES_REVISION to the environment (push event) | |
if: github.event_name == 'push' | |
run: echo "SAMPLES_REVISION=${DEFAULT_SAMPLES_REVISION}" >> "$GITHUB_ENV" | |
- name: Move SAMPLES_REVISION to the environment (workflow_dispatch event) | |
if: github.event_name == 'workflow_dispatch' | |
run: echo "SAMPLES_REVISION=${{ inputs.samples-revision }}" >> "$GITHUB_ENV" | |
- name: Checkout Khiops samples | |
uses: actions/checkout@v4 | |
with: | |
repository: khiopsml/khiops-samples | |
ref: ${{ env.SAMPLES_REVISION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: khiops-samples | |
- name: Setup and Install Test Requirements | |
if: success() || failure() | |
run: | | |
mkdir -p -m u+rwx reports/py${{ matrix.python-version }} | |
mkdir -p -m u+rwx reports/py${{ matrix.python-version }}_conda | |
# install within the conda environments without activating them | |
# Native Khiops-based Conda environment | |
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }} -c conda-forge unittest-xml-reporting | |
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }} --file test-requirements.txt | |
# `khiops-core`-based Conda environment | |
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }}_conda -c conda-forge unittest-xml-reporting | |
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }}_conda --file test-requirements.txt | |
- name: Install khiops-python dependencies | |
if: success() || failure() | |
run: | | |
# The following git command is required, | |
# as the Git repository is in a directory the current user does not own, | |
# Python versioneer fails to compute the current version correctly otherwise | |
git config --global --add safe.directory $(realpath .) | |
# Native Khiops-based Conda environment | |
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }} python setup.py egg_info | |
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }} `grep -v "^\[" khiops.egg-info/requires.txt` | |
# `khiops-core`-based Conda environment | |
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }}_conda python setup.py egg_info | |
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }}_conda `grep -v "^\[" khiops.egg-info/requires.txt` | |
rm -rf khiops.egg-info | |
- name: Prepare Unit Tests Environment | |
if: github.ref != 'dev' && github.ref != 'main' && ! inputs.run-long-tests | |
run: echo "UNITTEST_ONLY_SHORT_TESTS=true" >> "$GITHUB_ENV" | |
- name: Run Unit Tests | |
env: | |
KHIOPS_SAMPLES_DIR: ${{ github.workspace }}/khiops-samples | |
KHIOPS_DOCKER_RUNNER_URL: https://localhost:11000 | |
KHIOPS_DOCKER_RUNNER_SHARED_DIR: /tmp/sandbox | |
KHIOPS_RUNNER_SERVICE_PATH: /scripts/run_service.sh | |
# Force > 2 CPU cores to launch mpiexec | |
KHIOPS_PROC_NUMBER: 4 | |
# Oversubscribe for MPI 4.x | |
rmaps_base_oversubscribe: true | |
# Oversubscribe for MPI > 4.x | |
OMPI_MCA_rmaps_base_oversubscribe: true | |
PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe | |
run: | | |
# Make sure '/bin' is before '/usr/bin' in PATH | |
PATH=$(echo "/bin:"$PATH | sed 's#:/bin##') | |
# This is needed so that the Git tag is parsed and the khiops-python | |
# version is retrieved | |
git config --global --add safe.directory $(realpath .) | |
# Native Khiops-based Conda environments | |
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }} coverage run -m xmlrunner -o "reports/py${{ matrix.python-version }}" -v | |
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }} coverage report -m | |
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }} coverage xml -o "reports/py${{ matrix.python-version }}/py-coverage.xml" | |
# `khiops-core`-based Conda environments | |
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }}_conda coverage run -m xmlrunner -o "reports/py${{ matrix.python-version }}_conda" -v | |
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }}_conda coverage report -m | |
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }}_conda coverage xml -o "reports/py${{ matrix.python-version }}_conda/py-coverage.xml" | |
- name: Display Unit Test Reports | |
uses: dorny/test-reporter@v1 | |
with: | |
name: Unit Tests ${{ matrix.python-version }} | |
path: >- | |
reports/py${{ matrix.python-version }}/TEST-tests.*.*.xml, | |
reports/py${{ matrix.python-version }}_conda/TEST-tests.*.*.xml | |
reporter: java-junit | |
path-replace-backslashes: 'true' # Necessary for windows paths | |
- name: Upload Test Reports as Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports-${{ matrix.python-version }} | |
path: |- | |
reports/py${{ matrix.python-version }}/TEST-tests.*.*.xml | |
reports/py${{ matrix.python-version }}/py-coverage.xml | |
reports/py${{ matrix.python-version }}_conda/TEST-tests.*.*.xml | |
reports/py${{ matrix.python-version }}_conda/py-coverage.xml | |
tests/resources/scenario_generation/*/ref/*._kh | |
tests/resources/scenario_generation/*/output/*._kh | |
tests/resources/*/output_reports/*.txt | |
tests/resources/*/ref_reports/*.txt | |
tests/resources/dictionary/ref_kdic/*.kdic | |
tests/resources/dictionary/output_kdic/*.kdic | |
tests/resources/dictionary/copy_output_kdic/*.kdic | |
tests/resources/general_options/general_options/*/*._kh | |
retention-days: 7 | |
check-mpiexec-on-linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
container: [ubuntu22.04, rocky8, rocky9] | |
runs-on: ubuntu-latest | |
container: | |
# '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 }} | |
permissions: | |
id-token: write | |
contents: read | |
checks: write | |
packages: read | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
# Get Git tags so that versioneer can function correctly | |
# See issue https://github.com/actions/checkout/issues/701 | |
fetch-depth: 0 | |
- name: Install khiops-python dev dependencies | |
run: | | |
# The following git command is required, | |
# as the Git repository is in a directory the current user does not own, | |
# Python versioneer fails to compute the current version correctly otherwise | |
git config --global --add safe.directory $(realpath .) | |
python setup.py egg_info | |
pip install `grep -v "^\[" khiops.egg-info/requires.txt` | |
rm -rf khiops.egg-info | |
- name: Setup and Install Test Requirements | |
run: | | |
pip install -r test-requirements.txt | |
- name: Launch proper MPI awareness test | |
env: | |
# Force > 2 CPU cores to launch mpiexec | |
KHIOPS_PROC_NUMBER: 4 | |
run: |- | |
# Make sure '/bin' is before '/usr/bin' in PATH | |
PATH=$(echo "/bin:"$PATH | sed 's#:/bin##') | |
# Make sure MPI support is not loaded through env modules | |
# Note: As Docker container's shell is non-interactive, environment | |
# modules are currently not initializing the shell anyway | |
if [ -n "$MODULESHOME" ]; then module unload mpi; fi | |
python -m unittest -v tests.test_khiops_integrations.KhiopsRunnerEnvironmentTests.test_runner_has_mpiexec_on_linux |