ma jdk
Some checks failed
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Successful in 11s
checks / Set up Java for Backend Tests and Build (push) Failing after 12s
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Successful in 3s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Successful in 10s
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 11s
checks / Set up Java for Backend Tests and Build (push) Failing after 12s
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Successful in 3s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Successful in 10s
checks / Set up Java for Backend Tests and Build (pull_request) Failing after 13s
This commit is contained in:
@ -99,27 +99,35 @@ jobs:
|
|||||||
echo "Repository cloned successfully."
|
echo "Repository cloned successfully."
|
||||||
|
|
||||||
# Install Maven manually
|
# Install Maven manually
|
||||||
- name: Install Maven silently
|
- name: Checkout code
|
||||||
run: |
|
uses: actions/checkout@v4
|
||||||
MAVEN_VERSION="3.9.9"
|
|
||||||
MAVEN_DIR="/opt/maven"
|
|
||||||
wget -qO /tmp/apache-maven.tar.gz "https://downloads.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz"
|
|
||||||
sudo mkdir -p "$MAVEN_DIR"
|
|
||||||
sudo tar -xzf /tmp/apache-maven.tar.gz --strip-components=1 -C "$MAVEN_DIR" >/dev/null
|
|
||||||
echo "MAVEN_HOME=$MAVEN_DIR" | sudo tee /etc/profile.d/maven.sh
|
|
||||||
echo "PATH=$MAVEN_DIR/bin:\$PATH" | sudo tee -a /etc/profile.d/maven.sh
|
|
||||||
export MAVEN_HOME="$MAVEN_DIR"
|
|
||||||
export PATH="$MAVEN_HOME/bin:$PATH"
|
|
||||||
mvn -v
|
|
||||||
|
|
||||||
# Cache Maven dependencies
|
# 1️⃣ Download OpenJDK 21 (example source URL)
|
||||||
- name: Cache Maven dependencies
|
- name: Download OpenJDK 21
|
||||||
uses: actions/cache@v3
|
run: |
|
||||||
|
download_url="https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz"
|
||||||
|
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
||||||
|
|
||||||
|
# 2️⃣ Setup Java from local JDK file
|
||||||
|
- name: Set up OpenJDK 21
|
||||||
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
distribution: 'jdkfile' # Use locally downloaded JDK
|
||||||
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
jdkFile: ${{ runner.temp }}/java_package.tar.gz
|
||||||
restore-keys: |
|
java-version: '21'
|
||||||
maven-${{ runner.os }}-
|
architecture: x64
|
||||||
|
mvn-toolchain-vendor: 'Oracle'
|
||||||
|
cache: 'maven' # Enable Maven dependency caching
|
||||||
|
|
||||||
|
# 3️⃣ Verify Java installation
|
||||||
|
- name: Verify Java setup
|
||||||
|
run: |
|
||||||
|
java -version
|
||||||
|
echo "JAVA_HOME=$JAVA_HOME"
|
||||||
|
|
||||||
|
# 4️⃣ Build and test with Maven
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn -B verify
|
||||||
|
|
||||||
# Run backend tests and build
|
# Run backend tests and build
|
||||||
- name: Test & build backend
|
- name: Test & build backend
|
||||||
|
|||||||
Reference in New Issue
Block a user