Skip to content

Tests (Integration) #199

Tests (Integration)

Tests (Integration) #199

name: Tests (Integration)
on:
push:
branches:
- master
pull_request: {}
schedule:
- cron: '0 23 * * SUN-THU'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true
jobs:
tests-integration:
if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup cache
uses: actions/cache@v3
env:
cache-name: test-integration
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}
- name: Setup environment
run: |
sudo apt-get update
sudo apt-get -y install openmpi-bin libopenmpi-dev libopenblas-dev
# TODO(Shinichi): Remove the version constraint on PyTorch Lightning
# TODO(c-bata): Remove the version constraint on fakeredis
- name: Install
run: |
python -m pip install --upgrade pip
# Install minimal dependencies and confirm that `import optuna` is successful.
pip install --progress-bar off .
python -c 'import optuna'
optuna --version
pip install --progress-bar off .[test]
pip install --progress-bar off .[optional]
pip install --progress-bar off .[integration] --extra-index-url https://download.pytorch.org/whl/cpu
pip install "pytorch-lightning<2.0.0"
pip install "fakeredis<2.11.1"
- name: Output installed packages
run: |
pip freeze --all
- name: Output dependency tree
run: |
pip install pipdeptree
pipdeptree
- name: Scheduled tests
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
if [ ${{ matrix.python-version }} == 3.11 ]; then
pytest tests -m "integration" \
--ignore tests/integration_tests/test_botorch.py \
--ignore tests/integration_tests/test_catalyst.py \
--ignore tests/integration_tests/test_catboost.py \
--ignore tests/integration_tests/test_fastaiv2.py \
--ignore tests/integration_tests/test_lightgbm.py \
--ignore tests/integration_tests/test_mlflow.py \
--ignore tests/integration_tests/test_mxnet.py \
--ignore tests/integration_tests/test_pytorch_distributed.py \
--ignore tests/integration_tests/test_pytorch_ignite.py \
--ignore tests/integration_tests/test_pytorch_lightning.py \
--ignore tests/integration_tests/test_shap.py \
--ignore tests/integration_tests/test_skopt.py \
--ignore tests/integration_tests/test_skorch.py \
--ignore tests/integration_tests/test_tensorboard.py \
--ignore tests/integration_tests/test_tensorflow.py \
--ignore tests/integration_tests/test_tfkeras.py \
--ignore tests/integration_tests/lightgbm_tuner_tests \
--ignore tests/importance_tests/test_init.py \
--ignore tests/samplers_tests/test_samplers.py
else
pytest tests -m "integration"
fi
- name: Tests
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }}
run: |
if [ ${{ matrix.python-version }} == 3.11 ]; then
pytest tests -m "integration and not slow" \
--ignore tests/integration_tests/test_botorch.py \
--ignore tests/integration_tests/test_catalyst.py \
--ignore tests/integration_tests/test_catboost.py \
--ignore tests/integration_tests/test_fastaiv2.py \
--ignore tests/integration_tests/test_lightgbm.py \
--ignore tests/integration_tests/test_mlflow.py \
--ignore tests/integration_tests/test_mxnet.py \
--ignore tests/integration_tests/test_pytorch_distributed.py \
--ignore tests/integration_tests/test_pytorch_ignite.py \
--ignore tests/integration_tests/test_pytorch_lightning.py \
--ignore tests/integration_tests/test_shap.py \
--ignore tests/integration_tests/test_skopt.py \
--ignore tests/integration_tests/test_skorch.py \
--ignore tests/integration_tests/test_tensorboard.py \
--ignore tests/integration_tests/test_tensorflow.py \
--ignore tests/integration_tests/test_tfkeras.py \
--ignore tests/integration_tests/lightgbm_tuner_tests \
--ignore tests/importance_tests/test_init.py \
--ignore tests/samplers_tests/test_samplers.py
else
pytest tests -m "integration and not slow"
fi