-
-
Notifications
You must be signed in to change notification settings - Fork 93
156 lines (139 loc) · 4.23 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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.12"]
poetry-version: ["1.6.1"]
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.12"]
poetry-version: ["1.6.1"]
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
minio:
image: bitnami/minio:2024.5.28
ports:
- 9000:9000
- 9001:9001
env:
MINIO_ROOT_USER: polar
MINIO_ROOT_PASSWORD: polarpolar
options: >-
--health-cmd "curl -I http://127.0.0.1:9000/minio/health/live"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: 💿 MinIO Setup
working-directory: ./server/.minio
env:
MINIO_HOST: 127.0.0.1
MINIO_ROOT_USER: polar
MINIO_ROOT_PASSWORD: polarpolar
ACCESS_KEY: polar-development
SECRET_ACCESS_KEY: polar123456789
BUCKET_NAME: polar-s3
BUCKET_TESTING_NAME: testing-polar-s3
POLICY_FILE: policy.json
run: bash github.sh
- 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
poetry run task generate_dev_jwks
- 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