Skip to content

Pin mpich version on Linux #615

Pin mpich version on Linux

Pin mpich version on Linux #615

---
name: Run 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
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-unit-tests:
runs-on: ubuntu-latest
container:
image: ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04: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@v3
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@v3
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 ${{ github.workspace }}/reports
pip install unittest-xml-reporting
pip install -r test-requirements.txt
- name: Install khiops-python dependencies
if: success() || failure()
run: |
python3 setup.py egg_info
pip install `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
run: |
# This is needed so that the Git tag is parsed and the khiops-python
# version is retrieved
git config --global --add safe.directory $(realpath .)
coverage run -m xmlrunner -o "reports" -v
coverage report -m
coverage xml -o "reports/py-coverage.xml"
- name: Display Unit Test Reports
uses: dorny/test-reporter@v1
with:
name: Unit Tests
path: reports/TEST-tests.*.*.xml
reporter: java-junit
path-replace-backslashes: 'true' # Necessary for windows paths
- name: Upload Test Reports as Artifacts
uses: actions/upload-artifact@v3
with:
name: test-reports
path: |-
reports/TEST-tests.*.*.xml
reports/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