Normalize whitespace #487
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v[0-9]+.*' | |
pull_request: | |
branches: | |
- main | |
env: | |
MAVEN_OPTS: "-Xmx4G -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" | |
jobs: | |
event_file: | |
if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} | |
name: "Event File (for test results)" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} # run it on the PR, not on the merged commit, for better line numbers | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Run checkstyle and print errors | |
run: mvn -B checkstyle:checkstyle checkstyle:check | |
- name: Report build results | |
uses: gmazzo/publish-report-annotations@v1 # target latest major | |
if: ${{ !cancelled() }} | |
with: | |
testsSummary: off | |
reports: "target/checkstyle-result.xml" | |
test: | |
if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: test | |
run: mvn -B clean test | |
- name: Upload Unit Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Unit Test Results (${{ matrix.os }}) | |
path: target/surefire-reports/**/*.xml | |
checker-framework: | |
if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Verify using checker-framework | |
run: mvn -B clean compile -P checker-framework | |
deploy: | |
if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} | |
needs: [checker-framework, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Attach artifact | |
id: build-artifact | |
uses: SWAT-engineering/maven-full-artifacts-action@v1 | |
- name: Prepare Draft Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
files: ${{ steps.build-artifact.outputs.artifact-root-dir}}/**/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: usethesource/releases-maven-action@v1 | |
with: | |
maven-username: ${{ secrets.RELEASE_MAVEN_USERNAME }} | |
maven-password: ${{ secrets.RELEASE_MAVEN_PASSWORD }} | |
maven-local-port: ${{ secrets.RELEASE_MAVEN_LOCAL_PORT }} | |
ssh-hostname: ${{ secrets.RELEASE_SSH_SERVER }} | |
ssh-known-host: ${{ secrets.RELEASE_SSH_KNOWN_HOSTS }} | |
ssh-username: ${{ secrets.RELEASE_SSH_USERNAME }} | |
ssh-private-key: ${{ secrets.RELEASE_SSH_PRIVATE_KEY }} |