Skip to content

Commit

Permalink
Build with multiple Java versions in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jan 11, 2025
1 parent 05d53da commit 333b552
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
37 changes: 30 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
name: "CI"
on: [push, pull_request]

env:
DEFAULT_JAVA_VERSION: 17
DEFAULT_JAVA_DISTRIBUTION: 'microsoft'

jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java:
- 17
- 18
- 19
- 20
- 21
- 22
- 23
distribution:
- 'adopt-hotspot'
include:
- java: 17
distribution: 'microsoft'
- java: 21
distribution: 'microsoft'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
Expand All @@ -21,8 +44,8 @@ jobs:
- name: 'Setup Java'
uses: actions/setup-java@v1
with:
java-version: 17
java-package: jdk
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
- name: 'Mark tag as release'
if: startsWith(github.ref, 'refs/tags/')
run: echo "RELEASE=true" >> $GITHUB_ENV
Expand Down Expand Up @@ -55,33 +78,33 @@ jobs:
if: ${{ env.COVERALLS_REPO_TOKEN }}
run: ./gradlew test jacocoTestReport coveralls
- name: 'Deploy to CurseForge'
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
env:
CURSEFORGE_KEY_SECRET: ${{ secrets.CURSEFORGE_KEY_SECRET }}
run: ./gradlew curseforge
- name: 'Deploy to Modrinth'
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
env:
MODRINTH_KEY_SECRET: ${{ secrets.MODRINTH_KEY_SECRET }}
run: ./gradlew modrinth
- name: 'Create GitHub release'
id: create_release
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
- name: 'Deploy to Maven'
if: startsWith(github.ref, 'refs/heads/master')
if: startsWith(github.ref, 'refs/heads/master') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_KEY: ${{ secrets.MAVEN_KEY }}
run: ./gradlew publish
- name: 'Deploy JavaDoc to GitHub Pages'
if: startsWith(github.ref, 'refs/heads/master')
if: startsWith(github.ref, 'refs/heads/master') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ dependencies {
transitive = false
}

modLib "org.graalvm.sdk:graal-sdk:22.3.2"
shadow "org.graalvm.sdk:graal-sdk:22.3.2"
modLib ("org.graalvm.js:js:22.3.2") {
modLib "org.graalvm.sdk:graal-sdk:${project.graal_version}"
shadow "org.graalvm.sdk:graal-sdk:${project.graal_version}"
modLib ("org.graalvm.js:js:${project.graal_version}") {
exclude group: 'com.ibm.icu', module: 'icu4j'
}
shadow "org.graalvm.js:js:22.3.2"
shadow "org.graalvm.js:js:${project.graal_version}"


// Project lombok
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ integrateddynamics_version=1.20.1-1.21.3-723
release_type=release
fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44

graal_version=22.3.2
commoncapabilities_version=1.20.1-2.9.0-98

# Workaround for Spotless bug
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 333b552

Please sign in to comment.