-
-
Notifications
You must be signed in to change notification settings - Fork 227
143 lines (121 loc) · 3.61 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
name: Server
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
jobs:
linters:
name: "Server: Linters 📝"
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
server/.mypy_cache
key: mypy-${{ runner.os }}-${{ github.sha }}
restore-keys: |
mypy-${{ runner.os }}-
mypy-
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "server/.python-version"
- name: 🔧 uv install
working-directory: ./server
run: uv sync --dev
- name: 🐶 Lint Server (ruff)
working-directory: ./server
run: uv run task lint_check
- name: 🛟 Type Check Server (mypy)
working-directory: ./server
run: uv run task lint_types
test:
name: "Server: Tests 🐍"
runs-on: ubuntu-latest
timeout-minutes: 15
env:
POLAR_ENV: testing
POLAR_EMAIL_RENDERER_BINARY_PATH: ${{ github.workspace }}/server/emails/bin/react-email-pkg
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
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@v4
- 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
- uses: pnpm/action-setup@v4
with:
version: 9.15.0
- name: 📬 Setup Node.js environment for server/emails
uses: actions/setup-node@v4
with:
node-version-file: server/emails/.node-version
cache: "pnpm"
cache-dependency-path: "clients/pnpm-lock.yaml"
- name: 📬 Build server/emails
working-directory: server/emails
run: pnpm install --frozen-lockfile && pnpm build
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "server/.python-version"
- name: 🔧 uv install
working-directory: ./server
run: |
uv sync --dev
uv run task generate_dev_jwks
- name: ⚗️ alembic migrate
working-directory: ./server
run: uv run task db_migrate
- name: ⚗️ alembic check
working-directory: ./server
run: uv run alembic check
- name: 🐍 Run tests (pytest)
working-directory: ./server
run: uv run pytest -n auto --no-cov