-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (41 loc) · 1 KB
/
Copy pathtest.yml
File metadata and controls
48 lines (41 loc) · 1 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
name: Run FastAPI Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
mongo:
image: mongo:latest
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.1
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Wait for MongoDB to be ready
run: |
for i in {1..30}; do
nc -z localhost 27017 && echo "MongoDB is up" && exit 0
echo "Waiting for MongoDB..."
sleep 2
done
exit 1
- name: Run tests
env:
MONGO_URI: mongodb://root:example@localhost:27017
run: pytest --asyncio-mode=auto