CI #944
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
name: CI | |
# workflow triggers | |
on: | |
# manually | |
workflow_dispatch: | |
# PRs on `main` | |
pull_request: | |
branches: | |
- main | |
# nightly | |
schedule: | |
- cron: "0 3 * * *" | |
jobs: | |
verify: | |
name: Verify build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup Java and Maven cache | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
check-latest: true | |
cache: 'maven' | |
- name: Verify build | |
run: > | |
./mvnw clean verify | |
--batch-mode | |
--update-snapshots | |
--no-transfer-progress | |
- name: Stage build results (Unix) | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest' | |
run: mkdir staging-${{ matrix.os }} && find . -path '*/target/*.jar' -exec cp {} staging-${{ matrix.os }}/ \; | |
- name: Stage build results (Windows) | |
if: matrix.os == 'windows-latest' | |
run: mkdir staging-${{ matrix.os }} && gci -Path . -Recurse -Include *.jar |? { $_.FullName -like '*\target\*.jar' } |% { cp $_.FullName staging-${{ matrix.os }} } | |
- name: Upload build results | |
uses: actions/[email protected] | |
with: | |
name: Build Results | |
path: staging-*/ | |
verify-javadoc: | |
name: Verify JavaDoc | |
runs-on: ubuntu-latest | |
needs: [verify] | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup Java and Maven cache | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
check-latest: true | |
cache: 'maven' | |
- name: Verify JavaDoc | |
run: > | |
./mvnw clean package javadoc:javadoc | |
-DskipTests | |
--batch-mode | |
--update-snapshots | |
--no-transfer-progress | |
sonar: | |
name: SonarQube analysis | |
runs-on: ubuntu-latest | |
needs: [verify] | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup Java and Maven cache | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
check-latest: true | |
cache: 'maven' | |
- name: Run SonarQube analysis | |
run: > | |
./mvnw clean verify sonar:sonar -P coverage | |
--batch-mode | |
--update-snapshots | |
--no-transfer-progress | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
deploy-snapshot: | |
name: Deploy snapshot | |
runs-on: ubuntu-latest | |
needs: [verify] | |
if: github.ref == 'refs/heads/main' && github.repository_owner == 'vitruv-tools' | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup Java and Maven cache | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
check-latest: true | |
cache: 'maven' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Deploy snapshot | |
run: > | |
./mvnw clean deploy -P snapshot | |
-DskipTests | |
--batch-mode | |
--update-snapshots | |
--no-transfer-progress | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} |