Skip to content

Update precommit (#1326) #2720

Update precommit (#1326)

Update precommit (#1326) #2720

Workflow file for this run

---
name: Tests
on: [push, pull_request]
jobs:
static:
name: static checks / linters
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-new3
${{ runner.os }}-new3
- name: Install numpy
run: pip install -U 'numpy<1.24'
- name: Install dependencies
run: pip install --upgrade --upgrade-strategy eager .[full,test,dev]
- name: pip list packages
run: pip list
- name: show pip dependencies
run: |
pip install pipdeptree
pipdeptree -fl
- name: pre-commit checks
run: pre-commit run -a
docs:
name: Documentation build
runs-on: ubuntu-latest
needs: [static]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-new3
${{ runner.os }}-new3
- name: Install doc dependencies
run: pip install -r docs/requirements.txt
- name: Install lale
run: pip install --no-dependencies -e .
- name: pip list packages
run: pip list
- name: Install latex (used for math notation in sphinx)
run: >
sudo apt-get update -y &&
sudo apt-get install -y
latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
dvipng librsvg2-bin
- name: Run sphinx
run: sphinx-build "." "_build" -W --keep-going
working-directory: ./docs
# test_matrix_pr and test_matrix_master have a lot of redundancy
# If GitHub actions adds support for conditional matrix expressions
# these should be combined, but current workarounds seem overly complex
test_matrix_pr:
name: Test (PR)
runs-on: ubuntu-latest
if: ${{github.event_name == 'pull_request' }}
needs: [static]
strategy:
fail-fast: false
matrix:
test-case:
- test/test_core_classifiers.py
- test/test_core_regressors.py
- test/test_core_transformers.py
- test/test_core_pipeline.py
- test/test_custom_schemas.py
- test/test_json_pretty_viz.py
- test/test_grammar.py
- test/test_type_checking.py
- test/test_interoperability.py
- test/test_optimizers.py
- test/test_pipeline.py
- test/test_autogen_lib.py
- test/test_snapml.py
- test/test_relational.py
- test/test_category_encoders.py
python-version: [3.9]
setup-target: ['.[full,test]']
include:
- test-case: test/test_core_misc.py
python-version: 3.8
setup-target: '.[full,test]'
- test-case: test/test_core_misc.py
python-version: 3.9
setup-target: '.[full,test]'
- test-case: test/test_core_misc.py
python-version: '3.10'
setup-target: '.[full,test]'
- test-case: test/test_autogen_lib.py
python-version: 3.8
setup-target: '.[test]'
- test-case: test/test_halving_gridsearchcv.py
python-version: 3.8
setup-target: '.[test]'
- test-case: test/test_aif360.py
python-version: 3.8
setup-target: '.[full,test]'
- test-case: test/test_relational_sklearn.py
python-version: 3.8
setup-target: '.[full,test]'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system packages
run: sudo apt-get install graphviz swig
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-new3
${{ runner.os }}-new3
- name: Install numpy
run: pip install -U 'numpy<1.24'
- name: Install dependencies
run: pip install --upgrade --upgrade-strategy eager ${{matrix.setup-target}}
- name: Install deps for test_relational_sklearn
if: ${{ matrix.test-case == 'test/test_relational_sklearn.py' }}
run: pip install 'scikit-learn>=1.0'
- name: Install deps for test_snapml
if: ${{ matrix.test-case == 'test/test_snapml.py' }}
run: pip install 'numpy>=1.20.1,<1.24'
- name: Install deps for test_core_pipeline with scipy 1.5.4
if: ${{ matrix.test-case == 'test/test_core_pipeline.py' }}
run: pip install 'scipy==1.5.4'
- name: Imbalanced learn version for Python 3.8
if: ${{ matrix.test-case == 'test/test_interoperability.py' && matrix.python-version == 3.8}}
run: pip install 'imbalanced-learn==0.9.0' 'scikit-learn==1.0.2'
- name: pip list packages
run: pip list
- name: show pip dependencies
run: |
pip install pipdeptree
pipdeptree -fl
- name: Run test
run: py.test -v --capture=tee-sys ${{matrix.test-case}}
test_matrix_master:
name: Test (master)
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
needs: [static]
strategy:
fail-fast: false
matrix:
test-case:
- test/test_core_classifiers.py
- test/test_core_regressors.py
- test/test_core_transformers.py
- test/test_core_misc.py
- test/test_core_pipeline.py
- test/test_custom_schemas.py
- test/test_json_pretty_viz.py
- test/test_grammar.py
- test/test_type_checking.py
- test/test_interoperability.py
- test/test_optimizers.py
- test/test_pipeline.py
- test/test_autogen_lib.py
- test/test_relational.py
- test/test_category_encoders.py
python-version: [3.8, 3.9, '3.10']
setup-target: ['.[full,test]']
include:
- test-case: test/test_autogen_lib.py
python-version: 3.8
setup-target: '.[test]'
- test-case: test/test_halving_gridsearchcv.py
python-version: 3.8
setup-target: '.[test]'
- test-case: test/test_aif360.py
python-version: 3.8
setup-target: '.[full,test]'
- test-case: test/test_relational_sklearn.py
python-version: 3.8
setup-target: '.[test]'
- test-case: test/test_snapml.py
python-version: 3.8
setup-target: '.[full,test]'
- test-case: test/test_snapml.py
python-version: 3.9
setup-target: '.[full,test]'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system packages
run: sudo apt-get install graphviz swig
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-new3
${{ runner.os }}-new3
- name: Install numpy
run: pip install -U 'numpy<1.24'
- name: Install dependencies
run: pip install --upgrade --upgrade-strategy eager ${{matrix.setup-target}}
- name: Install deps for test_relational_sklearn
if: ${{ matrix.test-case == 'test/test_relational_sklearn.py' }}
run: pip install 'scikit-learn>=1.0'
- name: Install deps for test_snapml
if: ${{ matrix.test-case == 'test/test_snapml.py' }}
run: pip install 'numpy>=1.20.1,<1.24'
- name: Imbalanced learn version for Python 3.8
if: ${{ matrix.test-case == 'test/test_interoperability.py' && matrix.python-version == 3.8}}
run: pip install 'imbalanced-learn==0.9.0' 'scikit-learn==1.0.2'
- name: pip list packages
run: pip list
- name: show pip dependencies
run: |
pip install pipdeptree
pipdeptree -fl
- name: Run test
run: py.test -v --capture=tee-sys ${{matrix.test-case}}
test_newer:
name: Test with newest sklearn
runs-on: ubuntu-latest
needs: [static]
strategy:
fail-fast: false
matrix:
test-case:
- test/test_core_classifiers.py
- test/test_core_regressors.py
- test/test_core_transformers.py
python-version: ['3.10']
setup-target: ['.']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system packages
run: sudo apt-get install graphviz swig
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-new3
${{ runner.os }}-new3
- name: Install numpy
run: pip install -U 'numpy<1.24'
- name: Install dependencies
run: pip install --upgrade --upgrade-strategy eager ${{matrix.setup-target}}
- name: Install pytest
run: pip install pytest
- name: Install latest scikit-learn, xgboost, and lightgbm
run: pip install --upgrade --upgrade-strategy eager scikit-learn xgboost lightgbm
- name: pip list packages
run: pip list
- name: show pip dependencies
run: |
pip install pipdeptree
pipdeptree -fl
- name: Run test
run: py.test -v --capture=tee-sys ${{matrix.test-case}}
continue-on-error: true # we may not yet support the latest scikit-learn version
test_notebooks_pr:
name: Test Notebooks (PR)
needs: [static]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
env:
ALL_NOTEBOOK_CATEGORIES: demo_ docs_ talk_
strategy:
fail-fast: false
matrix:
category:
- demo_
- docs_
- talk_
python-version: [3.9]
setup-target: ['.[full,test]']
test-case: ['test/test_notebooks.py']
dir: ['examples']
nbexcludes: ['']
include:
- dir: 'examples/kdd22'
python-version: 3.9
setup-target: '.[tutorial,test]'
test-case: 'test/test_notebooks.py'
# nbexcludes: '06_multobj.ipynb'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-new3
${{ runner.os }}-new3
- name: Install packages
run: sudo apt-get install graphviz swig
- name: Install numpy
run: pip install -U 'numpy<1.24'
- name: Install dependencies
run: pip install --upgrade --upgrade-strategy eager ${{matrix.setup-target}}
- name: Fix tutorial dependencies
if: ${{ matrix.dir == 'examples/kdd22' }}
run: |
pip install "pandas<2.0.0" "xgboost<=1.5.1"
- name: pip list packages
run: pip list
- name: show pip dependencies
run: |
pip install pipdeptree
pipdeptree -fl
- name: Run test
run: >
NOTEBOOK_EXCLUDES="${{matrix.nbexcludes}}"
NOTEBOOK_DIR=${{matrix.dir}}
NOTEBOOK_CATEGORY=${{matrix.category}}
py.test -v --capture=tee-sys ${{matrix.test-case}}
test_notebooks_master:
name: Test Notebooks (master)
needs: [static]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
env:
ALL_NOTEBOOK_CATEGORIES: demo_ docs_ talk_
strategy:
fail-fast: false
matrix:
category:
- demo_
- docs_
- talk_
python-version: [3.8, 3.9, '3.10']
setup-target: ['.[full,test]']
test-case: ['test/test_notebooks.py']
dir: ['examples']
nbexcludes: ['']
include:
- dir: 'examples'
python-version: 3.8
setup-target: '.[full,test]'
test-case: 'test/test_notebooks.py'
nbexcludes: 'demo_auto_pipeline.ipynb'
- dir: 'examples/kdd22'
python-version: 3.8
setup-target: '.[tutorial,test]'
test-case: 'test/test_notebooks.py'
nbexcludes: '02_total.ipynb'
- dir: 'examples/kdd22'
python-version: 3.9
setup-target: '.[tutorial,test]'
test-case: 'test/test_notebooks.py'
# nbexcludes: '06_multobj.ipynb'
- dir: 'examples/kdd22'
python-version: '3.10'
setup-target: '.[tutorial,test]'
test-case: 'test/test_notebooks.py'
# nbexcludes: '06_multobj.ipynb'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-new3
${{ runner.os }}-new3
- name: Install packages
run: sudo apt-get install graphviz swig
- name: Install numpy
run: pip install -U 'numpy<1.24'
- name: Install dependencies
run: pip install --upgrade --upgrade-strategy eager ${{matrix.setup-target}}
- name: Fix tutorial dependencies
if: ${{ matrix.dir == 'examples/kdd22' }}
run: |
pip install "pandas<2.0.0" "xgboost<=1.5.1"
- name: pip list packages
run: pip list
- name: show pip dependencies
run: |
pip install pipdeptree
pipdeptree -fl
- name: Run test
run: >
NOTEBOOK_EXCLUDES="${{matrix.nbexcludes}}"
NOTEBOOK_DIR=${{matrix.dir}}
NOTEBOOK_CATEGORY=${{matrix.category}}
py.test -v --capture=tee-sys ${{matrix.test-case}}
test_fairness:
name: Test fairness install
runs-on: ubuntu-latest
needs: [static]
strategy:
fail-fast: false
matrix:
test-case:
- test/test_aif360.py
- test/test_aif360_ensembles.py
python-version: [3.8]
setup-target: ['.[fairness]']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system packages
run: sudo apt-get install graphviz swig
- name: Install numpy
run: pip install -U 'numpy<1.24'
- name: Install pytest
run: pip install pytest
- name: Install dependencies
run: pip install --upgrade --upgrade-strategy eager ${{matrix.setup-target}}
- name: pip list packages
run: pip list
- name: show pip dependencies
run: |
pip install pipdeptree
pipdeptree -fl
- name: Run test
run: py.test -v --capture=tee-sys ${{matrix.test-case}}
deploy:
name: Deploy to TestPyPI
runs-on: ubuntu-latest
# This should run only on the master branch of the main repo
if: github.repository == 'IBM/lale' && github.ref == 'refs/heads/master' && success()
needs: [static, test_matrix_master, test_newer, test_fairness, test_notebooks_master, docs]
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install wheel twine
- name: Build distribution
env:
# integrate with the current system for timestamping versions
TRAVIS: " "
run: python setup.py sdist bdist_wheel
- name: Publish package to TestPyPI
run: twine upload -u "__token__" -p "${{ secrets.test_pypi_password }}" -r testpypi dist/*