From daf7a2901ceb76e77bdfb8b83dbe4acccdfa47fd Mon Sep 17 00:00:00 2001 From: Alexander Saprykin Date: Mon, 7 Oct 2024 17:33:52 +0200 Subject: [PATCH] SonarCloud CI-based analysis No-Issue --- .github/workflows/ci_full.yml | 34 ++++++++++++------- MANIFEST.in | 2 +- ...oud.properties => sonar-project.properties | 5 +++ 3 files changed, 27 insertions(+), 14 deletions(-) rename .sonarcloud.properties => sonar-project.properties (56%) diff --git a/.github/workflows/ci_full.yml b/.github/workflows/ci_full.yml index b882fc423b..2b06f5372d 100644 --- a/.github/workflows/ci_full.yml +++ b/.github/workflows/ci_full.yml @@ -1,6 +1,10 @@ --- name: galaxy_ng/ci -on: {pull_request: {branches: ['**']}, push: {branches: ['**']}} +on: + pull_request: + branches: ['**'] + push: + branches: ['**'] jobs: @@ -73,18 +77,22 @@ jobs: - name: run the unit test playbook run: cd dev/playbooks; ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook -i 'localhost,' --forks=1 -v run_unit_tests.yaml + - name: copy coverage report + run: | + docker cp pulp:/tmp/galaxy_ng-test-results.xml coverage.xml + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + SONAR_TOKEN: ${{ secrets.CICD_ORG_SONAR_TOKEN_CICD_BOT }} + - name: upload jUnit XML test results if: github.event_name == 'push' && github.repository == 'ansible/galaxy_ng' && github.ref_name == 'master' continue-on-error: true - run: >- - docker exec pulp /bin/bash -c 'curl -v --user "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}" - --form "xunit_xml=@/tmp/galaxy_ng-test-results.xml" - --form "component_name=hub" - --form "git_commit_sha=${{ github.sha }}" - --form "git_repository_url=https://github.com/${{ github.repository }}" - "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/"' - - - # FIXME: do we really care about these anymore ... ? - #- name: run the functional test playbook - # run: cd dev/playbooks; ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook -i 'localhost,' --forks=1 -v run_functional_tests.yaml + run: | + curl -v --user "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}" \ + --form "xunit_xml=@coverage.xml" \ + --form "component_name=hub" \ + --form "git_commit_sha=${{ github.sha }}" \ + --form "git_repository_url=https://github.com/${{ github.repository }}" \ + "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/" diff --git a/MANIFEST.in b/MANIFEST.in index e834ee7734..ff3d32f317 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -23,6 +23,6 @@ include galaxy_ng/tests/integration/utils/gpg/collection_sign.sh include galaxy_ng/tests/integration/utils/gpg/qe-sign-priv.gpg include galaxy-operator/bin/readyz.py exclude .coveragerc -exclude .sonarcloud.properties +exclude sonar-project.properties exclude aap_compose_dev.yaml prune .tekton diff --git a/.sonarcloud.properties b/sonar-project.properties similarity index 56% rename from .sonarcloud.properties rename to sonar-project.properties index 061c5c6398..db1e248f91 100644 --- a/.sonarcloud.properties +++ b/sonar-project.properties @@ -1,3 +1,6 @@ +sonar.projectKey = ansible_galaxy_ng +sonar.organization = ansible + sonar.sources = galaxy_ng sonar.exclusions = \ galaxy_ng/tests/**, \ @@ -6,3 +9,5 @@ sonar.exclusions = \ sonar.tests = galaxy_ng/tests sonar.python.version = 3.11 + +sonar.python.coverage.reportPaths = coverage.xml