From e5251a64485f38e40ef3b07ede3f315949b03c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Tue, 10 Oct 2023 11:37:36 +0200 Subject: [PATCH] New sonarcloud PR workflow --- .github/workflows/sonarcloud.yml | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 000000000000..1ffad6d5e909 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,54 @@ +name: Sonarcloud analysis + +on: + push: + branches: + - master + paths: + - 'java/**.java' + - 'java/**.xml' + - '**.py' + - 'web/html/src/**.ts' + - 'web/html/src/**.tsx' + pull_request: + paths: + - 'java/**.java' + - 'java/**.xml' + - '**.py' + - 'web/html/src/**.ts' + - 'web/html/src/**.tsx' + +jobs: + sonarcloud: + runs-on: ubuntu-latest + container: registry.opensuse.org/systemsmanagement/uyuni/master/docker/containers/uyuni-master-pgsql:latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Cache dependencies + id: cache-dependencies + uses: actions/cache@v3 + with: + path: java/lib + key: ${{ runner.os }}-java-lib-${{ hashFiles('java/buildconf/ivy/*.*') }} + + - name: Resolve dependencies + if: steps.cache-dependencies.outputs.cache-hit != 'true' + run: | + ant -f java/manager-build.xml ivy + + - name: Compile Java + run: ant -f java/manager-build.xml compile + + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONARQUBE_AUTH_UYUNI }} + args: > + -Dsonar.junit.reportPaths="" + -Dsonar.coverage.jacoco.xmlReportPaths="" + -Dsonar.pullrequest.key=${{ github.event.number }} + -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} + -Dsonar.pullrequest.base=${{ github.base_ref }}