diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e66fba1..f290cd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,45 +2,25 @@ name: CI on: push: - branches: - - master + branches: [ master ] pull_request: - branches: - - master + branches: [ master ] workflow_dispatch: jobs: build: - runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.2.2 - - uses: gradle/wrapper-validation-action@v1 - - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v4.7.1 with: distribution: zulu - java-version: 8 - - - name: Cache Gradle packages - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Build with Gradle - run: ./gradlew build + java-version: ${{ matrix.java }} - - name: Publish to GitHub Packages with Gradle - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew publishAllPublicationsToGitHubPackagesRepository + - uses: gradle/actions/setup-gradle@v4.4.0 - - name: Cleanup Gradle cache - run: | - rm -f ~/.gradle/caches/modules-2/modules-2.lock - rm -f ~/.gradle/caches/modules-2/gc.properties + - run: ./gradlew build --warning-mode all diff --git a/CHANGELOG.md b/CHANGELOG.md index eef5060..86573a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,21 @@ emotionml-checker-java Changelog [Unreleased] ------------ +### Added + +- Testing on Java 17, 21 + +### Removed + +- Testing on Java 8, 11 +- Snapshot hosting on GitHub Packages + +### Changed + +- Build with Gradle v8.14.1 +- Upgraded dependencies +- Upgraded GitHub Actions + [v1.2.2] (2022-01-16) ------------------- diff --git a/README.md b/README.md index 5f3dafd..87c912c 100644 --- a/README.md +++ b/README.md @@ -2,89 +2,10 @@ emotionml-checker-java ====================== [![CI](https://github.com/marytts/emotionml-checker-java/actions/workflows/main.yml/badge.svg)](https://github.com/marytts/emotionml-checker-java/actions/workflows/main.yml) +[![Maven Central](https://maven-badges.sml.io/sonatype-central/de.dfki.mary/emotionml-checker-java/badge.svg)](https://central.sonatype.com/artifact/de.dfki.mary/emotionml-checker-java) A generic implementation of EmotionML checks, in Java. -Dependency resolution ---------------------- - -### Releases - -As of v1.2.1, release artifacts for this component is available via Maven Central. - -#### Gradle - -Add this to your `build.gradle`: - -```gradle -repositories { - mavenCentral() -} - -dependencies { - implementation group: 'de.dfki.mary', name: 'emotionml-checker-java', version: '1.2.1' -} -``` - -#### Maven - -Add this to your `pom.xml`: - -```xml - - de.dfki.mary - emotionml-checker-java - 1.2.1 - -``` - -### Snapshots - -Snapshot releases are hosted via GitHub Packages. - -Ensure you have a valid GitHub personal access token with `read:packages` scope. - -#### Gradle - -Configure your GitHub username and token as Gradle properties `GitHubPackagesUsername` and `GitHubPackagesPassword`, respectively. - -Then, add this to your `build.gradle`: - -```gradle -repositories { - exclusiveContent { - forRepository { - maven { - name 'GitHubPackages' - url 'https://maven.pkg.github.com/marytts/emotionml-checker-java' - credentials PasswordCredentials - } - } - filter { - includeModule 'de.dfki.mary', 'emotionml-checker-java' - } - } -} - -dependencies { - implementation group: 'de.dfki.mary', name: 'emotionml-checker-java', version: '1.3-SNAPSHOT' -} -``` - -#### Maven - -Configure your Maven `settings.xml` to [authenticate to GitHub Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry). - -Then, add this to your `pom.xml`: - -```xml - - de.dfki.mary - emotionml-checker-java - 1.3-SNAPSHOT - -``` - Building -------- diff --git a/build.gradle b/build.gradle index ec040d2..aefdb24 100644 --- a/build.gradle +++ b/build.gradle @@ -1,24 +1,22 @@ plugins { id 'java-library' id 'application' - id 'maven-publish' id 'signing' + id 'maven-publish' } -group 'de.dfki.mary' -version '1.3-SNAPSHOT' -description 'A generic implementation of EmotionML checks, in Java' - -ext.isReleaseVersion = !version.endsWith("SNAPSHOT") +group = 'de.dfki.mary' +version = '1.3-SNAPSHOT' +description = 'A generic implementation of EmotionML checks, in Java' repositories { mavenCentral() } dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' - testCompileOnly 'junit:junit:4.13.2' - testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' + testImplementation libs.junit.jupiter + testCompileOnly libs.junit + testRuntimeOnly libs.junit.vintage.engine } java { @@ -78,24 +76,15 @@ publishing { } repositories { maven { - name = "GitHubPackages" - url = "https://maven.pkg.github.com/$System.env.GITHUB_REPOSITORY" - credentials { - username = System.env.GITHUB_ACTOR - password = System.env.GITHUB_TOKEN - } - } - if (isReleaseVersion) { - maven { - name = 'OSSRH' - url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' - credentials(PasswordCredentials) - } + url = layout.buildDirectory.dir('repo') } } } signing { - required { isReleaseVersion } sign publishing.publications.mavenJava } + +tasks.withType(Sign).configureEach { + onlyIf { !version.endsWith("SNAPSHOT") } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..ef1dbbd --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,8 @@ +[versions] +junit = "4.13.2" +junit-jupiter = "5.8.2" + +[libraries] +junit = { group = "junit", name = "junit", version.ref = "junit" } +junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit-jupiter" } +junit-vintage-engine = { group = "org.junit.vintage", name = "junit-vintage-engine", version.ref = "junit-jupiter" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..002b867 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..23d15a9 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -133,22 +133,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..db3a6ac 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index d9d3122..6e9a3a2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,5 @@ +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' +} + rootProject.name = 'emotionml-checker-java'