Skip to content

Commit

Permalink
Merge pull request #273 from COS301-SE-2024/chore/mobile/refactor
Browse files Browse the repository at this point in the history
Chore/mobile/refactor
  • Loading branch information
KamogeloMoeketse authored Aug 6, 2024
2 parents 9f95d5d + 7384ecf commit 84c76f6
Show file tree
Hide file tree
Showing 177 changed files with 17,495 additions and 8,831 deletions.
70 changes: 30 additions & 40 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ jobs:
name: Build Backend Binary
runs-on: ${{ matrix.os }}

# set working directory
defaults:
run:
working-directory: occupi-backend

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -50,22 +45,17 @@ jobs:

- name: Build application
run: |
cd occupi-backend
go build -o occupi-backend_${{ matrix.goos }}_${{ matrix.arch }}${{ matrix.extension }} ${{ matrix.args }} -v cmd/occupi-backend/main.go
- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: occupi-backend_${{ matrix.goos }}_${{ matrix.arch }}${{ matrix.extension }}
path: occupi-backend_${{ matrix.goos }}_${{ matrix.arch }}${{ matrix.extension }}
path: occupi-backend/occupi-backend_${{ matrix.goos }}_${{ matrix.arch }}${{ matrix.extension }}

build-android:
runs-on: ubuntu-latest

# set working directory
defaults:
run:
working-directory: frontend/occupi-mobile4

steps:
- name: Setup repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -93,25 +83,19 @@ jobs:
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
run: npm install --legacy-peer-deps
run: npm ci

- name: Build Android app
run: eas build --platform android --profile preview --local --output ${{ github.workspace }}/occupi-mobile-android.apk
run: eas build --platform android --profile preview --local --output ${{ github.workspace }}/app-release.apk

- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: occupi-mobile-android.apk
path: occupi-mobile-android.apk
name: app-release
path: ${{ github.workspace }}/app-release.apk

build-ios:
runs-on: macos-latest

# set working directory
defaults:
run:
working-directory: frontend/occupi-mobile4

steps:
- name: Setup repo
uses: actions/checkout@v4
Expand All @@ -130,16 +114,16 @@ jobs:
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
run: npm install --legacy-peer-deps
run: npm ci

- name: Build iOS app
run: eas build --platform ios --local --non-interactive --output ${{ github.workspace }}/occupi-mobile-ios.ipa
run: eas build --platform ios --local --non-interactive --output ${{ github.workspace }}/app-release.ipa

- name: Upload IPA artifact
uses: actions/upload-artifact@v4
with:
name: occupi-mobile-ios
path: ${{ github.workspace }}/occupi-mobile-ios.ipa
name: app-release
path: ${{ github.workspace }}/app-release.ipa

build-vite-app:
name: Build Vite App
Expand Down Expand Up @@ -168,7 +152,7 @@ jobs:
zip -r dist/occupi-web.zip frontend/occupi-web/dist
- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: occupi-web
path: frontend/occupi-web/dist/occupi-web.zip
Expand Down Expand Up @@ -197,11 +181,6 @@ jobs:
extension: ""
args: ''
arch: x86_64

# set working directory
defaults:
run:
working-directory: frontend/occupi-desktop

name: Build Tauri App
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -258,10 +237,21 @@ jobs:
runs-on: ubuntu-latest
needs: [build-backend-binary, build-android, build-ios, build-vite-app, build-tauri-app]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
# according to the docs, if name is not specified, all artifacts are downloaded
# https://github.com/actions/download-artifact/tree/v4/?tab=readme-ov-file#inputs
with:
path: dist
merge-multiple: true
- name: Install GitHub CLI
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
- name: Login to GitHub
run: |
gh auth login
- name: Create a Release
run: |
gh release create v1.0.0 -t "v1.0.0" -n "v1.0.0" ./occupi-backend/occupi-backend ./occupi-frontend/occupi-frontend ./occupi-frontend/dist ./occupi-frontend/build ./occupi-frontend/target/release/occupi-frontend
- name: Upload Release Assets
run: |
gh release upload v1.0.0 ./occupi-backend/occupi-backend ./occupi-frontend/occupi-frontend ./occupi-frontend/dist ./occupi-frontend/build ./occupi-frontend/target/release/occupi-frontend
41 changes: 0 additions & 41 deletions .github/workflows/build-python.yml

This file was deleted.

34 changes: 16 additions & 18 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build 🏗️ and Deploy Documentation 🛳️
name: Deploy Docs site to Live site

on:
push:
Expand All @@ -10,8 +10,7 @@ on:
"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"
"documentation/occupi-docs/tsconfig.json"
]

workflow_dispatch:
Expand All @@ -23,45 +22,44 @@ defaults:
jobs:
# Build job
build-test:
name: 🏗️ Build
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout
- name: Checkout
uses: actions/checkout@v4

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

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

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

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

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

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

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

- name: 🧑‍💻 Login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: 🐳 Build and push Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: documentation/occupi-docs
Expand All @@ -71,15 +69,15 @@ jobs:
tags: ${{ secrets.DOCKER_USERNAME }}/occupi-documentation:latest

deploy:
name: 🛳️ Deploy Documentation
name: Deploy Documentation
runs-on: ubuntu-latest
needs: build-push-docker

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

- name: 🪷 Copy files to VM
- name: Copy files to VM
uses: appleboy/[email protected]
with:
host: ${{ secrets.VM_IP }}
Expand All @@ -89,7 +87,7 @@ jobs:
target: "/home/${{ secrets.VM_USERNAME }}/occupi-docs"

# SSH to VM and run commands
- name: 🚀 SSH to VM
- name: SSH to VM
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VM_IP }}
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/deploy-golang-develop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build 🏗️ and Deploy Golang App 🛳️ to Develop 🚈
name: Build and Deploy Dev golang

on:
push:
Expand All @@ -18,52 +18,52 @@ defaults:

jobs:
build-test:
name: 🏗️ Build
name: Build
runs-on: ubuntu-latest

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

- name: 🏗 Set up Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21' # Specify the Go version you are using

- name: 🚀 Build the code
- name: Build the code
run: |
go build -v cmd/occupi-backend/main.go
build-push-docker:
name: 🐋 Build and Push Develop Docker Image
name: Build and Push Develop Docker Image
runs-on: ubuntu-latest
needs: build-test

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

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

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

- name: 🧑‍💻 Login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: 🔓 Decrypt default variables
- name: Decrypt default variables
run: |
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --quiet --batch --yes --decrypt --passphrase-fd 0 configs/config.yaml.gpg > configs/config.yaml
- name: 🔓 Decrypt test variables
- name: Decrypt test variables
run: |
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --quiet --batch --yes --decrypt --passphrase-fd 0 configs/dev.deployed.yaml.gpg > configs/dev.deployed.yaml
- name: 🐳 Build and push Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: occupi-backend
Expand All @@ -73,15 +73,15 @@ jobs:
tags: ${{ secrets.DOCKER_USERNAME }}/occupi-backend:latest-develop

deploy:
name: 🛳️ Deploy for Develop
name: Deploy for Develop
runs-on: ubuntu-latest
needs: build-push-docker

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

- name: 🪷 Copy files to VM
- name: Copy files to VM
uses: appleboy/[email protected]
with:
host: ${{ secrets.VM_IP }}
Expand All @@ -91,7 +91,7 @@ jobs:
target: "/home/${{ secrets.VM_USERNAME }}/occupi-backend-dev"

# SSH to VM and run commands
- name: 🚀 SSH to VM
- name: SSH to VM
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VM_IP }}
Expand Down
Loading

0 comments on commit 84c76f6

Please sign in to comment.