-
Notifications
You must be signed in to change notification settings - Fork 3
96 lines (91 loc) · 2.72 KB
/
ci.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
name: CI
on:
push:
pull_request:
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: ccems-ci
POSTGRES_USER: postgres
POSTGRES_PASSWORD: zJc2B%SDoUz%Uvrr
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
- run: python -m pip install --upgrade pip wheel
- run: pip install -r requirements.txt
- run: pylint --rcfile=.pylintrc --recursive=y ./app
unit-test:
name: unit-test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.10.12
- name: Install dependencies
run: |
pip install -r requirements.txt
working-directory: ./
- name: Run unit tests with code coverage
run: |
export $(xargs <ci.env)
export DATABASE_URL_TEST="postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.POSTGRES_HOST }}:${{ env.POSTGRES_PORT }}/${{ env.POSTGRES_DB }}"
echo $DATABASE_URL_TEST
coverage run -m unittest discover -s tests
coverage report -m --fail-under=90
working-directory: ./
integration-test:
name: integration-test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.10.12
- name: Install dependencies
run: |
pip install -r requirements.txt
working-directory: ./
- name: Run behave tests
run: |
export $(xargs <ci.env)
export DATABASE_URL_TEST="postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.POSTGRES_HOST }}:${{ env.POSTGRES_PORT }}/${{ env.POSTGRES_DB }}"
echo $DATABASE_URL_TEST
behave
working-directory: ./