From 191b2371c8560f8ed1d400e44ffee323f08e24d5 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Wed, 5 Jan 2022 19:34:52 +0800 Subject: [PATCH] add support for Github Actions, publish snapshots to OSSRH automatically (#633) * remove oss-parent * add github workflow * use java 16 for now * disable fail fast * add java 15 * use only java 8 and 11 for now * snapshot deploy * snapshot deploy * oracle jdk * oracle jdk * oracle jdk * kcms matrix * kcms job name * only deploy for snapshots * try not operator * prepare PR * restore groupId * Fixed Travis link + bonus project summary updates * Readme improvements * #629: Preliminary WebP animation (ANIM/ANMF) support * #629: Fixed build * Make tests pass on JDK 16 and 17 (#635) * make tests pass on JDK 16 and 17 replace deprecated mockito-all by mockito-core, and updated to latest 3.x replace deprecated org.mockito.Matchers * code cleanup from IDE suggestions * add oracle jdk 16 and 17 to Travis * test on java 17 * try to fix warning about maven-source-plugin Co-authored-by: Harald Kuhr --- .github/workflows/ci.yml | 78 +++++++++++++++++++++ imageio/imageio-icns/pom.xml | 3 +- imageio/imageio-metadata/pom.xml | 2 +- pom.xml | 112 ++++++++++++++++++++++--------- 4 files changed, 161 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f2fb74c6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +name: CI + +on: [ push, pull_request ] + +jobs: + test: + name: test ${{ matrix.os }} jdk${{ matrix.java }} + 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: Test + run: mvn test + + test_oracle: + name: 'test Oracle JDK 8 (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: Test + run: mvn test + + 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 Apache 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 Apache 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) \ No newline at end of file diff --git a/imageio/imageio-icns/pom.xml b/imageio/imageio-icns/pom.xml index 8d7573ee..1f86883a 100644 --- a/imageio/imageio-icns/pom.xml +++ b/imageio/imageio-icns/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 com.twelvemonkeys.imageio diff --git a/imageio/imageio-metadata/pom.xml b/imageio/imageio-metadata/pom.xml index e6a30f05..a4c567cf 100644 --- a/imageio/imageio-metadata/pom.xml +++ b/imageio/imageio-metadata/pom.xml @@ -1,7 +1,7 @@ - com.twelvemonkeys.imageio + com.twelvemonkeys.imageio imageio 3.9.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 0690a785..67011ce9 100755 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,7 @@ - + 4.0.0 - - org.sonatype.oss - oss-parent - 9 - com.twelvemonkeys twelvemonkeys @@ -89,6 +85,49 @@ HEAD + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + + --pinentry-mode + loopback + + + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + + + + UTF-8 com.twelvemonkeys.${project.artifactId} @@ -97,6 +136,12 @@ twelvemonkeys-${project.artifactId}-${project.version} + + org.apache.maven.plugins + maven-help-plugin + 3.2.0 + + org.apache.maven.plugins maven-jar-plugin @@ -116,18 +161,31 @@ org.apache.maven.plugins maven-source-plugin - true + 3.2.1 - - package - attach-sources - - jar - test-jar - - - - + + package + attach-sources + + jar-no-fork + jar + test-jar + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + true + + @@ -155,16 +213,6 @@ - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - org.apache.maven.plugins - maven-source-plugin - 3.2.0 - org.apache.maven.plugins maven-compiler-plugin @@ -198,11 +246,11 @@ maven-release-plugin 3.0.0-M4 - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.11.2 - + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.11.2 +