Skip to content

Commit

Permalink
Merge pull request #43 from COS301-SE-2024/feature/api_setup
Browse files Browse the repository at this point in the history
(PR) Updated The GitHub Jobs for The CI/CI Pipeline
  • Loading branch information
hlokomani authored Jun 2, 2024
2 parents e30eac9 + 30481ab commit 85b1b18
Show file tree
Hide file tree
Showing 11 changed files with 3,257 additions and 305 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
name: Creating And Deploying Docker Images
name: Creating And Deploying Backend and Proxy Docker Images

on:
push:
branches:
- master
- main
- develop
workflow_run:
workflows:
- "Frontend Unit Testing"
- "Backend Unit Testing"
- "Lint Frontend Application"
- "Lint Backend Application"
types:
- completed

jobs:
build-and-push:
build-and-push-backend:
runs-on: ubuntu-latest
name: "DockerHub: Containerized Environments For The Project"
name: "DockerHub: Backend and Reverse Proxy"
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
Expand All @@ -33,9 +31,6 @@ jobs:
node --version # This should output v18.0.0
sudo apt install -y nodejs
- name: Checkout
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand All @@ -55,19 +50,9 @@ jobs:
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}

- name: Build and push frontend Docker image
run: |
echo "--------- Building frontend Docker image -----------"
docker build -t infiniteloopers-frontend-app ./frontend
docker tag infiniteloopers-frontend-app ${{ secrets.DOCKERUSSER }}/infiniteloopers-frontend-app:v0
docker push ${{ secrets.DOCKERUSSER }}/infiniteloopers-frontend-app:v0
env:
BACKEND_URL: ${{ secrets.BACKEND_URL }}

- name: Build and push reverse proxy Docker image
run: |
echo "--------- Building reverse proxy Docker image -----------"
docker build -t infiniteloopers-reverseproxy ./reverseproxy
docker tag infiniteloopers-reverseproxy ${{ secrets.DOCKERUSSER }}/infiniteloopers-reverseproxy:v0
docker push ${{ secrets.DOCKERUSSER }}/infiniteloopers-reverseproxy:v0
docker push ${{ secrets.DOCKERUSSER }}/infiniteloopers-reverseproxy:v0
50 changes: 50 additions & 0 deletions .github/workflows/docker-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Creating And Deploying Frontend Docker Images

on:
push:
branches:
- master
- main
- develop
workflow_run:
workflows:
- "Frontend Unit Testing"
types:
- completed

jobs:
build-and-push-frontend:
runs-on: ubuntu-latest
name: "DockerHub: Frontend"
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install dependencies
run: |
echo "--------- Installing dependencies -----------"
curl -LO https://nodejs.org/dist/v18.0.0/node-v18.0.0-linux-x64.tar.xz
tar -xvf node-v18.0.0-linux-x64.tar.xz
sudo cp -r node-v18.0.0-linux-x64/{bin,include,lib,share} /usr/
node --version # This should output v18.0.0
sudo apt install -y nodejs
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERUSSER }}
password: ${{ secrets.DOCKERPASS }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push frontend Docker image
run: |
echo "--------- Building frontend Docker image -----------"
docker build -t infiniteloopers-frontend-app ./frontend
docker tag infiniteloopers-frontend-app ${{ secrets.DOCKERUSSER }}/infiniteloopers-frontend-app:v0
docker push ${{ secrets.DOCKERUSSER }}/infiniteloopers-frontend-app:v0
env:
BACKEND_URL: ${{ secrets.BACKEND_URL }}
4 changes: 1 addition & 3 deletions .github/workflows/hosting-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ on:
- main
workflow_run:
workflows:
- "Frontend Unit Testing"
- "Backend Unit Testing"
- "Linting, Building, and Pushing of Docker images"
- "Creating And Deploying Backend and Proxy Docker Images"
types:
- completed

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/hosting-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ on:
- main
workflow_run:
workflows:
- "Frontend Unit Testing"
- "Backend Unit Testing"
- "Linting, Building, and Pushing of Docker images"
- "Creating And Deploying Frontend Docker Images"
types:
- completed

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/linter-backend.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
name: Lint Backend Application
run-name: Linter For Backend Server


on:
push:
branches:
- develop
- master
- main
- 'feature/**'
pull_request:
types: [opened, reopened]
branches:
- develop
- master
- main
- 'feature/**'

jobs:
lint-backend:
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/linter-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
name: Lint Frontend Application
run-name: Linting The Next.Js Frontend


on:
push:
branches:
- develop
- master
- main
- 'feature/**'
pull_request:
types: [opened, reopened]
branches:
- develop
- master
- main
- 'feature/**'

jobs:
lint-frontend:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/testing-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ on:
- develop
- master
- main
- 'feature/**'
pull_request:
branches:
- develop
- master
- main
- 'feature/**'

workflow_run:
workflows: ["Lint Backend Application"]
types:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/testing-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name: Frontend Unit Testing
run-name: ${{ github.event_name }} event by ${{ github.actor }}


on:
push:
branches:
- develop
- master
- main
- 'feature/**'
pull_request:
branches:
- develop
- master
- main
- 'feature/**'

workflow_run:
workflows: ["Lint Frontend Application"]
types:
Expand Down
3 changes: 3 additions & 0 deletions backend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ module.exports = {
],
coverageDirectory: "coverage",
coverageReporters: ["text", "lcov"],
testPathIgnorePatterns: [
"<rootDir>/public/",
],
};
Loading

0 comments on commit 85b1b18

Please sign in to comment.