Skip to content

Commit

Permalink
Merge pull request #419 from COS301-SE-2024/V1.0.0
Browse files Browse the repository at this point in the history
V1.0.0
  • Loading branch information
waveyboym authored Oct 1, 2024
2 parents 0da0807 + ad12f38 commit 92f80c0
Show file tree
Hide file tree
Showing 526 changed files with 65,801 additions and 10,708 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build Documentation 📋🏗️

on:
pull_request:
branches: ["develop"]
paths: [
"documentation/occupi-docs/pages/**",
"documentation/occupi-docs/components/**",
"documentation/occupi-docs/.gitignore",
"documentation/occupi-docs/next.config.js",
"documentation/occupi-docs/package.json",
"documentation/occupi-docs/theme.config.tsx",
"documentation/occupi-docs/tsconfig.json",
".github/workflows/deploy-docs.yml"
]

workflow_dispatch:

defaults:
run:
working-directory: documentation/occupi-docs

jobs:
# Build job
build-test:
name: 🏗️ Build
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v4

- name: 🏗 Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest # or "latest", "canary", <sha>

- name: 📦 Install dependencies with Bun
run: bun install

- name: 🚀 Build with Next.js
run: bun run build

# test docker build and up the container then down
build-test-docker:
name: 🐋 Build Test Docker Container
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4

- name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: 🐳 Build Docker image
run: |
docker build --no-cache -t ${{ secrets.DOCKER_USERNAME }}/occupi-documentation:latest .
- name: ✅ Echo success message
run: echo "Docker build successful"
57 changes: 57 additions & 0 deletions .github/workflows/build-landing-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build Landing page 🏗️

on:
pull_request:
branches: ["develop"]
paths: [
"frontend/occupi/**",
".github/workflows/build-landing-page.yml"
]

workflow_dispatch:

defaults:
run:
working-directory: frontend/occupi

jobs:
# Build job
build-test:
name: 🏗️ Build
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v4

- name: 🏗 Setup node
uses: actions/setup-node@v4
with:
node-version: "18"

- name: 📦 Install dependencies with node
run: npm install

- name: 🚀 Build with Next.js
run: npm run build

# test docker build and up the container then down
build-test-docker:
name: 🐋 Build Test Docker Container
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4

- name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: 🐳 Build Docker image
run: |
docker build --no-cache -t ${{ secrets.DOCKER_USERNAME }}/occupi:latest .
- name: ✅ Echo success message
run: echo "Docker build successful"
22 changes: 22 additions & 0 deletions .github/workflows/build-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,25 @@ jobs:
- name: ✅ Build completed
run: echo "Build completed successfully!"

# test docker build and up the container then down
build-test-docker:
name: 🐋 Build Test Docker Container
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4

- name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: 🐳 Build Docker image
run: |
docker build --no-cache -t ${{ secrets.DOCKER_USERNAME }}/attendance-model:latest .
- name: ✅ Echo success message
run: echo "Docker build successful"
28 changes: 26 additions & 2 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,33 @@ jobs:
- name: 🚀 Build with Next.js
run: bun run build

# test docker build and up the container then down
build-test-docker:
name: 🐋 Build Test Docker Container
runs-on: ubuntu-latest
needs: build-test

steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4

- name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: 🐳 Build Docker image
run: |
docker build --no-cache -t ${{ secrets.DOCKER_USERNAME }}/occupi-documentation:latest .
- name: ✅ Echo success message
run: echo "Docker build successful"

build-push-docker:
name: 🐋 Build and Push Documentation Docker Image
runs-on: ubuntu-latest
needs: build-test
needs: build-test-docker

steps:
- name: ⬇️ Checkout code
Expand Down Expand Up @@ -98,6 +121,7 @@ jobs:
script: |
cd /home/${{ secrets.VM_USERNAME }}/occupi-docs/documentation/occupi-docs
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml down
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml down --rmi all
docker image prune -f
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml pull
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml up -d
34 changes: 27 additions & 7 deletions .github/workflows/deploy-golang-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,33 @@ jobs:
run: |
go build -v cmd/occupi-backend/main.go
# test docker build and up the container then down
build-test-docker:
name: 🐋 Build Test Docker Container
runs-on: ubuntu-latest
needs: build-test

steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4

- name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: 🐳 Build Docker image
run: |
docker build --no-cache -t ${{ secrets.DOCKER_USERNAME }}/occupi-backend:latest-develop -f Dockerfile.dev .
- name: ✅ Echo success message
run: echo "Docker build successful"

build-push-docker:
name: 🐋 Build and Push Develop Docker Image
runs-on: ubuntu-latest
needs: build-test
needs: build-test-docker

steps:
- name: ⬇️ Checkout code
Expand Down Expand Up @@ -89,17 +112,13 @@ jobs:
run: |
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --quiet --batch --yes --decrypt --passphrase-fd 0 configs/centrifugo.config.json.gpg > centrifugo.config.json
- name: ⏩ Move prometheus config
run: |
mv docker/prometheus.dev.yml prometheus.dev.yml
- name: 🪷 Copy files to VM
uses: appleboy/scp-action@v0.1.5
with:
host: ${{ secrets.VM_IP }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.VM_SSH_KEY }}
source: "occupi-backend/docker-compose.dev.yml,occupi-backend/Dockerfile.dev,occupi-backend/centrifugo.config.json,occupi-backend/prometheus.dev.yml"
source: "occupi-backend/docker-compose.dev.yml,occupi-backend/Dockerfile.dev,occupi-backend/centrifugo.config.json"
target: "/home/${{ secrets.VM_USERNAME }}/occupi-backend-dev"

