update test
Some checks failed
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Failing after 4s
checks / Set up Java for Backend Tests and Build (push) Failing after 1m31s
Gitea Actions Demo / Explore-Gitea-Actions (pull_request) Successful in 5s
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) Failing after 2s
checks / Set up Java for Backend Tests and Build (pull_request) Failing after 1m38s
Some checks failed
checks / Set up Node and other necessary dependencies for Frontend Tests and Build (push) Failing after 4s
checks / Set up Java for Backend Tests and Build (push) Failing after 1m31s
Gitea Actions Demo / Explore-Gitea-Actions (pull_request) Successful in 5s
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) Failing after 2s
checks / Set up Java for Backend Tests and Build (pull_request) Failing after 1m38s
This commit is contained in:
@ -5,48 +5,108 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-and-test:
|
frontend-jobs:
|
||||||
name: Check & Test (Frontend + Backend)
|
name: Set up Node and other necessary dependencies for Frontend Tests and Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
#Checkout repository
|
- name: Info
|
||||||
#- name: Checkout repository
|
|
||||||
# uses: actions/checkout@v4
|
|
||||||
- name: Checkout repository manually
|
|
||||||
run: |
|
run: |
|
||||||
git clone ${{ gitea.repository.clone_url }}
|
echo "Triggered by ${{ gitea.event_name }} event"
|
||||||
|
echo "Branch: ${{ gitea.ref }}"
|
||||||
|
echo "Repository: ${{ gitea.repository }}"
|
||||||
|
|
||||||
#Set up Node.js for React tests
|
- name: Install Node.js, npm, and Yarn (optimized)
|
||||||
- name: Set up Node.js
|
run: |
|
||||||
uses: actions/setup-node@v4
|
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."
|
||||||
|
|
||||||
|
#Check frontend linting
|
||||||
|
- name: Check frontend linting
|
||||||
|
working-directory: ./frontend
|
||||||
|
run: yarn lint
|
||||||
|
|
||||||
|
# Install frontend dependencies and run tests
|
||||||
|
- name: Install frontend dependencies and run tests
|
||||||
|
#uses: actions/cache@v3
|
||||||
|
working-directory: ./frontend
|
||||||
with:
|
with:
|
||||||
node-version: '20' # adjust to your project version or via env
|
path: |
|
||||||
cache: 'yarn' # or 'npm' if you use npm
|
~/.yarn/cache
|
||||||
|
./node_modules
|
||||||
#Install frontend dependencies
|
key: frontend-${{ runner.os }}-yarn-${{ hashFiles('frontend/yarn.lock') }}
|
||||||
- name: Install frontend dependencies
|
restore-keys: |
|
||||||
working-directory: ./frontend # adjust if your React app folder differs
|
frontend-${{ runner.os }}-yarn-
|
||||||
run: |
|
run: |
|
||||||
yarn install --frozen-lockfile
|
yarn install --frozen-lockfile
|
||||||
|
yarn test --watchAll=false --ci
|
||||||
|
|
||||||
#Run React unit tests
|
backend-jobs:
|
||||||
#- name: Run React unit tests
|
name: Set up Java for Backend Tests and Build
|
||||||
# working-directory: ./frontend
|
runs-on: ubuntu-latest
|
||||||
# run: |
|
|
||||||
# yarn test --watchAll=false --ci
|
|
||||||
|
|
||||||
#Set up Java for backend tests
|
steps:
|
||||||
- name: Set up Java
|
# Setup Java 21 and Maven with caching
|
||||||
|
- name: Set up Java & Maven
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: '21' # adjust to match your backend version
|
java-version: '21'
|
||||||
cache: maven # or 'gradle' if you use Gradle
|
cache: maven
|
||||||
|
|
||||||
|
- name: Cache Maven dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.m2/repository
|
||||||
|
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: |
|
||||||
|
maven-${{ runner.os }}-
|
||||||
|
|
||||||
#Build & test backend
|
|
||||||
- name: Build & test backend
|
- name: Build & test backend
|
||||||
working-directory: src # adjust if your Spring Boot project path differs
|
working-directory: ./src
|
||||||
run: |
|
run: |
|
||||||
|
mvn clean install -B
|
||||||
mvn clean verify package -B
|
mvn clean verify package -B
|
||||||
# or ./gradlew clean test build if using Gradle
|
|
||||||
|
- name: Done
|
||||||
|
run: echo "Workflow successfully completed."
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@ -27,7 +27,7 @@
|
|||||||
<url/>
|
<url/>
|
||||||
</scm>
|
</scm>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>21</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -48,6 +48,8 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.36</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user