-
Notifications
You must be signed in to change notification settings - Fork 35
95 lines (78 loc) · 2.72 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Tests
on:
push:
branches:
- master
pull_request: {}
schedule:
- cron: '0 23 * * SUN-THU'
workflow_dispatch:
inputs:
repository_name:
description: 'Repository for optuna package (username/optuna)'
required: false
type: string
branch_name:
description: 'Branch name'
required: false
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true
jobs:
tests:
if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna-integration') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['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
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 libopenblas-dev
- name: Install
run: |
python -m pip install --upgrade pip
pip install --progress-bar off .[test]
pip install --progress-bar off .[all]
# TODO(not522): Remove the version constraint when splitting this workflow.
# This constraint is necessary to use the old Pydantic.
# See https://github.com/pydantic/pydantic/issues/5821.
pip install "typing_extensions<4.6.0"
# Install optuna from specified repository, otherwise from optuna/optuna.
$( test ${{ inputs.repository_name }} && test ${{ inputs.branch_name }} ) \
&& pip install git+https://github.com/${{ inputs.repository_name }}@${{ inputs.branch_name }} \
|| pip install git+https://github.com/optuna/optuna@master
# Install distributed to run importance_tests/test_init tests.
pip install distributed
- name: Output installed packages
run: |
pip freeze --all
- name: Output dependency tree
run: |
pip install pipdeptree
pipdeptree
- name: Tests
run: |
pytest tests \
--ignore tests/test_mxnet.py
- name: Tests(Deprecated)
run: |
pip install "numpy<1.24"
pytest tests/test_mxnet.py