|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - branch-* |
| 8 | + - dogfood-* |
| 9 | + pull_request: |
| 10 | + workflow_dispatch: |
| 11 | + schedule: |
| 12 | + - cron: "30 1 * * *" # Run daily at 1:30 AM UTC |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: github-ubuntu-latest-s # Public repository runner |
| 21 | + name: Build |
| 22 | + permissions: |
| 23 | + id-token: write # Required for Vault OIDC authentication |
| 24 | + contents: write # Required for repository access and tagging |
| 25 | + outputs: |
| 26 | + build-number: ${{ steps.build-step.outputs.BUILD_NUMBER }} |
| 27 | + deployed: ${{ steps.build-step.outputs.deployed }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 30 | + - uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0 |
| 31 | + with: |
| 32 | + version: 2025.7.12 |
| 33 | + - uses: SonarSource/ci-github-actions/build-gradle@v1 |
| 34 | + id: build-step |
| 35 | + with: |
| 36 | + deploy-pull-request: true |
| 37 | + artifactory-reader-role: private-reader # Override for public repo using private access |
| 38 | + artifactory-deployer-role: qa-deployer # Override for public repo using private access |
| 39 | + |
| 40 | + qa: |
| 41 | + needs: [build] |
| 42 | + if: ${{ needs.build.outputs.deployed }} |
| 43 | + runs-on: github-ubuntu-latest-s # Public repository runner |
| 44 | + permissions: |
| 45 | + id-token: write # Required for Vault OIDC authentication |
| 46 | + contents: read # Required for repository access |
| 47 | + strategy: |
| 48 | + fail-fast: false |
| 49 | + matrix: |
| 50 | + # Plugin tests check API compatibility, so they should run against all supported versions. |
| 51 | + # Ruling tests check only that the results of analysis have not changed, |
| 52 | + # so one sonar.runtimeVersion is enough. |
| 53 | + item: |
| 54 | + - { suite: "plugin", sq_version: "DEV", submodules: false} |
| 55 | + - { suite: "plugin", sq_version: "LATEST_RELEASE", submodules: false} |
| 56 | + - { suite: "ruling", sq_version: "LATEST_RELEASE" } |
| 57 | + name: "QA Tests [${{ matrix.item.suite }}] - SQ : ${{ matrix.item.sq_version }}" |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 60 | + with: |
| 61 | + submodules: ${{ matrix.item.suite == 'ruling' }} |
| 62 | + - name: Remove kotlin ITs as they are not relevant for ruling tests (and cause issues with wrapper validation) |
| 63 | + if: ${{ matrix.item.suite == 'ruling' }} |
| 64 | + run: rm -r ./its/sources/kotlin |
| 65 | + - uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0 |
| 66 | + with: |
| 67 | + version: 2025.7.12 |
| 68 | + - name: Get GitHub Token for QA Licenses |
| 69 | + id: secrets |
| 70 | + uses: SonarSource/vault-action-wrapper@v3 |
| 71 | + with: |
| 72 | + secrets: | |
| 73 | + development/github/token/licenses-ro token | GITHUB_TOKEN; |
| 74 | + development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ARTIFACTORY_ACCESS_TOKEN; |
| 75 | + - name: Configure Gradle |
| 76 | + uses: SonarSource/ci-github-actions/build-gradle@v1 |
| 77 | + with: |
| 78 | + gradle-args: "-x build -x sonar -x artifactoryPublish" # Skip everything to only configure Gradle and Artifactory access |
| 79 | + artifactory-reader-role: private-reader |
| 80 | + artifactory-deployer-role: qa-deployer |
| 81 | + - name: Run QA Tests |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }} |
| 84 | + ARTIFACTORY_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ACCESS_TOKEN }} |
| 85 | + SUITE: ${{ matrix.item.suite }} |
| 86 | + SQ_VERSION: ${{ matrix.item.sq_version }} |
| 87 | + run: | |
| 88 | + ./gradlew ":its:${SUITE}:test" --project-prop ${SUITE} \ |
| 89 | + "-Dsonar.runtimeVersion=${SQ_VERSION}" \ |
| 90 | + "-Dorchestrator.artifactory.accessToken=${ARTIFACTORY_ACCESS_TOKEN}" \ |
| 91 | + "-DbuildNumber=${BUILD_NUMBER}" \ |
| 92 | + --info --stacktrace --console plain --no-daemon --build-cache |
| 93 | + promote: |
| 94 | + name: Promote |
| 95 | + needs: |
| 96 | + - build |
| 97 | + - qa |
| 98 | + runs-on: github-ubuntu-latest-s # Public repository runner |
| 99 | + if: ${{ needs.build.outputs.deployed }} |
| 100 | + permissions: |
| 101 | + id-token: write # Required for Vault OIDC authentication |
| 102 | + contents: write # Required for repository access and tagging |
| 103 | + steps: |
| 104 | + - uses: SonarSource/ci-github-actions/promote@v1 |
| 105 | + with: |
| 106 | + promote-pull-request: true # Enable PR artifact promotion |
0 commit comments