Check for category #286
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-frontend: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./peer-prep-fe/ | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x, 22.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
cache-dependency-path: "./peer-prep-fe/package-lock.json" | |
- name: Install dependencies | |
run: npm install | |
- name: Build frontend | |
run: npm run build --if-present | |
- name: Run tests | |
run: npm test -- --watch=false --browsers=ChromeHeadless | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{vars.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./peer-prep-fe | |
file: ./peer-prep-fe/Dockerfile | |
platforms: linux/arm64, linux/amd64 | |
push: true | |
tags: ${{vars.DOCKER_USERNAME}}/${{github.event.repository.name}}:latest | |
build-backend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.23 | |
# - name: Build backend using Docker | |
# run: | | |
# cd peer-prep-be | |
# docker build -t peer-prep-backend:latest . | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{vars.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
# - name: Push Docker image | |
# run: docker push peer-prep-backend:latest | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./peer-prep-be | |
file: ./peer-prep-be/Dockerfile | |
platforms: linux/arm64, linux/amd64 | |
push: true | |
tags: ${{vars.DOCKER_USERNAME}}/${{github.event.repository.name}}:latest | |
# - name: Test backend | |
# run: | | |
# cd peer-prep-be | |
# go test -v ./main | |
# deploy: | |
# needs: [build-frontend, build-backend] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Deploy Application | |
# run: ./deploy.sh | |
build-mq: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./message-queue/ | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm install | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{vars.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./message-queue | |
file: ./message-queue/Dockerfile | |
platforms: linux/arm64, linux/amd64 | |
push: true | |
tags: ${{vars.DOCKER_USERNAME}}/${{github.event.repository.name}}:latest |