ma jdk ch 21
Some checks failed
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Successful in 10s
checks / Set up Java for Backend Tests and Build (push) Failing after 12s
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Successful in 2s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Successful in 11s
checks / Set up Java for Backend Tests and Build (pull_request) Failing after 13s
Some checks failed
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Successful in 10s
checks / Set up Java for Backend Tests and Build (push) Failing after 12s
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Successful in 2s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Successful in 11s
checks / Set up Java for Backend Tests and Build (pull_request) Failing after 13s
This commit is contained in:
@ -91,14 +91,51 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Java 21 (Temurin)
|
- name: Setup Java 21 + Maven
|
||||||
uses: actions/setup-java@v5
|
run: |
|
||||||
with:
|
echo "Detecting package manager..."
|
||||||
distribution: 'temurin'
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
java-version: '21'
|
PM=apt
|
||||||
cache-dependency-path: 'pom.xml' # optional
|
elif command -v apk >/dev/null 2>&1; then
|
||||||
cache: 'maven'
|
PM=apk
|
||||||
package: 'maven'
|
elif command -v yum >/dev/null 2>&1; then
|
||||||
|
PM=yum
|
||||||
|
else
|
||||||
|
echo "No known package manager found. Will install JDK manually."
|
||||||
|
PM=none
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Package manager detected: $PM"
|
||||||
|
|
||||||
|
if [ "$PM" = "apt" ]; then
|
||||||
|
apt-get update -y
|
||||||
|
apt-get install -y openjdk-21-jdk maven wget tar
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
|
||||||
|
elif [ "$PM" = "apk" ]; then
|
||||||
|
apk update
|
||||||
|
apk add openjdk21 maven wget tar
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-21-openjdk
|
||||||
|
elif [ "$PM" = "yum" ]; then
|
||||||
|
yum install -y java-21-openjdk-devel maven wget tar
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-21-openjdk
|
||||||
|
else
|
||||||
|
# Fallback: manual download
|
||||||
|
JDK_URL="https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz"
|
||||||
|
mkdir -p /opt/jdk
|
||||||
|
wget -q -O /tmp/jdk.tar.gz $JDK_URL
|
||||||
|
tar -xzf /tmp/jdk.tar.gz -C /opt/jdk --strip-components=1
|
||||||
|
JAVA_HOME=/opt/jdk
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Export JAVA_HOME and update PATH for subsequent steps
|
||||||
|
echo "JAVA_HOME=$JAVA_HOME" >> $GITEA_ENV
|
||||||
|
echo "$JAVA_HOME/bin" >> $GITEA_PATH
|
||||||
|
export JAVA_HOME=$JAVA_HOME
|
||||||
|
export PATH=$JAVA_HOME/bin:$PATH
|
||||||
|
|
||||||
|
# Verify Java and Maven installation
|
||||||
|
java -version
|
||||||
|
mvn -version
|
||||||
|
|
||||||
- name: Verify Java setup
|
- name: Verify Java setup
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user