Windows tests #430
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
# Run tests on Windows, which are triggered by each master push. | |
# Currently, Python3.12 is only used as an environment. | |
# This is mainly for the sake of speed. | |
name: Windows tests | |
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-windows: | |
runs-on: windows-latest | |
# Not intended for forks. | |
if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Setup cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: windows-test | |
with: | |
path: ~\\AppData\\Local\\pip\\Cache | |
key: ${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }}-v1 | |
restore-keys: | | |
${{ runner.os }}-3.12-${{ env.cache-name }}-${{ hashFiles('**/pyproject.toml') }} | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
pip install --progress-bar off -U setuptools | |
# 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] --extra-index-url https://download.pytorch.org/whl/cpu | |
pip install --progress-bar off .[optional] --extra-index-url https://download.pytorch.org/whl/cpu | |
pip install PyQt6 # Install PyQT for using QtAgg as matplotlib backend. | |
# TODO(HideakiImamura): Remove this after fixing https://github.com/plotly/Kaleido/issues/110 | |
pip install "kaleido<=0.1.0post1" | |
# TODO(nabe): Remove the version constraint once Torch supports NumPy v2.0.0 for Windows. | |
pip uninstall numpy | |
pip install --progress-bar off 'numpy<2.0.0' | |
- 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: | | |
pytest | |
env: | |
SQLALCHEMY_WARN_20: 1 | |
MPLBACKEND: "QtAgg" # Use QtAgg as matplotlib backend. | |
- name: Tests | |
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} | |
run: | | |
pytest -m "not slow" | |
env: | |
MPLBACKEND: "QtAgg" # Use QtAgg as matplotlib backend. |