From 2cf722cd46daad30e613e3c11f293ba0bb2b9790 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 29 Feb 2020 13:38:50 +0100 Subject: [PATCH] Improve sonar cloud feedback speed --- .github/workflows/package.yml | 49 ++++++++++++++++++----------------- sonar-project.properties | 2 +- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index f754379..81b75e2 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -6,6 +6,30 @@ on: types: [created] jobs: + sonarCloudTrigger: + name: SonarCloud Trigger + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1.1.1 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install + - name: Test with pytest + run: | + poetry run coverage run --source=ofx_processor -m pytest --color=yes + poetry run coverage xml + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@v1.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + build: name: Python ${{ matrix.python-version }} / ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -29,30 +53,7 @@ jobs: poetry install - name: Test with pytest run: | - 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 }} + poetry run pytest --color=yes publish: name: Publish to PyPI diff --git a/sonar-project.properties b/sonar-project.properties index 54088c2..c6bb9be 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -4,4 +4,4 @@ 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 +sonar.python.coverage.reportPaths=coverage.xml