Skip to content

Update SonarCloud configuration #98

Update SonarCloud configuration

Update SonarCloud configuration #98

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Maven Build
on:
push:
paths-ignore:
- neoemf-doc
pull_request:
branches: [ master ]
jobs:
build-bundles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'zulu'
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and install main project
run: ./mvnw clean install -DskipTests
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=atlanmod_NeoEMF
build-plugins:
runs-on: ubuntu-latest
needs: build-bundles
steps:
- uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'temurin'
cache: maven
- name: Build plugins with Tycho
run: ./mvnw -B -f plugins/eclipse install
deploy-bundles:
runs-on: ubuntu-latest
needs: build-bundles
steps:
- uses: actions/checkout@v4
- name: Set up JDK 2
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'temurin'
cache: maven
- name: Install GPG key
run: |
cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Initialize variables
id: init
run: |
VERSION=$(./mvnw -B help:evaluate -Dexpression='project.version' $@ | grep -v '\[' | tail -1)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "$VERSION"
- name: Publish Snapshot to Central
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
if: contains(env.VERSION, 'SNAPSHOT' )
run: |
./mvnw \
--no-transfer-progress \
--batch-mode \
clean install deploy \
--settings .util/settings.xml \
-DskipTests
- name: Publish release to Central
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
if: ${{ !contains(env.VERSION, 'SNAPSHOT' ) }}
run: |
./mvnw \
--no-transfer-progress \
--batch-mode \
clean package javadoc:jar source:jar-no-fork gpg:sign install deploy \
--settings .util/settings.xml \
-DskipTests \
-Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} \
-P deploy-artifacts
# mvn clean package javadoc:jar source:jar-no-fork gpg:sign install deploy -DskipTests
#-s .util/settings.xml -DskipTests clean package javadoc:jar source:jar-no-fork gpg:sign install deploy
#