mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-06 04:55:30 -04:00
90 lines
3.5 KiB
YAML
90 lines
3.5 KiB
YAML
name: CI
|
|
|
|
on: [ push, pull_request ]
|
|
|
|
jobs:
|
|
test:
|
|
name: Test OpenJDK ${{ matrix.java }} on ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
java: [ 8, 11, 17 ]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: ${{ matrix.java }}
|
|
java-package: jdk
|
|
cache: 'maven'
|
|
- name: Run Tests
|
|
run: mvn test
|
|
- name: Publish Test Report
|
|
uses: mikepenz/action-junit-report@v2
|
|
if: ${{ !cancelled() }}
|
|
with:
|
|
report_paths: "**/target/surefire-reports/TEST*.xml"
|
|
check_name: Unit Test Results for OpenJDK ${{ matrix.java }} on ${{ matrix.os }}
|
|
|
|
test_oracle:
|
|
name: Test Oracle JDK 8 with KCMS=${{ matrix.kcms }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
kcms: [ true, false ]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- run: |
|
|
download_url="https://javadl.oracle.com/webapps/download/AutoDL?BundleId=245038_d3c52aa6bfa54d3ca74e617f18309292"
|
|
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
|
- uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'jdkfile'
|
|
jdkFile: ${{ runner.temp }}/java_package.tar.gz
|
|
java-version: '8'
|
|
cache: 'maven'
|
|
- name: Set MAVEN_OPTS
|
|
if: ${{ matrix.kcms }}
|
|
run: |
|
|
echo "MAVEN_OPTS=-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider" >> $GITHUB_ENV
|
|
- name: Display Java version
|
|
run: java -version
|
|
- name: Run Tests
|
|
run: mvn test
|
|
- name: Publish Test Report
|
|
uses: mikepenz/action-junit-report@v2
|
|
if: ${{ !cancelled() }}
|
|
with:
|
|
report_paths: "**/target/surefire-reports/TEST*.xml"
|
|
check_name: Unit Test Results for Oracle JDK 8 with KCMS=${{ matrix.kcms }}
|
|
|
|
release:
|
|
name: Deploy
|
|
needs: [ test, test_oracle ]
|
|
if: github.ref == 'refs/heads/master' # only perform on latest master
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Maven Central
|
|
uses: actions/setup-java@v2
|
|
with: # running setup-java again overwrites the settings.xml
|
|
distribution: 'temurin'
|
|
java-version: '8'
|
|
java-package: jdk
|
|
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
|
|
server-username: MAVEN_CENTRAL_USERNAME # env variable for username in deploy (1)
|
|
server-password: MAVEN_CENTRAL_PASSWORD # env variable for token in deploy (2)
|
|
gpg-private-key: ${{ secrets.GPG_KEY }} # Value of the GPG private key to import
|
|
gpg-passphrase: MAVEN_CENTRAL_GPG_PASSPHRASE # env variable for GPG private key passphrase (3)
|
|
- name: Get Project Version
|
|
run: |
|
|
echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
|
- name: Publish to Maven Central
|
|
if: ${{ endsWith(env.PROJECT_VERSION, '-SNAPSHOT') }}
|
|
run: mvn deploy -P release -DskipTests
|
|
env:
|
|
MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }} # must be the same env variable name as (1)
|
|
MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} # must be the same env variable name as (2)
|
|
MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} # must be the same env variable name as (3) |