This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
Update sonar.yml #3
This file contains 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: Sonar analysis for long-lived branches | |
on: | |
push: | |
branches: | |
- main | |
- candlepin-*-HOTFIX | |
- feature/* | |
workflow_dispatch: | |
inputs: | |
branch-name: | |
description: 'The name of the branch to analyze' | |
required: true | |
default: 'main' | |
type: string | |
env: | |
JAVA_DISTRIBUTION: 'temurin' | |
JAVA_VERSION: '17' | |
# Cancel in-progress sonar branch analysis workflows. We only care about analyzing the latest commit. | |
concurrency: | |
group: ${{ github.workflow }}-${{ inputs.branch-name || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
branch_sonar_analysis: | |
name: long-lived branch sonar analysis | |
runs-on: ubuntu-latest | |
container: | |
image: fedora:38 | |
steps: | |
- name: Mask secrets | |
shell: bash | |
run: | | |
echo "::add-mask::${{ secrets.GITHUB_TOKEN }}" | |
echo "::add-mask::${{ secrets.SONAR_TOKEN }}" | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
shell: bash | |
run: dnf --setopt install_weak_deps=False install -y gettext | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Run unit tests & Analyze | |
uses: gradle/gradle-build-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
arguments: test coverage sonar | |
-Dsonar.branch.name=${{ inputs.branch-name || github.ref_name }} | |
-Dorg.gradle.jvmargs=-Xmx1g |