Skip to content

master_build

master_build #134

Workflow file for this run

name: 'master_build'
on:
push:
branches: [ master ]
schedule:
- cron: "0 2 * * *" # Every day at 02:00 to deploy snapshots
env:
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
jobs:
build_job:
runs-on: ubuntu-latest
name: Build & Test Microservice
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 21
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- uses: s4u/maven-settings-action@v4.0.0
with:
servers: |
[{
"id": "central",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_PASSWORD }}"
},
{
"id": "central-portal-snapshots",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_PASSWORD }}"
}]
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Build & Deploy
run: >
./mvnw deploy
-DsurefireArgs=-Dspring.profiles.active=ASYNCHRONOUS,TEST
-Dci.buildNumber=$GITHUB_RUN_NUMBER
-U -B -Prelease,release-central,gpg $MAVEN_OPTS
sonar_job:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
name: Sonar Analysis
needs: build_job
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 21
- name: Cache SonarQube 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: Sonar
run: >
./mvnw clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar
-DsurefireArgs="-Dspring.profiles.active=TEST"
-Dsonar.login=$SONAR_TOKEN
-DSONAR_TOKEN=$SONAR_TOKEN
-Dci.buildNumber=$GITHUB_RUN_NUMBER
-Pcoverage -B $MAVEN_OPTS
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}