Feat/add frontend tests #90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backend Integration Tests | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- master | |
jobs: | |
integration-tests: | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: insights | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '23' | |
- name: Install Maven | |
run: sudo apt-get update && sudo apt-get install -y maven | |
- name: Install Frontend Dependencies | |
run: npm install | |
working-directory: ./InsightsFrontend | |
- name: Build Backend | |
run: mvn clean package -DskipTests | |
working-directory: ./InsightsBackend | |
- name: Start Backend | |
run: | | |
mkdir -p logs | |
java -Dspring.profiles.active=local \ | |
-Dgithub.secret="${{ secrets.GH_TOKEN }}" \ | |
-jar InsightsBackend/target/*.jar > logs/backend.log 2>&1 & | |
echo $! > backend.pid | |
shell: bash | |
- name: Start Frontend (Dev Mode) | |
run: | | |
npm start --prefix InsightsFrontend > logs/frontend.log 2>&1 & | |
echo $! > frontend.pid | |
shell: bash | |
- name: Check Backend Health | |
uses: jtalk/url-health-check-action@v4 | |
with: | |
url: http://localhost:8080/actuator/health | |
max-attempts: 5 | |
retry-delay: 5s | |
- name: Check Frontend Health | |
uses: jtalk/url-health-check-action@v4 | |
with: | |
url: http://localhost:4200 | |
max-attempts: 5 | |
retry-delay: 5s | |
- name: Upload All Logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: full-logs | |
path: logs/*.log |