-
Notifications
You must be signed in to change notification settings - Fork 37
53 lines (46 loc) · 2.03 KB
/
python-sonar.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
name: Test Python aswfdocker Library - Sonar
on:
push:
branches:
- master
jobs:
sonar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pipenv'
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- name: Install aswfdocker and dev dependencies with pipenv
run: pipenv install --dev
# mypy static type checks with junit XML report
- name: Run mypy
run: pipenv run mypy python/aswfdocker --junit-xml=test-mypy-results.xml
# python unittests with junit XML report, PyLint and coverage XML Cobertura report for publishing task
- name: Run pylint linter
run: pipenv run pytest python/aswfdocker --doctest-modules --pylint --junitxml=test-pylint-results.xml --cov=. --cov-report=xml
- name: Fetch unshallow to help sonar
run: git fetch --unshallow
- name: Install and Run Sonar Scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
export SONAR_SCANNER_VERSION=4.2.0.1873
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
export SONAR_SCANNER_OPTS="-server"
sonar-scanner \
-Dsonar.organization=academysoftwarefoundation \
-Dsonar.projectKey=AcademySoftwareFoundation_aswf_docker \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectDate=`git log $tag -n 1 --date=short --pretty="%ad"` \
-Dsonar.projectVersion=`pipenv run python setup.py --version`