Skip to content

Commit

Permalink
Merge pull request #277 from COS301-SE-2024/revert-273-chore/mobile/r…
Browse files Browse the repository at this point in the history
…efactor

Revert "Chore/mobile/refactor"
  • Loading branch information
waveyboym authored Aug 6, 2024
2 parents 47bc924 + e62eb4d commit a2d9869
Show file tree
Hide file tree
Showing 176 changed files with 8,837 additions and 17,462 deletions.
70 changes: 40 additions & 30 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ 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 @@ -45,17 +50,22 @@ 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@v3
uses: actions/upload-artifact@v4
with:
name: occupi-backend_${{ matrix.goos }}_${{ matrix.arch }}${{ matrix.extension }}
path: occupi-backend/occupi-backend_${{ matrix.goos }}_${{ matrix.arch }}${{ matrix.extension }}
path: 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 @@ -83,19 +93,25 @@ jobs:
token: ${{ secrets.EXPO_TOKEN }}

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

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

- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: app-release
path: ${{ github.workspace }}/app-release.apk
name: occupi-mobile-android.apk
path: occupi-mobile-android.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 @@ -114,16 +130,16 @@ jobs:
token: ${{ secrets.EXPO_TOKEN }}

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

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

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

build-vite-app:
name: Build Vite App
Expand Down Expand Up @@ -152,7 +168,7 @@ jobs:
zip -r dist/occupi-web.zip frontend/occupi-web/dist
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: occupi-web
path: frontend/occupi-web/dist/occupi-web.zip
Expand Down Expand Up @@ -181,6 +197,11 @@ 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 @@ -237,21 +258,10 @@ jobs:
runs-on: ubuntu-latest
needs: [build-backend-binary, build-android, build-ios, build-vite-app, build-tauri-app]
steps:
- 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
- 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
41 changes: 41 additions & 0 deletions .github/workflows/build-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build Python App 🏗️

on:
pull_request:
branches: ["develop"]
paths: [
"python-code/**",
".github/workflows/build-python.yml"
]

workflow_dispatch:

defaults:
run:
working-directory: python-code

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

strategy:
matrix:
python-version: [3.8, 3.9, 3.11]

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

- name: 🏗 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: ✅ Build completed
run: echo "Build completed successfully!"
34 changes: 18 additions & 16 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Docs site to Live site
name: Build 🏗️ and Deploy Documentation 🛳️

on:
push:
Expand All @@ -10,7 +10,8 @@ on:
"documentation/occupi-docs/next.config.js",
"documentation/occupi-docs/package.json",
"documentation/occupi-docs/theme.config.tsx",
"documentation/occupi-docs/tsconfig.json"
"documentation/occupi-docs/tsconfig.json",
".github/workflows/deploy-docs.yml"
]

workflow_dispatch:
Expand All @@ -22,44 +23,45 @@ 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 @@ -69,15 +71,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/scp-action@v0.1.5
with:
host: ${{ secrets.VM_IP }}
Expand All @@ -87,7 +89,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 Dev golang
name: Build 🏗️ and Deploy Golang App 🛳️ to Develop 🚈

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/scp-action@v0.1.5
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 a2d9869

Please sign in to comment.