-
Notifications
You must be signed in to change notification settings - Fork 8
120 lines (106 loc) · 3.25 KB
/
ci.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
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
name: Continuous integration
on:
push:
branches: [develop, master]
pull_request:
env:
DEFAULT_PYTHON: 3.11
SECRET_KEY: topsecret123
FIELD_ENCRYPTION_KEYS: f164ec6bd6fbc4aef5647abc15199da0f9badcc1d2127bde2087ae0d794a9a0b
jobs:
test:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:13-3.2
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: open_city_profile
POSTGRES_PASSWORD: open_city_profile
POSTGRES_DB: open_city_profile
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Cache pip packages
uses: actions/cache@v4
env:
cache-name: cache-pip-modules
with:
path: ~/.pip-cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install system packages
run: sudo apt-get install -y gdal-bin
- name: Install Python dependencies
run: |
pip install -r requirements.txt -r requirements-dev.txt codecov
- name: Run tests
run: pytest -ra -vv --doctest-modules --cov=.
env:
DATABASE_URL: postgres://open_city_profile:open_city_profile@localhost:5432/open_city_profile
- name: Coverage
run: codecov
- name: Database sanitizer config
run: ./manage.py check_sanitizerconfig
commitlint:
name: Commitlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check commitlint
uses: wagoid/commitlint-github-action@0d749a1a91d4770e983a7b8f83d4a3f0e7e0874e # v5.4.4
black:
name: Coding style - black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run black
uses: psf/black@stable
with:
options: "--check"
flake8:
name: Coding style - flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install dependencies
run: pip install flake8 pep8-naming -c requirements-dev.txt
- name: Run flake8
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: flake8
run: flake8
isort:
name: Coding style - isort
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install dependencies
run: pip install isort -c requirements-dev.txt
- name: Run isort
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: isort
run: isort -c .