Update workflow.yml #65
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 Workflow | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build_backend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
- name: Build with Maven | |
run: mvn -B package --file backend/pom.xml -DskipTests | |
test_frontend: | |
needs: build_backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: cd frontend && npm ci | |
- name: Run tests | |
run: cd frontend && npm test | |
build_frontend: | |
needs: [build_backend, test_frontend] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: cd frontend && npm ci | |
- name: Build | |
run: cd frontend && npm run build --no-progress 2>&1 >/dev/null || true # Mutes ESlint warnings | |
start_backend: | |
needs: build_backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
- name: Start backend | |
run: mvn -B spring-boot:run --file backend/pom.xml & | |
run_frontend: | |
needs: start_backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: cd frontend && npm ci | |
- name: Run frontend | |
run: cd frontend && npm start |