Skip to content

[workflow_dispatch][main] #3045

[workflow_dispatch][main]

[workflow_dispatch][main] #3045

Workflow file for this run

# 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: CI Coherence Spring
run-name: ${{ github.event.head_commit.message }} [${{ github.event_name }}][${{ github.ref_name }}]
on:
push:
branches:
- main
- '[1-9]+.x'
workflow_dispatch:
jobs:
build:
if: github.repository_owner == 'coherence-community'
strategy:
matrix:
java-version: [ 17, 21 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/[email protected]
with:
distribution: 'adopt'
java-version: ${{ matrix.java-version }}
- name: Cache SonarCloud packages
if: "matrix.java-version == 17"
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/repository
key: ${{ runner.os }}-maven2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven2-
- name: Build and test with Maven + Sonar - ${{ matrix.java-version }}
if: "matrix.java-version == 17"
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
./mvnw clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=coherence-community_coherence-spring -Dsonar.branch.name=${{ env.GITHUB_REF_NAME }} -B -Pspring -Powasp -DautoUpdate=true -Pspring-repo -Pcoverage --settings .mvn/settings.xml
env:
MAVEN_GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
SONAR_TOKEN: "${{secrets.SONAR_TOKEN}}"
MAVEN_SONATYPE_USERNAME: "${{secrets.MAVEN_SONATYPE_USERNAME}}"
MAVEN_SONATYPE_TOKEN: "${{secrets.MAVEN_SONATYPE_TOKEN}}"
NVD_API_KEY: "${{secrets.NVD_API_KEY}}"
- name: Build and test with Maven - ${{ matrix.java-version }}
if: "matrix.java-version != 17"
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
./mvnw clean install -B -Pspring -Powasp,jdk${{ matrix.java-version }} -DautoUpdate=true --settings .mvn/settings.xml
env:
GIT_COMMIT: ${{github.event.workflow_run.head_commit.id}}
HEAD_BRANCH: ${{github.event.workflow_run.head_branch}}
MAVEN_GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
MAVEN_SONATYPE_USERNAME: "${{secrets.MAVEN_SONATYPE_USERNAME}}"
MAVEN_SONATYPE_TOKEN: "${{secrets.MAVEN_SONATYPE_TOKEN}}"
NVD_API_KEY: "${{secrets.NVD_API_KEY}}"
- name: Deploy Snapshots
if: "matrix.java-version == 17"
env:
MAVEN_GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
MAVEN_SONATYPE_USERNAME: "${{secrets.MAVEN_SONATYPE_USERNAME}}"
MAVEN_SONATYPE_TOKEN: "${{secrets.MAVEN_SONATYPE_TOKEN}}"
run: ./mvnw deploy -B -Pspring --settings .mvn/settings.xml
- name: Clean Maven cache
run: |
find ~/.m2/repository -type d -name '*SNAPSHOT' | xargs rm -fr