-
Notifications
You must be signed in to change notification settings - Fork 24
99 lines (82 loc) · 2.64 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
on:
# Trigger analysis when pushing in develop/master or pull requests, and when creating
# a pull request.
push:
branches:
- master
- develop
pull_request:
types: [opened, synchronize, reopened]
name: CI Workflow
jobs:
test:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:9.6
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: tunnistamo
POSTGRES_PASSWORD: tunnistamo
POSTGRES_DB: tunnistamo
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
# Required by Sonar
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: 'requirements*.txt'
- name: Install system packages
run: sudo apt update && sudo apt-get install -y libxmlsec1-dev xmlsec1 gettext
- name: Install Python dependencies
run: pip install -r requirements.txt -r requirements-dev.txt
- name: Compile translations
run: python manage.py compilemessages
- name: Run tests
run: pytest -ra -vvv --cov=.
env:
DATABASE_URL: postgres://tunnistamo:tunnistamo@localhost:5432/tunnistamo
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
# 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 }}
coding-style:
name: Coding style
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: 'requirements*.txt'
- name: Install system packages
run: sudo apt update && sudo apt-get install -y libxmlsec1-dev xmlsec1
- name: Install Python dependencies
run: pip install -r requirements.txt -r requirements-dev.txt
- name: Linting
run: flake8
- name: Import sorting
run: isort -c .