add RAITextInsights DBPedia notebook example and tests (#2204) #642
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: CI Python | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
paths: | |
- "erroranalysis/**" | |
- "rai_test_utils/**" | |
- "raiutils/**" | |
- "responsibleai/**" | |
- ".github/workflows/CI-python.yml" | |
jobs: | |
ci-python: | |
strategy: | |
matrix: | |
packageDirectory: | |
["responsibleai", "erroranalysis", "raiutils", "rai_test_utils"] | |
operatingSystem: | |
[ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest] | |
pythonVersion: ["3.6", "3.7", "3.8", "3.9", "3.10"] | |
exclude: | |
- operatingSystem: ubuntu-20.04 | |
pythonVersion: "3.7" | |
- operatingSystem: ubuntu-20.04 | |
pythonVersion: "3.8" | |
- operatingSystem: ubuntu-20.04 | |
pythonVersion: "3.9" | |
- operatingSystem: ubuntu-20.04 | |
pythonVersion: "3.10" | |
- operatingSystem: ubuntu-latest | |
pythonVersion: "3.6" | |
- operatingSystem: macos-latest | |
pythonVersion: "3.7" | |
runs-on: ${{ matrix.operatingSystem }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.pythonVersion }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pythonVersion }} | |
- if: ${{ matrix.pythonVersion == '3.6' || matrix.pythonVersion == '3.7' }} | |
name: Setup tools for python lt 3.8 | |
run: | | |
python -m pip install --upgrade "pip<=23.1.2" | |
pip install --upgrade setuptools | |
pip install --upgrade "pip-tools<=6.13.0" | |
- if: ${{ matrix.pythonVersion == '3.8' || matrix.pythonVersion == '3.9' || matrix.pythonVersion == '3.10' }} | |
name: Setup tools for python gte 3.8 | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade setuptools | |
pip install --upgrade "pip-tools<=7.1.0" | |
- name: Pip compile | |
run: | | |
pip-compile requirements-dev.txt -o requirements-dev-comp.txt | |
cat requirements-dev-comp.txt | |
working-directory: ${{ matrix.packageDirectory }} | |
- name: Upload requirements | |
uses: actions/upload-artifact@v3 | |
with: | |
name: requirements-dev-comp.txt | |
path: ${{ matrix.packageDirectory }}/requirements-dev-comp.txt | |
- name: Install dependencies | |
run: | | |
pip-sync requirements-dev-comp.txt | |
working-directory: ${{ matrix.packageDirectory }} | |
- name: Install package | |
run: | | |
pip install -v -e . | |
working-directory: ${{ matrix.packageDirectory }} | |
- name: Run tests | |
run: | | |
pytest --durations=10 --doctest-modules --junitxml=junit/test-results.xml --cov=${{ matrix.packageDirectory }} --cov-report=xml --cov-report=html | |
working-directory: ${{ matrix.packageDirectory }} | |
- name: Upload code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.packageDirectory }}-code-coverage-results | |
path: ${{ matrix.packageDirectory }}/htmlcov | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
- if: ${{ (matrix.operatingSystem == 'windows-latest') && (matrix.pythonVersion == '3.8') }} | |
name: Upload to codecov | |
id: codecovupload1 | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ${{ matrix.packageDirectory }} | |
env_vars: OS,PYTHON | |
fail_ci_if_error: false | |
files: ./${{ matrix.packageDirectory }}/coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
verbose: true | |
- if: ${{ (steps.codecovupload1.outcome == 'failure') && (matrix.pythonVersion == '3.8') && (matrix.operatingSystem == 'windows-latest') }} | |
name: Retry upload to codecov | |
id: codecovupload2 | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ${{ matrix.packageDirectory }} | |
env_vars: OS,PYTHON | |
fail_ci_if_error: false | |
files: ./${{ matrix.packageDirectory }}/coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
verbose: true | |
- name: Set codecov status | |
if: ${{ (matrix.pythonVersion == '3.8') && (matrix.operatingSystem == 'windows-latest') }} | |
shell: bash | |
run: | | |
if ${{ (steps.codecovupload1.outcome == 'success') || (steps.codecovupload2.outcome == 'success') }} ; then | |
echo fine | |
else | |
exit 1 | |
fi |