Update README.md #2
This file contains 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: CI/CD Pipeline | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build_backend: | |
name: Build backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '20' | |
cache: maven | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml -DskipTests | |
working-directory: backend | |
build_frontend: | |
runs-on: ubuntu-latest | |
needs: [build_backend] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: frontend/package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
working-directory: frontend | |
- name: Build frontend | |
run: npm run build --no-progress 2>&1 >/dev/null || true # Mutes ESlint warnings | |
working-directory: frontend | |
cypress: | |
runs-on: ubuntu-latest | |
needs: [build_backend, build_frontend] | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_DB: measdb | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '20' | |
cache: maven | |
- name: Start backend | |
run: | | |
./mvnw quarkus:dev & | |
working-directory: backend | |
- name: Wait for Quarkus Server to be Ready | |
run: | | |
echo "Waiting for Quarkus server to start..." | |
until curl --output /dev/null --head http://localhost:8280; do | |
printf '.' | |
sleep 5 | |
done | |
echo "Quarkus server is up and running!" | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: frontend/package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
working-directory: frontend | |
- name: Start frontend | |
run: npm run start & | |
working-directory: frontend | |
- name: Wait for React Server to be Ready | |
run: | | |
echo "Waiting for React server to start..." | |
until curl --output /dev/null --head http://localhost:3000; do | |
printf '.' | |
sleep 5 | |
done | |
echo "React server is up and running!" | |