From 05811ed4b4b9c3b254328296e69b10004b50066d Mon Sep 17 00:00:00 2001 From: Doug Addy Date: Wed, 23 Feb 2022 16:32:03 +0000 Subject: [PATCH 1/8] Remove tests from sonarcloud analysis --- .github/workflows/ci_cd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f64e6b1d..5cf32fa2 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -123,6 +123,9 @@ jobs: -Dsonar.organization=pyansys-test -Dsonar.projectKey=pyansys-test-openapi-common -Dsonar.python.version=3.7,3.8,3.9,3.10 + -Dsonar.sources=src/ + -Dsonar.test.exclusions=tests/** + -Dsonar.tests=tests/ build: name: Build From b6e5b9fd619116b3fd1fe1961e502a695f6b950e Mon Sep 17 00:00:00 2001 From: Doug Addy Date: Thu, 24 Feb 2022 11:02:08 +0000 Subject: [PATCH 2/8] Use config from example as test --- .github/workflows/ci_cd.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 5cf32fa2..4d34855a 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -111,7 +111,7 @@ jobs: - name: List coverage reports run: | cd ~/coverage-reports - cp ./**/coverage*.xml ./ + cp ./**/coverage*.xml ~/ - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master @@ -122,10 +122,11 @@ jobs: args: > -Dsonar.organization=pyansys-test -Dsonar.projectKey=pyansys-test-openapi-common - -Dsonar.python.version=3.7,3.8,3.9,3.10 - -Dsonar.sources=src/ - -Dsonar.test.exclusions=tests/** - -Dsonar.tests=tests/ + -Dsonar.python.version=3 + -Dsonar.sources=src + -Dsonar.python.coverage.reportPaths=coverage*.xml + -Dsonar.core.codeCoveragePlugin=cobertura + -Dsonar.dynamicAnalysis=reuseReports build: name: Build From c08f8aaa7258deaade9feba6892f2fd2db32e003 Mon Sep 17 00:00:00 2001 From: Doug Addy Date: Thu, 24 Feb 2022 11:16:07 +0000 Subject: [PATCH 3/8] Strip paths from coverage references --- .github/workflows/ci_cd.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 4d34855a..eccfd83a 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -81,7 +81,9 @@ jobs: run: tox -- --with-kerberos - name: Append python version to coverage data - run: mv ./coverage.xml ./coverage.${{ matrix.python-version }}.xml + run: | + sed -i 's/\.tox\/py[0-9]\+\/lib\/python3\.[0-9]\+\/site-packages/g' coverage.xml + mv ./coverage.xml ./coverage.${{ matrix.python-version }}.xml - name: Store coverage data uses: actions/upload-artifact@v2 From f51cbd0e5acebc3bf4765a1ce3b6743835d3ae02 Mon Sep 17 00:00:00 2001 From: Doug Addy Date: Thu, 24 Feb 2022 11:16:28 +0000 Subject: [PATCH 4/8] Add debug print --- .github/workflows/ci_cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index eccfd83a..4aed51e7 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -83,6 +83,7 @@ jobs: - name: Append python version to coverage data run: | sed -i 's/\.tox\/py[0-9]\+\/lib\/python3\.[0-9]\+\/site-packages/g' coverage.xml + cat coverage.xml mv ./coverage.xml ./coverage.${{ matrix.python-version }}.xml - name: Store coverage data From b86a944758b4309c204eaed68575f704c300d48f Mon Sep 17 00:00:00 2001 From: Doug Addy Date: Thu, 24 Feb 2022 11:29:31 +0000 Subject: [PATCH 5/8] Correct sed path --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 4aed51e7..4098e120 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -82,7 +82,7 @@ jobs: - name: Append python version to coverage data run: | - sed -i 's/\.tox\/py[0-9]\+\/lib\/python3\.[0-9]\+\/site-packages/g' coverage.xml + sed -i 's/\.tox\/py[0-9]\+\/lib\/python3\.[0-9]\+\/site-packages/src/g' coverage.xml cat coverage.xml mv ./coverage.xml ./coverage.${{ matrix.python-version }}.xml From 8b3cd31e1bb691631614f91c9e51d84d8d345ef4 Mon Sep 17 00:00:00 2001 From: Doug Addy Date: Thu, 24 Feb 2022 11:42:10 +0000 Subject: [PATCH 6/8] Add rewrite for package name --- .github/workflows/ci_cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 4098e120..2fdb1813 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -83,7 +83,7 @@ jobs: - name: Append python version to coverage data run: | sed -i 's/\.tox\/py[0-9]\+\/lib\/python3\.[0-9]\+\/site-packages/src/g' coverage.xml - cat coverage.xml + sed -i 's/\.tox\.py3[0-9]\+\.lib\.python3\.[0-9]\+\.site-packages\.//g' coverage.xml mv ./coverage.xml ./coverage.${{ matrix.python-version }}.xml - name: Store coverage data @@ -113,8 +113,8 @@ jobs: - name: List coverage reports run: | - cd ~/coverage-reports - cp ./**/coverage*.xml ~/ + cp ~/coverage-reports/**/coverage*.xml ~/ + ls - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master From 8389d37d9d9d73f9e9450130c4146a638da6fee6 Mon Sep 17 00:00:00 2001 From: Doug Addy Date: Thu, 24 Feb 2022 11:55:42 +0000 Subject: [PATCH 7/8] Copy reports to the checkout dir --- .github/workflows/ci_cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 2fdb1813..05f4401d 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -109,11 +109,11 @@ jobs: - uses: actions/download-artifact@v2 with: - path: ~/coverage-reports + path: coverage-reports - name: List coverage reports run: | - cp ~/coverage-reports/**/coverage*.xml ~/ + cp coverage-reports/**/coverage*.xml ./ ls - name: SonarCloud Scan From 0daba70c991dfbc1a146fa7474b604bb43d156ed Mon Sep 17 00:00:00 2001 From: Doug Addy Date: Thu, 24 Feb 2022 12:32:51 +0000 Subject: [PATCH 8/8] Remove debug output and update step names --- .github/workflows/ci_cd.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 05f4401d..b1722f42 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -80,7 +80,7 @@ jobs: - name: Test with tox run: tox -- --with-kerberos - - name: Append python version to coverage data + - name: Remove platform-specific paths and append platform to coverage file name run: | sed -i 's/\.tox\/py[0-9]\+\/lib\/python3\.[0-9]\+\/site-packages/src/g' coverage.xml sed -i 's/\.tox\.py3[0-9]\+\.lib\.python3\.[0-9]\+\.site-packages\.//g' coverage.xml @@ -114,12 +114,11 @@ jobs: - name: List coverage reports run: | cp coverage-reports/**/coverage*.xml ./ - ls - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} with: args: >