-
Notifications
You must be signed in to change notification settings - Fork 20
96 lines (78 loc) · 2.28 KB
/
server-ci.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
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
name: Grai Server CI
on:
pull_request:
paths:
- ".github/workflows/server-ci.yml"
- "grai-server/**"
concurrency:
group: ${{ github.ref }}-server-ci
cancel-in-progress: true
env:
py_ver: "3.11"
poetry_ver: "${{ vars.POETRY_VER }}"
SECRET_KEY: "fixed-test-key-that-doesnt-matter"
DB_USER: "grai"
DB_PASSWORD: "grai"
DB_NAME: "grai"
DEBUG: "False"
DB_HOST: "127.0.0.1"
DB_PORT: "5432"
jobs:
lint-server:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "${{ env.py_ver }}"
- run: pip install black isort
- working-directory: "grai-server/app"
run: |
black . --check --exclude /migrations/
# isort . --profile black --check
tests-server:
needs: lint-server
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./grai-server/app
services:
postgres:
image: ankane/pgvector:latest
env:
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_DB: ${{ env.DB_NAME }}
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 15
redis:
image: redis/redis-stack-server:6.2.6-v9
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ env.py_ver }}"
- uses: abatilo/actions-poetry@v2
with:
poetry-version: "${{ env.poetry_ver }}"
- run: poetry install
- name: Run Migrations
run: poetry run python manage.py migrate --noinput
- name: Run Coverage Tests
env:
GITHUB_PRIVATE_KEY: installations/tests/sample.private-key.pem
run: |
poetry run coverage run -m pytest
poetry run coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: grai-server
token: ${{ secrets.CODECOV_TOKEN }}