Skip to content

Commit b0abbfd

Browse files
committed
Trying to get sonarcloud PR working
Signed-off-by: Aloys Baillet <aloys.baillet+github@gmail.com>
1 parent 0dfc855 commit b0abbfd

File tree

2 files changed

+17
-69
lines changed

2 files changed

+17
-69
lines changed

.github/workflows/python-sonar.yml

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Test Python aswfdocker Library - Sonar
22

33
on:
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

812
jobs:
913
sonar:
@@ -12,7 +16,8 @@ jobs:
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`

.github/workflows/python.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)