Add debug steps #325
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - branch-* | |
| pull_request: | |
| merge_group: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| get-build-number: | |
| outputs: | |
| BUILD_NUMBER: ${{ steps.get-build-number.outputs.BUILD_NUMBER }} | |
| runs-on: sonar-xs-public | |
| name: Get build number | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: SonarSource/ci-github-actions/get-build-number@master # dogfood | |
| id: get-build-number | |
| build: | |
| runs-on: sonar-s-public | |
| name: Build | |
| permissions: | |
| id-token: write | |
| contents: write | |
| attestations: write | |
| needs: get-build-number | |
| env: | |
| BUILD_NUMBER: ${{ needs.get-build-number.outputs.BUILD_NUMBER }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Debug - Download Maven from Apache Archive | |
| run: | | |
| echo "Downloading Maven from Apache Archive..." | |
| curl -fsSL -o /tmp/apache-maven-3.9.10-bin.tar.gz https://archive.apache.org/dist/maven/maven-3/3.9.10/binaries/apache-maven-3.9.10-bin.tar.gz | |
| echo "Download completed successfully" | |
| ls -la /tmp/apache-maven-3.9.10-bin.tar.gz | |
| - uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0 | |
| with: | |
| version: 2025.7.12 | |
| - name: Build, Analyze and deploy | |
| id: build | |
| uses: SonarSource/ci-github-actions/build-gradle@master # dogfood | |
| with: | |
| deploy-pull-request: true | |
| artifactory-reader-role: private-reader | |
| artifactory-deployer-role: qa-deployer | |
| use-develocity: true | |
| provenance: 'true' | |
| - name: verify build-gradle behavior | |
| env: | |
| DEPLOYED: ${{ steps.build.outputs.deployed }} | |
| run: | | |
| if [[ "$DEPLOYED" != "true" ]]; then | |
| echo "ERROR: steps.build.outputs.deployed is not true" | |
| exit 1 | |
| fi | |
| - name: QA test | |
| shell: bash | |
| env: | |
| SONARSOURCE_REPOSITORY: sonarsource-qa | |
| run: | | |
| # Removing local artifacts to showcase downloading from sonarsource-qa | |
| ./gradlew --stop | |
| rm -rf ~/.gradle/caches/modules-2/files-2.1/org.sonarsource.sonarqube/sonar-plugin-api/ | |
| echo "Running QA tests against $ARTIFACTORY_URL/$SONARSOURCE_REPOSITORY..." | |
| ./gradlew test --info --no-scan | tee qa-test.log | |
| grep "Downloading https://repox.jfrog.io/artifactory/sonarsource-qa/org/sonarsource/sonarqube/sonar-plugin-api/" qa-test.log | |
| test-working-directory: | |
| runs-on: sonar-s-public | |
| name: Test with working-directory | |
| permissions: | |
| id-token: write | |
| contents: write | |
| needs: | |
| - get-build-number | |
| - build | |
| env: | |
| BUILD_NUMBER: ${{ needs.get-build-number.outputs.BUILD_NUMBER }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| path: subdir | |
| - name: Workaround for setup-gradle which has no working-directory input | |
| run: | | |
| cp subdir/mise.toml mise.toml | |
| - uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0 | |
| with: | |
| version: 2025.7.12 | |
| - uses: SonarSource/ci-github-actions/config-gradle@master # dogfood | |
| with: | |
| use-develocity: false | |
| artifactory-reader-role: private-reader | |
| working-directory: subdir | |
| - working-directory: subdir | |
| run: ./gradlew test | |
| build-windows: | |
| runs-on: warp-custom-windows-2022-s | |
| name: Build Windows | |
| permissions: | |
| id-token: write | |
| contents: write | |
| attestations: write | |
| needs: get-build-number | |
| env: | |
| BUILD_NUMBER: ${{ needs.get-build-number.outputs.BUILD_NUMBER }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0 | |
| with: | |
| version: 2025.7.12 | |
| - uses: SonarSource/ci-github-actions/build-gradle@master # dogfood | |
| id: build | |
| with: | |
| deploy: false | |
| artifactory-reader-role: private-reader | |
| artifactory-deployer-role: qa-deployer | |
| use-develocity: true | |
| provenance: 'true' | |
| - name: verify build-gradle behavior | |
| shell: bash | |
| env: | |
| DEPLOYED: ${{ steps.build.outputs.deployed }} | |
| run: | | |
| if [[ "$DEPLOYED" = "true" ]]; then | |
| echo "ERROR: steps.build.outputs.deployed is true" | |
| exit 1 | |
| fi | |
| promote: | |
| needs: | |
| - get-build-number | |
| - build | |
| - build-windows | |
| - test-working-directory | |
| runs-on: github-ubuntu-latest-s | |
| name: Promote | |
| permissions: | |
| id-token: write | |
| contents: write | |
| env: | |
| BUILD_NUMBER: ${{ needs.get-build-number.outputs.BUILD_NUMBER }} | |
| steps: | |
| - uses: SonarSource/ci-github-actions/promote@master # dogfood | |
| with: | |
| promote-pull-request: true |