From 809877c7dbea390580b1dc43389d4bbc54ec432a Mon Sep 17 00:00:00 2001 From: Dan Lu Date: Thu, 9 May 2024 12:39:33 -0700 Subject: [PATCH 1/9] remove SonarCloud's dependency on test job --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2fa82f8a9..88ee06f11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -206,7 +206,6 @@ jobs: path: coverage.xml sonarcloud: - needs: [test] name: SonarCloud runs-on: ubuntu-20.04 steps: @@ -222,6 +221,7 @@ jobs: run: sed -i "s/\/home\/runner\/work\/synapsePythonClient<\/source>/\/github\/workspace<\/source>/g" coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master + if: ${{ always() }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 85ebaf7c1c9b7631cdcd56b372d702a83215246a Mon Sep 17 00:00:00 2001 From: Dan Lu <90745557+danlu1@users.noreply.github.com> Date: Thu, 9 May 2024 15:15:06 -0700 Subject: [PATCH 2/9] Update build.yml Download coverage report only when it's available. --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88ee06f11..8ac1f81f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -199,6 +199,7 @@ jobs: path: tests/integration/otel_spans_integration_testing_*.ndjson if-no-files-found: ignore - name: Upload coverage report + id: upload_converage_report uses: actions/upload-artifact@v2 if: ${{ contains(fromJSON('["3.9"]'), matrix.python) && contains(fromJSON('["ubuntu-20.04"]'), matrix.os)}} with: @@ -214,10 +215,12 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Download coverage report uses: actions/download-artifact@v2 + if: steps.upload_converage_report.outputs.exists = true with: name: coverage-report # This is a workaround described in https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057 - name: Override Coverage Source Path for Sonar + if: ${{ success() }} run: sed -i "s/\/home\/runner\/work\/synapsePythonClient<\/source>/\/github\/workspace<\/source>/g" coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master From 2be242a7f2ae07723963bc231ca87eaaa7450825 Mon Sep 17 00:00:00 2001 From: Dan Lu Date: Thu, 9 May 2024 15:22:22 -0700 Subject: [PATCH 3/9] add needs test back for sonarcloud job --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88ee06f11..66f57545a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -199,6 +199,7 @@ jobs: path: tests/integration/otel_spans_integration_testing_*.ndjson if-no-files-found: ignore - name: Upload coverage report + id: upload_converage_report uses: actions/upload-artifact@v2 if: ${{ contains(fromJSON('["3.9"]'), matrix.python) && contains(fromJSON('["ubuntu-20.04"]'), matrix.os)}} with: @@ -206,6 +207,7 @@ jobs: path: coverage.xml sonarcloud: + needs: [test] name: SonarCloud runs-on: ubuntu-20.04 steps: @@ -214,10 +216,12 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Download coverage report uses: actions/download-artifact@v2 + if: steps.upload_converage_report.outputs.exists == 'true' with: name: coverage-report # This is a workaround described in https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057 - name: Override Coverage Source Path for Sonar + if: ${{ success() }} run: sed -i "s/\/home\/runner\/work\/synapsePythonClient<\/source>/\/github\/workspace<\/source>/g" coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master From 8bb46ee64f4719f23e5a39c50bd6c379ec6f7641 Mon Sep 17 00:00:00 2001 From: Dan Lu Date: Thu, 9 May 2024 15:29:07 -0700 Subject: [PATCH 4/9] add quote for true --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ea25c2bb..929182a97 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -216,7 +216,7 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Download coverage report uses: actions/download-artifact@v2 - if: steps.upload_converage_report.outputs.exists = true + if: steps.upload_converage_report.outputs.exists = "true" with: name: coverage-report # This is a workaround described in https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057 From dbf768c8966e2a34234cf64701d20c42bd490faa Mon Sep 17 00:00:00 2001 From: Dan Lu Date: Thu, 9 May 2024 15:35:07 -0700 Subject: [PATCH 5/9] fix typo --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 929182a97..488065e18 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -216,7 +216,7 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Download coverage report uses: actions/download-artifact@v2 - if: steps.upload_converage_report.outputs.exists = "true" + if: steps.upload_converage_report.outputs.exists == "true" with: name: coverage-report # This is a workaround described in https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057 From 30b48632e89217b71322af1f479fb578b3960adf Mon Sep 17 00:00:00 2001 From: Dan Lu Date: Thu, 9 May 2024 16:12:23 -0700 Subject: [PATCH 6/9] fix typo --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 488065e18..48e51c7dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -199,7 +199,7 @@ jobs: path: tests/integration/otel_spans_integration_testing_*.ndjson if-no-files-found: ignore - name: Upload coverage report - id: upload_converage_report + id: upload_coverage_report uses: actions/upload-artifact@v2 if: ${{ contains(fromJSON('["3.9"]'), matrix.python) && contains(fromJSON('["ubuntu-20.04"]'), matrix.os)}} with: @@ -216,7 +216,7 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Download coverage report uses: actions/download-artifact@v2 - if: steps.upload_converage_report.outputs.exists == "true" + if: steps.upload_coverage_report.outputs.exists == "true" with: name: coverage-report # This is a workaround described in https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057 From 97e35da8c0b02fb9bfe70f559e633d40d52c7214 Mon Sep 17 00:00:00 2001 From: Dan Lu Date: Thu, 9 May 2024 17:13:18 -0700 Subject: [PATCH 7/9] add a seperate step to check the existence of coverage report --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48e51c7dd..7ca62a42f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -214,9 +214,14 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Check coverage report existence + id: check_coverage_report + uses: andstor/file-existence-action@v3 + with: + files: "coverage.xml" - name: Download coverage report uses: actions/download-artifact@v2 - if: steps.upload_coverage_report.outputs.exists == "true" + if: steps.check_coverage_report.outputs.files_exists == "true" with: name: coverage-report # This is a workaround described in https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057 From afe91dfc3bd31e838b83ebdd36772b7d1dca9795 Mon Sep 17 00:00:00 2001 From: Dan Lu <90745557+danlu1@users.noreply.github.com> Date: Thu, 9 May 2024 17:57:42 -0700 Subject: [PATCH 8/9] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ca62a42f..855176e59 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -221,7 +221,7 @@ jobs: files: "coverage.xml" - name: Download coverage report uses: actions/download-artifact@v2 - if: steps.check_coverage_report.outputs.files_exists == "true" + if: steps.check_coverage_report.outputs.files_exists == 'true' with: name: coverage-report # This is a workaround described in https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057 From e586e32bf0370b65ff973dfe452e6ed44e3d8276 Mon Sep 17 00:00:00 2001 From: Dan Lu <90745557+danlu1@users.noreply.github.com> Date: Thu, 9 May 2024 20:54:40 -0700 Subject: [PATCH 9/9] Update .github/workflows/build.yml Co-authored-by: BryanFauble <17128019+BryanFauble@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 855176e59..554ed84f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -226,7 +226,7 @@ jobs: name: coverage-report # This is a workaround described in https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057 - name: Override Coverage Source Path for Sonar - if: ${{ success() }} + if: steps.check_coverage_report.outputs.files_exists == 'true' run: sed -i "s/\/home\/runner\/work\/synapsePythonClient<\/source>/\/github\/workspace<\/source>/g" coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master