11name : Test Python aswfdocker Library - Sonar
22
33on :
4+ # Trigger analysis when pushing in master or pull requests, and when creating
5+ # a pull request.
46 push :
57 branches :
68 - master
9+ pull_request :
10+ types : [opened, synchronize, reopened]
711
812jobs :
913 sonar :
1216 steps :
1317 - uses : actions/checkout@v2
1418 with :
15- fetch-depth : 50
19+ # Disabling shallow clone is recommended for improving relevancy of reporting
20+ fetch-depth : 0
1621
1722 - name : Set up Python
1823 uses : actions/setup-python@v2
@@ -37,32 +42,18 @@ jobs:
3742 - name : Run prospector linter
3843 run : pipenv run prospector -F python/aswfdocker --output-format xunit > test-prospector-results.xml
3944
40- - name : Install and Run Sonar Scanner
45+ - name : SonarCloud Scan
46+ uses : sonarsource/sonarcloud-github-action@master
47+ if : always()
4148 env :
4249 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4350 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
44- run : |
45- export SONAR_SCANNER_VERSION=4.2.0.1873
46- export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
47- 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
48- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
49- export PATH=$SONAR_SCANNER_HOME/bin:$PATH
50- export SONAR_SCANNER_OPTS="-server"
51- sonar-scanner \
52- -Dsonar.organization=academysoftwarefoundation \
53- -Dsonar.projectKey=AcademySoftwareFoundation_aswf_docker \
54- -Dsonar.sources=. \
55- -Dsonar.host.url=https://sonarcloud.io \
56- -Dsonar.login=$SONAR_TOKEN \
57- -Dsonar.projectDate=`git log $tag -n 1 --date=short --pretty="%ad"` \
58- -Dsonar.projectVersion=`pipenv run python setup.py --version`
59- if : always()
60-
61- - uses : testspace-com/setup-testspace@v1
6251 with :
63- domain : aloysbaillet
64-
65- - name : Push result to Testspace server
66- run : |
67- testspace test*.xml
68- if : always()
52+ args : >
53+ -Dsonar.organization=academysoftwarefoundation
54+ -Dsonar.projectKey=AcademySoftwareFoundation_aswf_docker
55+ -Dsonar.sources=.
56+ -Dsonar.host.url=https://sonarcloud.io
57+ -Dsonar.login=$SONAR_TOKEN
58+ -Dsonar.projectDate=`git log $tag -n 1 --date=short --pretty="%ad"`
59+ -Dsonar.projectVersion=`pipenv run python setup.py --version`
0 commit comments