Merge pull request #3 from Crocmagnon/add-sonar

Add SonarCloud analysis
This commit is contained in:
Gabriel Augendre 2020-02-28 21:48:32 +01:00 committed by GitHub
commit c4d6578057
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 9 deletions

View file

@ -2,9 +2,6 @@ name: Test & publish
on: on:
push: push:
branches:
- master
pull_request:
release: release:
types: [created] types: [created]
@ -20,9 +17,9 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1 uses: actions/setup-python@v1.1.1
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install dependencies - name: Install dependencies
@ -32,8 +29,30 @@ jobs:
poetry install poetry install
- name: Test with pytest - name: Test with pytest
run: | run: |
poetry run coverage run --source=. -m pytest --color=yes poetry run coverage run --source=ofx_processor -m pytest --color=yes
poetry run coverage report 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: publish:
name: Publish to PyPI name: Publish to PyPI
@ -41,9 +60,9 @@ jobs:
needs: build needs: build
if: github.event_name == 'release' if: github.event_name == 'release'
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v1 uses: actions/setup-python@v1.1.1
with: with:
python-version: '3.8' python-version: '3.8'
- name: Install dependencies - name: Install dependencies

7
sonar-project.properties Normal file
View file

@ -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