-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.5 KB
/
ci.yml
File metadata and controls
58 lines (49 loc) · 1.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
name: CI
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
jobs:
test:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:7
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.adminCommand(\"ping\")'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Set up environment variables
run: |
echo "MONGO_HOST=localhost" >> $GITHUB_ENV
echo "MONGO_PORT=27017" >> $GITHUB_ENV
echo "MONGO_DB=test_db" >> $GITHUB_ENV
echo "MONGO_USER=" >> $GITHUB_ENV
echo "MONGO_PASSWORD=" >> $GITHUB_ENV
echo "MONGO_AUTH_DB=admin" >> $GITHUB_ENV
echo "JWT_SECRET=test_secret_key_for_ci" >> $GITHUB_ENV
echo "MONGO_URI=mongodb://localhost:27017" >> $GITHUB_ENV
- name: Run tests
run: |
pytest tests/ -v --tb=short