From 2b462347f8af0d12ad628dfd3786b95a6044abe1 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Fri, 28 Feb 2020 20:43:56 +0100 Subject: [PATCH] Add SonarCloud analysis and upgrade action versions --- .github/workflows/package.yml | 37 ++++++++++++++++++++++++++--------- sonar-project.properties | 7 +++++++ 2 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 471151a..f754379 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -2,9 +2,6 @@ name: Test & publish on: push: - branches: - - master - pull_request: release: types: [created] @@ -20,9 +17,9 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v1.1.1 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -32,8 +29,30 @@ jobs: poetry install - name: Test with pytest run: | - poetry run coverage run --source=. -m pytest --color=yes - poetry run coverage report + poetry run coverage run --source=ofx_processor -m pytest --color=yes + poetry run coverage xml + - name: Coverage report upload + uses: actions/upload-artifact@v1 + with: + name: coverage_${{ matrix.os }}_${{ matrix.python-version }} + path: coverage.xml + + sonarCloudTrigger: + name: SonarCloud Trigger + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Download coverage report + uses: actions/download-artifact@v1 + with: + name: coverage_ubuntu-latest_3.8 + path: coverage-reports + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@v1.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} publish: name: Publish to PyPI @@ -41,9 +60,9 @@ jobs: needs: build if: github.event_name == 'release' steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v1.1.1 with: python-version: '3.8' - name: Install dependencies diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..54088c2 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,7 @@ +sonar.organization=crocmagnon +sonar.projectKey=Crocmagnon_ofx-processor + +# relative paths to source directories. More details and properties are described +# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/ +sonar.sources=ofx_processor +sonar.python.coverage.reportPaths=coverage-reports/coverage.xml