Skip to content

Commit fbc4cad

Browse files
ci: use docker-compose for test services
Use existing docker-compose.yaml instead of duplicating service configuration in the workflow. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent ae5fd68 commit fbc4cad

File tree

1 file changed

+10
-29
lines changed

1 file changed

+10
-29
lines changed

.github/workflows/test.yaml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- "src/datajoint/**"
1111
- "tests/**"
1212
- "pyproject.toml"
13+
- "docker-compose.yaml"
1314
- ".github/workflows/test.yaml"
1415
pull_request:
1516
branches:
@@ -20,6 +21,7 @@ on:
2021
- "src/datajoint/**"
2122
- "tests/**"
2223
- "pyproject.toml"
24+
- "docker-compose.yaml"
2325
- ".github/workflows/test.yaml"
2426

2527
jobs:
@@ -31,38 +33,13 @@ jobs:
3133
py_ver: ["3.10", "3.11", "3.12", "3.13"]
3234
mysql_ver: ["8.0"]
3335

34-
services:
35-
mysql:
36-
image: mysql:${{ matrix.mysql_ver }}
37-
env:
38-
MYSQL_ROOT_PASSWORD: password
39-
ports:
40-
- 3306:3306
41-
options: >-
42-
--health-cmd="mysqladmin ping -h localhost"
43-
--health-interval=10s
44-
--health-timeout=5s
45-
--health-retries=5
46-
4736
steps:
4837
- uses: actions/checkout@v4
4938

50-
- name: Start MinIO
51-
run: |
52-
docker run -d --name minio \
53-
-p 9000:9000 \
54-
-e MINIO_ROOT_USER=datajoint \
55-
-e MINIO_ROOT_PASSWORD=datajoint \
56-
minio/minio:latest server /data
57-
# Wait for MinIO to be ready
58-
for i in {1..30}; do
59-
if curl -sf http://127.0.0.1:9000/minio/health/live; then
60-
echo "MinIO is ready"
61-
break
62-
fi
63-
echo "Waiting for MinIO... ($i/30)"
64-
sleep 2
65-
done
39+
- name: Start services
40+
run: docker compose up -d db minio --wait
41+
env:
42+
MYSQL_VER: ${{ matrix.mysql_ver }}
6643

6744
- name: Set up Python ${{ matrix.py_ver }}
6845
uses: actions/setup-python@v5
@@ -84,6 +61,10 @@ jobs:
8461
S3_SECRET_KEY: datajoint
8562
run: pytest --cov-report term-missing --cov=datajoint tests -v
8663

64+
- name: Stop services
65+
if: always()
66+
run: docker compose down
67+
8768
# Unit tests run without containers (faster feedback)
8869
unit-tests:
8970
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)