forked from optuna/optuna
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (125 loc) · 4.24 KB
/
tests-storage.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Tests (Storage with server)
on:
workflow_dispatch:
push:
branches:
- master
pull_request: {}
schedule:
- cron: '0 23 * * SUN-THU'
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true
jobs:
# TODO(masap): Modify job name to "tests-storage-with-server" because this test is not only for
# RDB. Since current name "tests-rdbstorage" is required in the Branch protection rules, you
# need to modify the Branch protection rules as well.
tests-rdbstorage:
if: (github.event_name == 'schedule' && github.repository == 'optuna/optuna') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
test-trigger-type:
- ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && 'Scheduled' || '' }}
exclude:
- test-trigger-type: ""
python-version: "3.9"
- test-trigger-type: ""
python-version: "3.10"
- test-trigger-type: ""
python-version: "3.11"
- test-trigger-type: ""
python-version: "3.12"
services:
mysql:
image: mysql:8
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: mandatory_arguments
MYSQL_DATABASE: optunatest
MYSQL_USER: user
MYSQL_PASSWORD: test
options: >-
--health-cmd "mysqladmin ping -h localhost"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_DB: optunatest
POSTGRES_USER: user
POSTGRES_PASSWORD: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup cache
uses: actions/cache@v3
env:
cache-name: test-storage-with-server
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
- 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
- name: Install DB bindings
run: |
pip install --progress-bar off PyMySQL cryptography psycopg2-binary redis
- name: Output installed packages
run: |
pip freeze --all
- name: Output dependency tree
run: |
pip install pipdeptree
pipdeptree
- name: Tests MySQL
run: |
pytest tests/storages_tests/test_with_server.py
env:
SQLALCHEMY_WARN_20: 1
OMP_NUM_THREADS: 1
TEST_DB_URL: mysql+pymysql://user:[email protected]/optunatest
- name: Tests PostgreSQL
run: |
pytest tests/storages_tests/test_with_server.py
env:
OMP_NUM_THREADS: 1
TEST_DB_URL: postgresql+psycopg2://user:[email protected]/optunatest
- name: Tests Journal Redis
run: |
pytest tests/storages_tests/test_with_server.py
env:
OMP_NUM_THREADS: 1
TEST_DB_URL: redis://localhost:6379
TEST_DB_MODE: journal-redis