Configure sonar build #6
Workflow file for this run
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: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
matrix-build: | |
strategy: | |
matrix: | |
java: [23] | |
os: ['ubuntu-latest', 'macos-latest'] | |
runs-on: ${{ matrix.os }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-os-${{ matrix.os }}-java-${{ matrix.java }} | |
cancel-in-progress: true | |
name: "Build on ${{ matrix.os }} with Java ${{ matrix.java }}" | |
env: | |
DEFAULT_JAVA: 23 | |
DEFAULT_OS: 'ubuntu-latest' | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ matrix.java }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build with Java ${{ matrix.java }} | |
run: ./gradlew build --info --warning-mode=all -PjavaVersion=${{ matrix.java }} | |
- name: Sonar analysis | |
if: ${{ env.DEFAULT_JAVA == matrix.java && env.DEFAULT_OS == matrix.os && env.SONAR_TOKEN != null }} | |
run: | | |
./gradlew sonarqube -Dsonar.token=$SONAR_TOKEN --info --warning-mode=all -PjavaVersion=${{ matrix.java }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Archive native lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: native-lib-${{ matrix.os }} | |
path: build/lua-libs/ | |
if-no-files-found: error | |
retention-days: 5 | |
build: | |
needs: matrix-build | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Build successful" | |