add frontend and backend jobs
All checks were successful
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) Successful in 13s
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) Successful in 11s
All checks were successful
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) Successful in 13s
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) Successful in 11s
This commit is contained in:
@ -1,14 +1,17 @@
|
||||
name: checks
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
frontend-jobs:
|
||||
name: Set up Node and other necessary dependencies for Frontend Tests and Build
|
||||
Explore-Gitea-Actions-2:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Info
|
||||
run: |
|
||||
@ -61,68 +64,12 @@ jobs:
|
||||
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-
|
||||
- name: List repo files
|
||||
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
|
||||
#container:
|
||||
#image: eclipse-temurin:21-jdk
|
||||
|
||||
steps:
|
||||
# Install Maven manually
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# 1️⃣ Download OpenJDK 21 (example source URL)
|
||||
- name: Download OpenJDK 21
|
||||
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: Download and extract OpenJDK 21
|
||||
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
|
||||
mkdir -p $RUNNER_TEMP/jdk
|
||||
tar -xzf $RUNNER_TEMP/java_package.tar.gz -C $RUNNER_TEMP/jdk --strip-components=1
|
||||
echo "JAVA_HOME=$RUNNER_TEMP/jdk" >> $GITHUB_ENV
|
||||
echo "$RUNNER_TEMP/jdk/bin" >> $GITHUB_PATH
|
||||
|
||||
# 3️⃣ Verify Java installation
|
||||
- name: Verify Java setup
|
||||
run: |
|
||||
#java -version
|
||||
java
|
||||
echo "JAVA_HOME=$JAVA_HOME"
|
||||
|
||||
# 4️⃣ Build and test with Maven
|
||||
- name: Build with Maven
|
||||
run: mvn -B verify
|
||||
|
||||
# Run backend tests and build
|
||||
- name: Test & build backend
|
||||
working-directory: ./src
|
||||
run: mvn clean verify -B
|
||||
ls .
|
||||
node -v
|
||||
npm -v
|
||||
yarn -v
|
||||
|
||||
- name: Done
|
||||
run: echo "Workflow successfully completed."
|
||||
run: echo "Workflow finished."
|
||||
@ -1,75 +0,0 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions-2:
|
||||
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."
|
||||
|
||||
- name: List repo files
|
||||
run: |
|
||||
ls .
|
||||
node -v
|
||||
npm -v
|
||||
yarn -v
|
||||
|
||||
- name: Done
|
||||
run: echo "Workflow finished."
|
||||
@ -1,157 +0,0 @@
|
||||
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
|
||||
#container:
|
||||
#image: eclipse-temurin:21-jdk
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java 21 + Maven
|
||||
run: |
|
||||
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 "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
|
||||
run: |
|
||||
java -version
|
||||
|
||||
- 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: .
|
||||
run: #mvn clean test
|
||||
mvn clean test -Dspring.profiles.active=test
|
||||
|
||||
- name: Done
|
||||
run: echo "Workflow successfully completed."
|
||||
@ -150,7 +150,8 @@ jobs:
|
||||
# Run backend tests and build
|
||||
- name: Test & build backend
|
||||
working-directory: .
|
||||
run: mvn clean
|
||||
run:
|
||||
mvn clean test -Dspring.profiles.active=test
|
||||
|
||||
- name: Done
|
||||
run: echo "Workflow successfully completed."
|
||||
Reference in New Issue
Block a user