Skip to content

Commit

Permalink
Merge branch 'main' into rust-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishab87 authored Feb 18, 2025
2 parents 8429b1a + 7d06e37 commit 450c60b
Show file tree
Hide file tree
Showing 58 changed files with 4,870 additions and 870 deletions.
77 changes: 43 additions & 34 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
# This workflow is named "Merge Check" and gets triggered on pull request reviews
name: Merge Check
name: "PR Check for PictoPy"

on:
pull_request_review:
# Trigger this workflow when a pull request review is submitted
# Trigger this workflow when a pull request review is submitted
types: [submitted]
pull_request:
paths:
- "backend/**"
- "frontend/**"

# This workflow will build your tauri app without uploading it anywhere.
jobs:
build-tauri:
permissions:
# Grant write permission to repository contents
contents: write
test-tauri:
strategy:
# Stop all parallel jobs on first failure
fail-fast: true
runs-on: ubuntu-22.04
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "ubuntu-22.04"
args: ""
- platform: "windows-latest"
args: ""

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
# Check out the repository code

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup Node.js
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: swatinem/rust-cache@v2
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Cache Rust build artifacts for faster build times
workspaces: './src-tauri -> target'

- name: Install frontend dependencies
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.

- name: install frontend dependencies
run: |
cd frontend
npm install
- name: Build Tauri
uses: tauri-apps/tauri-action@v0
with:
# Run the Tauri build in the frontend directory
projectPath: frontend
# If tagName and releaseId are omitted tauri-action will only build the app and won't try to upload any assets.
- uses: tauri-apps/tauri-action@v0
env:
# Use secrets for signing the Tauri app
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg==
TAURI_SIGNING_PRIVATE_KEY_PASSWORD : pass
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: pass
with:
projectPath: ./frontend
args: ${{ matrix.args }}
# Run the Tauri build in the frontend directory
92 changes: 92 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI for PictoPy

on:
pull_request:
branches:
- main

jobs:
# Frontend Test Job
frontend:
runs-on: ubuntu-latest
name: Frontend Tests
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install Dependencies & Run Tests
run: |
cd frontend
npm install
npm test
# Backend Test Job
backend:
runs-on: ubuntu-latest
name: Backend Tests
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Python Dependencies & Run Tests
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
pyinstaller main.py --name PictoPy_Server --onedir --distpath dist
pytest
# Tauri Test Job
tauri:
runs-on: ubuntu-latest
name: Tauri Tests
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Dependencies for Tauri
run: |
sudo apt-get update -y
echo "deb http://archive.ubuntu.com/ubuntu jammy main universe multiverse" | sudo tee /etc/apt/sources.list.d/ubuntu-jammy.list

echo "deb http://security.ubuntu.com/ubuntu jammy-security main universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ubuntu-jammy-security.list

sudo apt-get update -y

sudo apt-get install -y \
curl build-essential libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev \
wget xz-utils libssl-dev libglib2.0-dev libgirepository1.0-dev pkg-config \
software-properties-common libjavascriptcoregtk-4.0-dev libjavascriptcoregtk-4.1-dev \
libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev file libglib2.0-dev libgl1-mesa-glx

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install Frontend Dependencies
run: |
cd frontend
npm install
- name: Run Tauri Tests
run: |
cd frontend/src-tauri
cargo test
6 changes: 5 additions & 1 deletion backend/app/database/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ def get_objects_db(path):

class_ids_json = result[0]
class_ids = json.loads(class_ids_json)
class_ids = class_ids.split(",")
if isinstance(class_ids, list):
class_ids = [str(class_id) for class_id in class_ids]
else:
class_ids = class_ids.split(",")


conn_mappings = sqlite3.connect(MAPPINGS_DATABASE_PATH)
cursor_mappings = conn_mappings.cursor()
Expand Down
Loading

0 comments on commit 450c60b

Please sign in to comment.