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 9, 2025
1 parent aa44cf7 commit 62176f9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
name: "CI"
on: [push, pull_request]

env:
DEFAULT_JAVA_VERSION: 17

jobs:
build:
name: Build
name: Build for Java ${{ matrix.java }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java:
- 17
- 18
- 19
- 20
- 21
- 22
- 23
steps:
- name: 'Checkout'
uses: actions/checkout@v2
Expand All @@ -19,10 +34,10 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: 'Setup Java'
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 17
java-package: jdk
java-version: ${{ matrix.java }}
distribution: microsoft
- name: 'Mark tag as release'
if: startsWith(github.ref, 'refs/tags/')
run: echo "RELEASE=true" >> $GITHUB_ENV
Expand Down Expand Up @@ -60,28 +75,28 @@ jobs:
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)
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)
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)
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)
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,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"
shadow "org.graalvm.js:js:22.3.2"
// https://mvnrepository.com/artifact/org.graalvm.sdk/graal-sdk
modLib "org.graalvm.sdk:graal-sdk:${project.graal_version}"
shadow "org.graalvm.sdk:graal-sdk:${project.graal_version}"
// https://mvnrepository.com/artifact/org.graalvm.js/js
modLib "org.graalvm.js:js:${project.graal_version}"
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.19.2-1.21.3-721
release_type=release
fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44

graal_version=22.3.2
commoncapabilities_version=1.19.2-2.9.0-88

# 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,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 62176f9

Please sign in to comment.