Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions .github/workflows/python-sonar.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
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
Expand All @@ -35,25 +42,26 @@ jobs:
- name: Run prospector linter
run: pipenv run prospector -F python/aswfdocker --output-format xunit > test-prospector-results.xml

- name: Fetch unshallow to help sonar
run: git fetch --unshallow
- name: Publish Unit Test Results
uses: EnricoMi/[email protected]
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: Install and Run Sonar Scanner
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
if: always()
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`
with:
args: >
-Dsonar.projectDate=${{ env.SONAR_PROJECT_VERSION }}
-Dsonar.projectVersion=${{ env.SONAR_PROJECT_DATE }}
25 changes: 0 additions & 25 deletions .github/workflows/python.yml

This file was deleted.