mvn clean build
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 4s
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 11s
checks / Set up Java for Backend Tests and Build (pull_request) Failing after 4s
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 4s
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 11s
checks / Set up Java for Backend Tests and Build (pull_request) Failing after 4s
This commit is contained in:
@ -150,7 +150,7 @@ jobs:
|
||||
# Run backend tests and build
|
||||
- name: Test & build backend
|
||||
working-directory: ./src
|
||||
run: mvn clean verify -B
|
||||
run: mvn clean build
|
||||
|
||||
- name: Done
|
||||
run: echo "Workflow successfully completed."
|
||||
@ -84,70 +84,73 @@ jobs:
|
||||
backend-jobs:
|
||||
name: Set up Java for Backend Tests and Build
|
||||
runs-on: ubuntu-latest
|
||||
#container:
|
||||
#image: eclipse-temurin:21-jdk
|
||||
|
||||
steps:
|
||||
# Checkout repository first
|
||||
- name: Checkout repository manually
|
||||
env:
|
||||
TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
CLONE_URL: ${{ vars.CLONE_URL }}
|
||||
run: |
|
||||
echo "Cloning from $CLONE_URL"
|
||||
echo "Cloning ALL_REPO_TOKEN $ALL_REPO_TOKEN"
|
||||
CLONE_URL_WITH_AUTH=$(echo "$CLONE_URL" | sed "s#https://#https://$ALL_REPO_TOKEN@#")
|
||||
git clone --quiet "$CLONE_URL_WITH_AUTH" .
|
||||
echo "${{ gitea.repository }} cloned successfully."
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java 21 and Maven
|
||||
- name: Setup Java 21 + Maven
|
||||
run: |
|
||||
if command -v act >/dev/null 2>&1; then
|
||||
echo "Detected act runner, installing OpenJDK 21 via apt-get..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y openjdk-21-jdk maven
|
||||
echo "Detecting package manager..."
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
PM=apt
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
PM=apk
|
||||
elif command -v yum >/dev/null 2>&1; then
|
||||
PM=yum
|
||||
else
|
||||
echo "Detected GitHub runner, using actions/setup-java..."
|
||||
echo "No known package manager found. Will install JDK manually."
|
||||
PM=none
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set up JDK 21 for x64
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'oracle'
|
||||
architecture: x64
|
||||
cache: maven
|
||||
cache-dependency-path: 'pom.xml' # optional
|
||||
echo "Package manager detected: $PM"
|
||||
|
||||
- name: Setup Java 21 (for act)
|
||||
#if: ${{ runner.os == 'Linux' && env.ACT_RUNNER == 'true' }}
|
||||
run: |
|
||||
if [ "$PM" = "apt" ]; then
|
||||
apt-get update -y
|
||||
apt-get install -y openjdk-21-jdk
|
||||
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
|
||||
echo "Java 21 setup completed."
|
||||
mvn -version
|
||||
|
||||
- name: Set up Maven
|
||||
uses: stCarolas/setup-maven@v5
|
||||
with:
|
||||
maven-version: 3.9.9
|
||||
- name: Verify Java setup
|
||||
run: |
|
||||
java -version
|
||||
|
||||
- name: Cache Maven dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
maven-${{ runner.os }}-
|
||||
- name: Verify Java setup
|
||||
run: |
|
||||
ls -l $JAVA_HOME/bin/java
|
||||
file $JAVA_HOME/bin/java || true
|
||||
java -version
|
||||
|
||||
# Run backend tests and build
|
||||
- name: Test & build backend
|
||||
working-directory: ./src
|
||||
run: |
|
||||
echo "Started test & build backend..."
|
||||
ls .
|
||||
mvn clean
|
||||
echo "Backend tests and build completed successfully."
|
||||
# mvn clean verify package -B
|
||||
run: mvn clean
|
||||
|
||||
- name: Done
|
||||
run: echo "Workflow successfully completed."
|
||||
Reference in New Issue
Block a user