-
Notifications
You must be signed in to change notification settings - Fork 41
67 lines (55 loc) · 2.12 KB
/
python-sonar.yml
File metadata and controls
67 lines (55 loc) · 2.12 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
63
64
65
66
67
name: Test Python aswfdocker Library - Sonar
on:
# Trigger analysis when pushing in master or pull requests, and when creating
# a pull request.
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pipenv
run: pip3 install pipenv
- name: Install aswfdocker and dev dependencies with pipenv
run: pipenv install --dev
# python unittests with junit XML report and coverage XML Cobertura report for publishing task
- name: Run pytest
run: pipenv run pytest python/aswfdocker --doctest-modules --junitxml=test-pytest-results.xml --cov=. --cov-report=xml
# mypy static type checks with junit XML report
- name: Run mypy
run: pipenv run mypy python/aswfdocker --junit-xml=test-mypy-results.xml
# prospector linter checks with xunit XML report
- name: Run prospector linter
run: pipenv run prospector -F python/aswfdocker --output-format xunit > test-prospector-results.xml
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1.3
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: Unit Test Results
files: "**/test-*.xml"
- name: Prepare sonar variables
run: |
echo "::set-env name=SONAR_PROJECT_VERSION::`git log $tag -n 1 --date=short --pretty=\"%ad\"`"
echo "::set-env name=SONAR_PROJECT_DATE::`pipenv run python setup.py --version`"
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectDate=${{ env.SONAR_PROJECT_VERSION }}
-Dsonar.projectVersion=${{ env.SONAR_PROJECT_DATE }}