Skip to content

Commit 7c952eb

Browse files
committed
fix(ci): Add MySQL service container support to CI workflows
- Add needs_mysql to services check - Add MySQL service container configuration - Add MySQL environment variables for tests
1 parent a1b709b commit 7c952eb

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

scripts/split_tox_gh_actions/templates/test_group.jinja

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
python-version: [{{ py_versions|join(",") }}]
99
os: [ubuntu-22.04]
1010

11-
{% if needs_docker or needs_postgres or needs_redis %}
11+
{% if needs_docker or needs_postgres or needs_redis or needs_mysql %}
1212
services:
1313
{% if needs_docker %}
1414
docker:
@@ -41,6 +41,20 @@
4141
ports:
4242
- 6379:6379
4343
{% endif %}
44+
{% if needs_mysql %}
45+
mysql:
46+
image: mysql
47+
env:
48+
MYSQL_ROOT_PASSWORD: sentry
49+
MYSQL_DATABASE: test_db
50+
options: >-
51+
--health-cmd "mysqladmin ping -h localhost"
52+
--health-interval 10s
53+
--health-timeout 5s
54+
--health-retries 5
55+
ports:
56+
- 3306:3306
57+
{% endif %}
4458
{% endif %}
4559
env:
4660
# 3.6/3.7 run in the python:X.Y container; tell uv to use that system Python.
@@ -53,6 +67,12 @@
5367
{% if needs_redis %}
5468
SENTRY_PYTHON_TEST_REDIS_HOST: {% raw %}${{ (matrix.python-version == '3.6' || matrix.python-version == '3.7') && 'redis' || 'localhost' }}{% endraw %}
5569
{% endif %}
70+
{% if needs_mysql %}
71+
SENTRY_PYTHON_TEST_MYSQL_HOST: {% raw %}${{ (matrix.python-version == '3.6' || matrix.python-version == '3.7') && 'mysql' || 'localhost' }}{% endraw %}
72+
SENTRY_PYTHON_TEST_MYSQL_USER: root
73+
SENTRY_PYTHON_TEST_MYSQL_PASSWORD: sentry
74+
SENTRY_PYTHON_TEST_MYSQL_DB: test_db
75+
{% endif %}
5676
container: {% raw %}${{ (matrix.python-version == '3.6' || matrix.python-version == '3.7') && format('python:{0}', matrix.python-version) || null }}{% endraw %}
5777
steps:
5878
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

0 commit comments

Comments
 (0)