Add SonarCloud analysis and upgrade action versions

This commit is contained in:
Gabriel Augendre 2020-02-28 20:43:56 +01:00
parent ad2d7efe94
commit 2b462347f8
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
2 changed files with 35 additions and 9 deletions

View file

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

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