-
Notifications
You must be signed in to change notification settings - Fork 7
81 lines (71 loc) · 2.27 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
name: Continuous Integration
on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
environment: test
strategy:
matrix:
python: [ "3.11" ]
env:
DEBUG: True
DATABASE_URL: postgis://postgres:postgres@localhost/parking-permits
DJANGO_SECRET_KEY: test-secret
DJANGO_SETTINGS_MODULE: project.settings_test
services:
postgres:
image: postgis/postgis:13-3.3
env:
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: pip
- name: Install required Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install gdal-bin
- name: Install PyPI dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Run Python side code neatness tests
run: |
flake8
black --check .
isort . -c
- name: Run pytest code functionality tests
env:
TALPA_API_KEY: ${{ secrets.TALPA_API_KEY }}
TALPA_MERCHANT_EXPERIENCE_API: ${{ vars.TALPA_MERCHANT_EXPERIENCE_API }}
run: |
pytest -ra -vvv --cov=.
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
# Without this workaround Sonar reports a warning about an incorrect source path
- name: Override coverage report source path for Sonar
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}