Skip to content

CI

CI #2261

Workflow file for this run

name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
on:
push:
branches:
- main
paths-ignore:
- '.github/**'
- '!.github/workflows/ci.yml'
- '.sdkmanrc'
- 'renovate.json5'
- '*.md'
schedule:
- cron: '0 11,23 * * *'
workflow_dispatch:
jobs:
build:
name: Build and test (Maven)
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Audit egress
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
show-progress: false
- name: Set up Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: 'zulu'
java-version-file: '.java-version'
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Cache local Maven repository
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build and test, with coverage
run: ./mvnw -B -ntp -P coverage install
- name: Upload build output
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
if: always()
with:
name: maven-build-output
path: |
**/target/it/*/src/
**/target/it/*/build.log
**/target/it/*/pom.xml
**/target/site/jacoco-aggregate/
**/target/surefire-reports/
**/target/test-classes/projects/*/project/*/src/
**/target/test-classes/projects/*/project/*/build.log
**/target/test-classes/projects/*/project/*/pom.xml
**/target/checkstyle-result.xml
**/target/spotbugs.html
**/target/spotbugs.xml
**/target/spotbugsXml.xml
**/.flattened-pom.xml
retention-days: 15
- name: Cache SonarCloud packages
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Analyze
run: ./mvnw -B -ntp sonar:sonar -Dsonar.host.url="$SONAR_HOST_URL" -Dsonar.organization="$SONAR_ORGANIZATION" -Dsonar.projectKey="$SONAR_PROJECTKEY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }}
SONAR_PROJECTKEY: ${{ vars.SONAR_PROJECTKEY }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish artifacts
run: ./mvnw -B -ntp -P release deploy -Dquickly -Dmaven.install.skip=true -Dgpg.keyname="$MAVEN_GPG_KEYNAME"
env:
MAVEN_GPG_KEYNAME: 0x${{ vars.GPG_KEY_ID }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
- name: Stage site
run: ./mvnw -B -ntp -P coverage,release site site:stage
- name: Upload site
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
if: always()
with:
name: maven-site
path: target/staging/
retention-days: 15
- name: Configure Git
run: |
git config --global user.name "$GIT_USER_NAME"
git config --global user.email "$GIT_USER_EMAIL"
env:
GIT_USER_NAME: ${{ vars.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ vars.GIT_USER_EMAIL }}
- name: Publish site
run: ./mvnw -B -ntp scm-publish:publish-scm -Dusername="$GITHUB_ACTOR" -Dpassword="$GITHUB_TOKEN"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@4f64ddab9d742a4806eeb588d238e4c311a8397d # v4.1.1
build-gradle:
name: Build and test (Gradle)
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Audit egress
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
show-progress: false
- name: Set up Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
distribution: 'zulu'
java-version-file: '.java-version'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
with:
dependency-graph: generate-and-submit
- name: Build and test, with coverage
run: ./gradlew build
- name: Cache SonarCloud packages
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Analyze
run: ./gradlew sonar --info -Dsonar.host.url="$SONAR_HOST_URL" -Dsonar.organization="$SONAR_ORGANIZATION" -Dsonar.projectKey="$SONAR_PROJECTKEY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }}
SONAR_PROJECTKEY: ${{ vars.SONAR_PROJECTKEY }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish artifacts
run: ./gradlew publishToSonatype
env:
ORG_GRADLE_PROJECT_signingKeyId: ${{ vars.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_TOKEN }}