Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/test_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: "Test Build"

on:
push:
branches:
- testing
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
PROCEED_TO_AUTH_URI: ${{ secrets.PROCEED_TO_AUTH_URI }}
FINNISH_AUTH_URI: ${{ secrets.FINNISH_AUTH_URI }}

jobs:
test-tauri:
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest"
args: "--target aarch64-apple-darwin"
- platform: "macos-latest"
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04"
args: ""
- platform: "windows-latest"
args: ""

runs-on: ${{ matrix.platform }}
defaults:
run:
shell: "bash"
steps:
- uses: actions/checkout@v4

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: "pnpm"

- name: install frontend dependencies
run: pnpm install

- name: Cache Rust build
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"

- name: Create .env file for Vite
run: |
echo VITE_CLIENT_ID=${{secrets.CLIENT_ID }} >> .env
echo VITE_CLIENT_SECRET=${{secrets.CLIENT_SECRET }} >> .env
echo VITE_PROCEED_TO_AUTH_URI=${{secrets.PROCEED_TO_AUTH_URI }} >> .env
echo VITE_FINNISH_AUTH_URI=${{secrets.FINNISH_AUTH_URI }} >> .env

- name: Create .env file for Tauri
run: |
echo CLIENT_ID=${{ secrets.CLIENT_ID }} >> ./src-tauri/.env
echo CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} >> ./src-tauri/.env

# 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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: ${{ matrix.args }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}
path: |
src-tauri/target/release/**
4 changes: 0 additions & 4 deletions TODO-UI.md

This file was deleted.

27 changes: 0 additions & 27 deletions splashscreen.html

This file was deleted.

46 changes: 36 additions & 10 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ futures-util = "0.3.31"
colored = "3.0.0"
uuid = { version = "1.16.0", features = ["v4"] }
urlencoding = "2.1.3"
tokio = { version = "1.47.1", features = ["full"] }

[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\"))".dependencies]
tauri-plugin-single-instance = { version = "2.3.0", features = ["deep-link"] }
9 changes: 1 addition & 8 deletions src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,5 @@
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"core:default",
"opener:default",
"store:default",
"deep-link:default",
"http:default",
"store:allow-load"
]
"permissions": ["core:default", "opener:default", "store:default", "deep-link:default", "http:default"]
}
15 changes: 4 additions & 11 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,18 @@ use tauri::{AppHandle, Emitter, Manager, Runtime};

use crate::{
log,
logging::Log,
new_github_api::GithubAPI,
project::{
task::{DraftTask, NewDraftTaskPayload, NewTaskPayload, Task},
Project, ProjectPatchArgs, ProjectPayload,
},
utils::{dbg_store, get_store, get_token, IssueExt},
utils::{dbg_store, get_logs_store, get_store, get_token, IssueExt},
};

#[tauri::command]
pub async fn hide_splash<R: Runtime>(app: AppHandle<R>) -> crate::Result {
if let Some(splashscreen) = app.get_webview_window("splashscreen") {
let _ = splashscreen.close();
}
app.get_webview_window("main")
.expect("could not access main window")
.show()
.expect("could not display main window");

Ok(())
pub async fn persist_log<R: Runtime>(app: AppHandle<R>, log: Log) {
log.persist(get_logs_store(app).ok().as_ref()).await
}

#[tauri::command]
Expand Down
6 changes: 4 additions & 2 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod auth;
mod commands;
mod experimental;
mod github_api;
mod logging;
mod new_github_api;
mod project;
mod setup;
Expand All @@ -10,6 +11,7 @@ mod utils;
use setup::init_tauri_plugin_single_instance;

pub const STORE_PATH: &str = "store.json";
pub const LOGS_STORE_PATH: &str = "task_bridge_logs.json";
pub const ENV_STR: &'static str = include_str!("../.env");
pub const TEAM_LOGINS_SEPERATOR: &str = "-;;-";

Expand All @@ -18,14 +20,13 @@ pub type Result<T = ()> = std::result::Result<T, String>;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
// .plugin(tauri_plugin_single_instance::init(init_tauri_plugin_single_instance))
.plugin(tauri_plugin_single_instance::init(init_tauri_plugin_single_instance))
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_store::Builder::new().build())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_http::init())
.setup(setup::setup)
.invoke_handler(tauri::generate_handler![
commands::hide_splash,
commands::fetch_save_and_return_user,
commands::find_users_matching_query,
commands::create_project,
Expand All @@ -46,6 +47,7 @@ pub fn run() {
commands::update_project_team,
commands::update_general_project_metadata,
commands::sync_projects_with_github_v2,
commands::persist_log,
experimental::clear_store,
])
.run(tauri::generate_context!())
Expand Down
40 changes: 40 additions & 0 deletions src-tauri/src/logging.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use std::sync::Arc;

use serde::{Deserialize, Serialize};
use tauri::Runtime;
use tauri_plugin_store::Store;

use crate::utils::new_id;

#[derive(Deserialize, Serialize)]
pub struct Log {
log_type: String,
title: String,
body: Option<String>,
context: Option<String>,
}

impl Log {
pub async fn persist<R: Runtime>(self, logs_store: Option<&Arc<Store<R>>>) {
if let Some(logs_store) = logs_store {
self.persist_to_logs_store(logs_store)
}
}

fn generate_id(&self) -> String {
format!(
"{}__{}__{}",
chrono::Utc::now().timestamp_micros(),
self.log_type,
new_id()
)
}

fn persist_to_logs_store<R: Runtime>(self, logs_store: &Arc<Store<R>>) {
let id = self.generate_id();

if let Ok(val) = serde_json::to_value(self) {
logs_store.set(id, val);
}
}
}
Loading
Loading