-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (73 loc) · 2.2 KB
/
github-actions.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
name: '[ci]tests'
# only run on push to branch, not on tags
on:
push:
branches:
- '*'
jobs:
model-module-import:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install pydantic as the sole dependency
run: |
python -m pip install -U pip
echo "pydantic<2" > requirements.txt
pip install -r requirements.txt
- name: Attempt to import model, should succeed.
run: python -c "import api.models"
server:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
# Opens tcp port 6379 on the host and service container
- 6379:6379
env:
SIIBRA_API_REDIS_HOST: localhost
SIIBRA_API_REDIS_PORT: 6379
SIIBRA_API_ROLE: server
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install server dependency
run: |
python -m pip install -U pip
pip install -r requirements/server.txt
- name: Print config, for debug purpose
run: |
python -c "import api.siibra_api_config as foo; print([(key, getattr(foo, key)) for key in foo.__dir__() if key.isupper()])"
- name: Try to start server and ping server
run: |
uvicorn api.server:api --port 8000 & sleep 10s
curl -v http://localhost:8000/v3_0/docs
test:
runs-on: ubuntu-latest
env:
# automatically set by github action
# only included here for clarity (if user would like to run tests locally)
CI: true
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
echo "Using github.ref: $GITHUB_REF"
pip install -r requirements/all.txt
- name: Install test dependecies
run: pip install pytest pytest-asyncio httpx mock coverage pytest-cov
- name: Run tests
run: pytest
- name: Run e2e
run: pytest e2e_test