Implement SonarCloud quality suggestions #159 #333
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
# This workflow will build a Java project with Maven | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
name: Java CI with Maven | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml | ||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
- name: Cache Maven packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
- name: Build and send to SonarCloud (https://sonarcloud.io/summary/new_code?id=pkiraly_metadata-qa-api) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
java-version: '17' | ||
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -DskipGpg=true | ||
Check failure on line 51 in .github/workflows/maven.yml GitHub Actions / Java CI with MavenInvalid workflow file
|
||
# https://app.codecov.io/gh/pkiraly/metadata-qa-api | ||
- name: Pubish code coverage at https://app.codecov.io/gh/pkiraly/metadata-qa-api | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./**/target/site/jacoco/jacoco.xml | ||
# token: ${{ secrets.CODECOV_TOKEN }} | ||
name: codecov | ||
# https://coveralls.io/github/pkiraly/metadata-qa-api | ||
# COVERALL_REPO_TOKEN is available as the TOKEN variable at https://coveralls.io/github/pkiraly/metadata-qa-api | ||
# coverage report: https://coveralls.io/github/pkiraly/metadata-qa-api | ||
- name: Publish code coverage at https://coveralls.io/github/pkiraly/metadata-qa-api | ||
run: mvn coveralls:report -DrepoToken=${{ secrets.COVERALL_REPO_TOKEN }} |