Some checks failed
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Failing after 0s
checks / Set up Java for Backend Tests and Build (push) Failing after 13s
Gitea Actions Demo / Explore-Gitea-Actions-2 (pull_request) Failing after 0s
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (pull_request) Failing after 0s
checks / Set up Java for Backend Tests and Build (pull_request) Failing after 12s
161 lines
5.8 KiB
YAML
161 lines
5.8 KiB
YAML
name: checks
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
frontend-jobs:
|
|
name: Set up Node and other necessary dependencies for Frontend Tests and Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Info
|
|
run: |
|
|
echo "Triggered by ${{ gitea.event_name }} event"
|
|
echo "Branch: ${{ gitea.ref }}"
|
|
echo "Repository: ${{ gitea.repository }}"
|
|
|
|
- name: Install Node.js, npm, and Yarn (optimized)
|
|
run: |
|
|
set -e
|
|
echo "Preparing Node.js, npm, and Yarn setup..."
|
|
|
|
if command -v apt >/dev/null 2>&1; then
|
|
echo "→ Using apt (Debian/Ubuntu)..."
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update -qq >/dev/null
|
|
apt-get install -y -qq curl ca-certificates >/dev/null
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - >/dev/null 2>&1
|
|
apt-get install -y -qq nodejs >/dev/null
|
|
npm install -g yarn --silent
|
|
|
|
elif command -v apk >/dev/null 2>&1; then
|
|
echo "→ Using apk (Alpine)..."
|
|
apk add --no-cache curl nodejs npm >/dev/null
|
|
npm install -g yarn --silent
|
|
|
|
elif command -v dnf >/dev/null 2>&1; then
|
|
echo "→ Using dnf (Fedora/RHEL)..."
|
|
dnf install -y -q curl ca-certificates nodejs npm >/dev/null
|
|
npm install -g yarn --silent
|
|
|
|
else
|
|
echo "No supported package manager found (apt, apk, dnf)."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Node.js, npm, and Yarn installed successfully:"
|
|
node -v
|
|
npm -v
|
|
yarn -v
|
|
|
|
- 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."
|
|
|
|
# Install frontend dependencies and run tests
|
|
- name: Install frontend dependencies and run tests
|
|
#uses: actions/cache@v3
|
|
working-directory: ./frontend
|
|
with:
|
|
path: |
|
|
~/.yarn/cache
|
|
./node_modules
|
|
key: frontend-${{ runner.os }}-yarn-${{ hashFiles('frontend/yarn.lock') }}
|
|
restore-keys: |
|
|
frontend-${{ runner.os }}-yarn-
|
|
run: |
|
|
yarn install --frozen-lockfile
|
|
#yarn test --watchAll=false --ci
|
|
|
|
#Check frontend linting
|
|
- name: Check frontend linting
|
|
working-directory: ./frontend
|
|
run: yarn lint
|
|
|
|
backend-jobs:
|
|
name: Set up Java for Backend Tests and Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# Checkout repository
|
|
- name: Checkout repository manually
|
|
env:
|
|
TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
|
CLONE_URL: ${{ vars.CLONE_URL }}
|
|
run: |
|
|
CLONE_URL_WITH_AUTH=$(echo "$CLONE_URL" | sed "s#https://#https://$TOKEN@#")
|
|
git clone --quiet "$CLONE_URL_WITH_AUTH" .
|
|
echo "Repository cloned successfully."
|
|
|
|
# Manual Java 21 installation
|
|
- name: Install OpenJDK 21 manually
|
|
run: |
|
|
set -e
|
|
# Detect if running in act
|
|
if command -v act >/dev/null 2>&1; then
|
|
echo "Detected act runner, installing Java 21 via apt silently..."
|
|
fi
|
|
|
|
# Install prerequisites silently
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y -qq wget tar gzip gnupg --no-install-recommends
|
|
|
|
# Download OpenJDK 21 tar.gz from Eclipse Temurin (or AdoptOpenJDK)
|
|
JDK_VERSION="21.0.0+35"
|
|
JDK_DIR="/opt/jdk-21"
|
|
TMP_TAR="/tmp/openjdk-21.tar.gz"
|
|
wget -qO "$TMP_TAR" "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.0%2B35/OpenJDK21U-jdk_x64_linux_hotspot_21.0.0_35.tar.gz"
|
|
|
|
# Extract silently
|
|
sudo mkdir -p "$JDK_DIR"
|
|
sudo tar --strip-components=1 -xzf "$TMP_TAR" -C "$JDK_DIR" >/dev/null
|
|
|
|
# Set environment variables for all steps
|
|
echo "JAVA_HOME=$JDK_DIR" | sudo tee /etc/profile.d/jdk21.sh
|
|
echo "PATH=$JDK_DIR/bin:\$PATH" | sudo tee -a /etc/profile.d/jdk21.sh
|
|
export JAVA_HOME="$JDK_DIR"
|
|
export PATH="$JAVA_HOME/bin:$PATH"
|
|
|
|
java -version
|
|
echo "OpenJDK 21 installed successfully."
|
|
|
|
# Install Maven manually
|
|
- name: Install Maven silently
|
|
run: |
|
|
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
|
|
- name: Cache Maven dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: |
|
|
maven-${{ runner.os }}-
|
|
|
|
# Run backend tests and build
|
|
- name: Test & build backend
|
|
working-directory: ./src
|
|
run: |
|
|
mvn clean verify -B
|
|
|
|
- name: Done
|
|
run: echo "Workflow successfully completed." |