-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (52 loc) · 1.97 KB
/
Copy pathsonar.yml
File metadata and controls
62 lines (52 loc) · 1.97 KB
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
name: SonarCloud
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
cleanup-runs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@v0.3.3
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
sonar-check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
needs: cleanup-runs
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f src/requirements.txt ]; then pip install -r src/requirements.txt; fi
sudo apt-get update && sudo apt-get install -y libclang-12-dev nlohmann-json3-dev
python setup.py install
- name: Download sonar
run: |
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.4.0.2170-linux.zip
unzip -o sonar-scanner-cli-4.4.0.2170-linux.zip
- name: Collect coverage info
run: |
coverage run -m pytest ./src/test
coverage xml -i
- name: Run sonar
run: |
export PATH=$PWD/sonar-scanner-4.4.0.2170-linux/bin:$PATH
sonar-scanner -Dsonar.projectKey=PicsArt_cppbind \
-Dsonar.organization=picsart \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.projectName=cppbind \
-Dsonar.sources=src/cppbind,src/cppbind/config/rules,src/cppbind/config/std_helpers/python \
-Dsonar.exclusions=src/cppbind/config/** \
-Dsonar.python.coverage.reportPaths=coverage.xml
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}