Skip to content

Updating the cicd workflow file #18

Updating the cicd workflow file

Updating the cicd workflow file #18

Workflow file for this run

name: Continuous Integration and Continuous Deployment Suivie Physique
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build-test-deploy:
name: Build & Test & Deploy Suivie Physique App
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Unit Test Backend
run: mvn -B test --file backend/pom.xml
- name: Build Backend App
run: |
mvn clean
mvn -B package --file backend/pom.xml
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Cache Node Modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: frontend/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ runner.os }}-build-${{ runner.os }}
- name: Install Dependencies
run: |
npm install --prefix frontend
npm install --prefix frontend tailwindcss postcss autoprefixer
# - name: Running Frontend Tests
# run: npm run test:ci --prefix frontend
- name: Building Frontend App
run: npm run build:ci --prefix frontend
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push to Dockerhub
run: docker-compose build