# SSH to VM and run commands
Expand All @@ -117,7 +136,8 @@ jobs:
RABBITMQ_DEFAULT_USER=${{ secrets.RABBITMQ_DEFAULT_USER }} \
RABBITMQ_DEFAULT_PASS=${{ secrets.RABBITMQ_DEFAULT_PASS }} \
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} \
docker compose -f docker-compose.dev.yml down
docker compose -f docker-compose.dev.yml down --rmi all
docker image prune -f
MONGO_INITDB_ROOT_USERNAME=${{ secrets.MONGO_INITDB_ROOT_USERNAME }} \
MONGO_INITDB_ROOT_PASSWORD=${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} \
RABBITMQ_DEFAULT_USER=${{ secrets.RABBITMQ_DEFAULT_USER }} \
Expand Down
34 changes: 27 additions & 7 deletions .github/workflows/deploy-golang-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,31 @@ jobs:
run: |
go build -v cmd/occupi-backend/main.go
build-push-docker:
# test docker build and up the container then down
build-test-docker:
name: 🐋 Build Test Docker Container
runs-on: ubuntu-latest
needs: build

steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4

- name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: 🐳 Build Docker image
run: |
docker build --no-cache -t ${{ secrets.DOCKER_USERNAME }}/occupi-backend:latest -f Dockerfile.prod .
- name: ✅ Echo success message
run: echo "Docker build successful"

build-push-docker:
needs: build-test-docker
name: 🐋 Build and Push Master Docker Image
runs-on: ubuntu-latest

Expand Down Expand Up @@ -84,17 +107,13 @@ jobs:
run: |
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --quiet --batch --yes --decrypt --passphrase-fd 0 configs/centrifugo.config.json.gpg > centrifugo.config.json
- name: ⏩ Move prometheus config
run: |
mv docker/prometheus.prod.yml prometheus.prod.yml
- name: 🪷 Copy files to VM
uses: appleboy/scp-action@v0.1.5
with:
host: ${{ secrets.VM_IP }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.VM_SSH_KEY }}
source: "occupi-backend/docker-compose.prod.yml,occupi-backend/Dockerfile.prod,occupi-backend/centrifugo.config.json,occupi-backend/prometheus.prod.yml"
source: "occupi-backend/docker-compose.prod.yml,occupi-backend/Dockerfile.prod,occupi-backend/centrifugo.config.json"
target: "/home/${{ secrets.VM_USERNAME }}/occupi-backend-prod"

# SSH to VM and run commands
Expand All @@ -112,7 +131,8 @@ jobs:
RABBITMQ_DEFAULT_USER=${{ secrets.RABBITMQ_DEFAULT_USER }} \
RABBITMQ_DEFAULT_PASS=${{ secrets.RABBITMQ_DEFAULT_PASS }} \
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} \
docker compose -f docker-compose.prod.yml down
docker compose -f docker-compose.prod.yml down --rmi all
docker image prune -f
MONGO_INITDB_ROOT_USERNAME=${{ secrets.MONGO_INITDB_ROOT_USERNAME }} \
MONGO_INITDB_ROOT_PASSWORD=${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} \
RABBITMQ_DEFAULT_USER=${{ secrets.RABBITMQ_DEFAULT_USER }} \
Expand Down
40 changes: 32 additions & 8 deletions .github/workflows/deploy-landing-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,44 @@ jobs:
- name: ⬇️ Checkout
uses: actions/checkout@v4

- name: 🏗 Setup Bun
uses: oven-sh/setup-bun@v1
- name: 🏗 Setup node
uses: actions/setup-node@v4
with:
bun-version: latest # or "latest", "canary", <sha>
node-version: "18"

- name: 📦 Install dependencies with Bun
run: bun install
- name: 📦 Install dependencies with node
run: npm install

- name: 🚀 Build with Next.js
run: bun run build
run: npm run build

# test docker build and up the container then down
build-test-docker:
name: 🐋 Build Test Docker Container
runs-on: ubuntu-latest
needs: build-test

steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4

- name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: 🐳 Build Docker image
run: |
docker build --no-cache -t ${{ secrets.DOCKER_USERNAME }}/occupi:latest .
- name: ✅ Echo success message
run: echo "Docker build successful"

build-push-docker:
name: 🐋 Build and Push Landing Page Docker Image
runs-on: ubuntu-latest
needs: build-test
needs: build-test-docker

steps:
- name: ⬇️ Checkout code
Expand Down Expand Up @@ -92,6 +115,7 @@ jobs:
script: |
cd /home/${{ secrets.VM_USERNAME }}/occupi/frontend/occupi
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml down
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml down --rmi all
docker image prune -f
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml pull
DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} docker compose -f docker-compose.yml up -d
Loading

0 comments on commit 92f80c0

Please sign in to comment.