fix(ci): run build-jvm and build-native inside maven container image
Runner has no Maven or JDK installed. Instead of installing both manually each job, run the jobs inside the official maven:3.9.6-eclipse-temurin-21 image which has both pre-installed. - Drop actions/setup-java (image has JDK 21) - Drop 'Install Maven' step (image has Maven 3.9.6) - Add 'container: image: maven:3.9.6-eclipse-temurin-21' to each job - Add cache for ~/.m2/repository (key on pom.xml hash) - Keep graalvm/setup-graalvm only for the native job (adds GraalVM inside the container) - docker-native job unchanged: uses the runner's docker daemon directly to build the image with the pre-built native binary
This commit is contained in:
+14
-34
@@ -17,28 +17,18 @@ jobs:
|
|||||||
build-jvm:
|
build-jvm:
|
||||||
name: Build JVM
|
name: Build JVM
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: maven:3.9.6-eclipse-temurin-21
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up JDK 21
|
- name: Cache Maven repository
|
||||||
uses: actions/setup-java@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
path: ~/.m2/repository
|
||||||
java-version: 21
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||||
cache: maven
|
restore-keys: ${{ runner.os }}-maven-
|
||||||
|
|
||||||
- name: Install Maven
|
|
||||||
env:
|
|
||||||
MAVEN_VERSION: 3.9.6
|
|
||||||
MAVEN_HOME: ${{ runner.workspace }}/.maven
|
|
||||||
run: |
|
|
||||||
mkdir -p "$MAVEN_HOME"
|
|
||||||
if [ ! -x "$MAVEN_HOME/bin/mvn" ]; then
|
|
||||||
curl -fsSL "https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" | tar -xz -C "$MAVEN_HOME" --strip-components=1
|
|
||||||
fi
|
|
||||||
echo "$MAVEN_HOME/bin" >> "$GITHUB_PATH"
|
|
||||||
mvn --version
|
|
||||||
|
|
||||||
- name: Cache Node + npm
|
- name: Cache Node + npm
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
@@ -61,28 +51,18 @@ jobs:
|
|||||||
build-native:
|
build-native:
|
||||||
name: Build Native
|
name: Build Native
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: maven:3.9.6-eclipse-temurin-21
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up JDK 21
|
- name: Cache Maven repository
|
||||||
uses: actions/setup-java@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
path: ~/.m2/repository
|
||||||
java-version: 21
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||||
cache: maven
|
restore-keys: ${{ runner.os }}-maven-
|
||||||
|
|
||||||
- name: Install Maven
|
|
||||||
env:
|
|
||||||
MAVEN_VERSION: 3.9.6
|
|
||||||
MAVEN_HOME: ${{ runner.workspace }}/.maven
|
|
||||||
run: |
|
|
||||||
mkdir -p "$MAVEN_HOME"
|
|
||||||
if [ ! -x "$MAVEN_HOME/bin/mvn" ]; then
|
|
||||||
curl -fsSL "https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" | tar -xz -C "$MAVEN_HOME" --strip-components=1
|
|
||||||
fi
|
|
||||||
echo "$MAVEN_HOME/bin" >> "$GITHUB_PATH"
|
|
||||||
mvn --version
|
|
||||||
|
|
||||||
- name: Set up GraalVM
|
- name: Set up GraalVM
|
||||||
uses: graalvm/setup-graalvm@v1
|
uses: graalvm/setup-graalvm@v1
|
||||||
|
|||||||
Reference in New Issue
Block a user