-
Notifications
You must be signed in to change notification settings - Fork 9
59 lines (59 loc) · 1.82 KB
/
sonarcloud.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
on:
push:
branches: [master, develop]
pull_request_target:
branches: [master, develop]
name: Sonarcloud Scan
jobs:
sonarcloud:
env:
DATABASE_URL: 'postgis://postgres:postgres@localhost/github_actions'
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10"]
services:
postgres:
image: postgis/postgis:12-3.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install gdal
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y gdal-bin gettext
- name: Install pypi packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Generate coverage file
run: |
python manage.py compilemessages
pytest --cov=. --cov-report xml:coverage.xml --migrations
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=managedcloudapplications
-Dsonar.projectKey=mvj
-Dsonar.sources=.
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.python.version=3.10
-Dsonar.python.coverage.reportPaths=coverage.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}