-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (52 loc) · 1.67 KB
/
test_user_service.yml
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
name: Run Tests
on:
push:
branches:
- feature/user_service
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: user_service_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 1234
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Load Database Schema
run: |
cd user_service
PGPASSWORD=1234 psql -h localhost -U postgres -d user_service_db -a -f ./scheme.sql
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install dependencies
run: |
cd user_service
poetry install
- name: Set up environment variables
run: |
echo "SECRET_KEY=random_key" >> user_service/.env
echo "TEST=True" >> user_service/.env
echo "FASTAPI_IP=127.0.0.1" >> user_service/.env
echo "FASTAPI_PORT=8001" >> user_service/.env
echo "POSTGRES_HOST=localhost" >> user_service/.env
echo "POSTGRES_PORT=5432" >> user_service/.env
echo "POSTGRES_DB=user_service_db" >> user_service/.env
echo "POSTGRES_USER=postgres" >> user_service/.env
echo "POSTGRES_PASSWORD=1234" >> user_service/.env
- name: Run tests
run: |
cd user_service
poetry run python -m pytest tests