-
Notifications
You must be signed in to change notification settings - Fork 20
69 lines (66 loc) · 1.82 KB
/
test_api.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
name: Test API
on:
push:
paths:
- "nesis/api/core/**"
- "nesis/api/tests/**"
- "nesis/api/requirements*"
pull_request:
paths:
- "nesis/api/core/**"
- "nesis/api/tests/**"
- "nesis/api/requirements*"
jobs:
linter:
name: Black formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "./nesis/api/"
version: "24.3.0"
test:
runs-on: ubuntu-latest
name: Test API
services:
postgres:
image: ametnes/postgresql:16-debian-12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: nesis
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd "pg_isready -h localhost -U $$POSTGRES_USER"
--health-interval 10s
--health-timeout 5s
--health-retries 10
memcached:
image: bitnami/memcached:1.6.19
ports:
- 11211:11211
steps:
- name: Check out source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r nesis/api/requirements.txt -r nesis/api/requirements-test.txt
- name: Run unit tests
env:
NESIS_API_DATABASE_URL: "postgresql://postgres:password@localhost:5432/nesis"
NESIS_ADMIN_EMAIL: "[email protected]"
NESIS_ADMIN_PASSWORD: "password"
NESIS_MEMCACHE_HOSTS: localhost:11211
run: |
pytest nesis/api/tests/