-
-
Notifications
You must be signed in to change notification settings - Fork 175
126 lines (112 loc) · 3.4 KB
/
test_server.yaml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Server
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
jobs:
linters:
name: "Server: Linters 📝"
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
poetry-version: ["1.3.2"]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: 🔧 poetry install
working-directory: ./server
run: poetry install --no-root
- uses: actions/cache@v3
with:
path: |
server/.mypy_cache
key: mypy-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}-${{ github.sha }}
restore-keys: |
mypy-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}-
mypy-${{ runner.os }}-${{ matrix.python-version }}-
mypy-${{ runner.os }}-
mypy-
- name: 🐶 Lint Server (ruff)
working-directory: ./server
run: poetry run task lint_check
- name: 🛟 Type Check Server (mypy)
working-directory: ./server
run: poetry run task lint_types
test:
name: "Server: Tests 🐍"
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
poetry-version: ["1.3.2"]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
services:
postgres:
image: postgres:15.1-bullseye
env:
POSTGRES_USER: polar
POSTGRES_PASSWORD: polar
POSTGRES_DB: polar_test
POSTGRES_PORT: 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redislabs/redismod
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: 🔧 poetry install
working-directory: ./server
run: poetry install --no-root
- uses: actions/cache@v3
with:
path: |
server/.pytest_cache
key: pytest-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}-${{ github.sha }}
restore-keys: |
pytest-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}-
pytest-${{ runner.os }}-${{ matrix.python-version }}-
pytest-${{ runner.os }}-
pytest-
- name: ⚗️ alembic migrate
working-directory: ./server
env:
POLAR_ENV: testing
run: poetry run task db_migrate
- name: ⚗️ alembic check
working-directory: ./server
env:
POLAR_ENV: testing
run: poetry run alembic check
- name: 🐍 Run tests (pytest)
working-directory: ./server
run: poetry run pytest