-
Notifications
You must be signed in to change notification settings - Fork 96
105 lines (93 loc) · 2.5 KB
/
test.yaml
File metadata and controls
105 lines (93 loc) · 2.5 KB
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
name: Test
on:
push:
branches:
- "**"
- "!gh-pages"
- "!stage*"
paths:
- "src/datajoint/**"
- "tests/**"
- "pyproject.toml"
- ".github/workflows/test.yaml"
pull_request:
branches:
- "**"
- "!gh-pages"
- "!stage*"
paths:
- "src/datajoint/**"
- "tests/**"
- "pyproject.toml"
- ".github/workflows/test.yaml"
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py_ver: ["3.10", "3.11", "3.12", "3.13"]
mysql_ver: ["8.0"]
services:
mysql:
image: mysql:${{ matrix.mysql_ver }}
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- name: Start MinIO
run: |
docker run -d --name minio \
-p 9000:9000 \
-e MINIO_ROOT_USER=datajoint \
-e MINIO_ROOT_PASSWORD=datajoint \
minio/minio:latest server /data
# Wait for MinIO to be ready
for i in {1..30}; do
if curl -sf http://127.0.0.1:9000/minio/health/live; then
echo "MinIO is ready"
break
fi
echo "Waiting for MinIO... ($i/30)"
sleep 2
done
- name: Set up Python ${{ matrix.py_ver }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py_ver }}
- name: Install dependencies
run: pip install -e ".[test]"
- name: Run tests
env:
DJ_USE_EXTERNAL_CONTAINERS: "1"
DJ_HOST: 127.0.0.1
DJ_PORT: 3306
DJ_USER: root
DJ_PASS: password
S3_ENDPOINT: 127.0.0.1:9000
S3_ACCESS_KEY: datajoint
S3_SECRET_KEY: datajoint
run: pytest --cov-report term-missing --cov=datajoint tests -v
# Unit tests run without containers (faster feedback)
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
py_ver: ["3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.py_ver }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py_ver }}
- name: Install dependencies
run: pip install -e ".[test]"
- name: Run unit tests
run: pytest tests/unit -v