Skip to content

Issue #502: update to LTS 9.9; cleanup deprecations #2

Issue #502: update to LTS 9.9; cleanup deprecations

Issue #502: update to LTS 9.9; cleanup deprecations #2

name: sonarqube-workflows
on:
push:
branches:
- master
pull_request:
jobs:
build-jar:
name: Build Jar File
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Maven
run: mvn -e --no-transfer-progress package -Pno-validations
- name: Upload Jar File
uses: actions/upload-artifact@v4
with:
name: jar-file
path: target/checkstyle-sonar-plugin*.jar
retention-days: 1
execute-sonar:
name: Test SonarQube Plugin
runs-on: ubuntu-latest
needs: build-jar
steps:
- uses: actions/checkout@v4
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: jar-file
path: target
- name: Run SonarQube
uses: addnab/docker-run-action@v3
with:
image: sonarqube:9.9-community
options: -d -p 9000:9000 -p 9092:9092 -v ./target/:/opt/sonarqube/extensions/plugins/
- name: Run SonarQube Analysis
run: |
mvn -e --no-transfer-progress sonar:sonar -Dsonar.login=admin -Dsonar.password=admin
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: sonar-results
path: target/sonar/checkstyle-result.xml
- name: Collect logs
uses: jwalton/gh-docker-logs@v2
with:
dest: logs
- name: Check logs for error
run: grep "ERROR" ./logs/* || test $? = 1
# This does not work due to the secret not being available for external repository pull requests.
# sonarqube-analysis:
# name: Analyse with SonarQube
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Set up JDK 11
# uses: actions/setup-java@v2
# with:
# java-version: '11'
# distribution: 'temurin'
# - name: Install jq
# run: sudo apt-get install -y jq
# - name: Run sonarqube
# run: ./.ci/sonarqube.sh
# env:
# PR_NUMBER: ${{ github.event.pull_request.number }}
# PR_BRANCH_NAME: ${{ github.head_ref }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}