Skip to content

Merge pull request #108 from jyc0011/master #16

Merge pull request #108 from jyc0011/master

Merge pull request #108 from jyc0011/master #16

Workflow file for this run

name: Integration Test
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
workflow_dispatch:
permissions:
contents: read
jobs:
# Backend (Spring Boot using Gradle) Tests
backend-test:
name: Backend (Spring Boot) Test
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
env:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: NLP_db
MYSQL_USER: NLP_user
MYSQL_PASSWORD: NLP_password
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Set permissions for the Gradle wrapper
- name: Make Gradle wrapper executable
run: chmod +x ./gradlew
# Set up Java (for Spring Boot)
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
# Cache Gradle dependencies to speed up builds
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle
# Run Spring Boot tests using Gradle
- name: Run Spring Boot tests
working-directory: ./ # Set the correct project directory if needed
env:
SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/NLP_db
SPRING_DATASOURCE_USERNAME: NLP_user
SPRING_DATASOURCE_PASSWORD: NLP_password
run: ./gradlew test
# Frontend (Next.js) Tests and Build
frontend-test:
name: Frontend (Next.js) Test
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
# Cache yarn dependencies
- name: Cache yarn dependencies
uses: actions/cache@v3
with:
path: src/main/frontend/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('src/main/frontend/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
# Install frontend dependencies
- name: Install dependencies
working-directory: src/main/frontend
run: yarn install
# Build Next.js project
- name: Build Next.js project
working-directory: src/main/frontend
run: yarn build
# Run ESLint lint checks
- name: Run ESLint linter
working-directory: src/main/frontend
run: yarn lint
# Combine the results
combine-results:
name: Combine Backend and Frontend Results
runs-on: ubuntu-latest
needs: [ backend-test, frontend-test ]
steps:
- name: Check backend and frontend test results
run: echo "Both backend and frontend tests passed successfully!"