Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
t-lohse committed Feb 26, 2024
1 parent 5a26c1b commit b761a0b
Show file tree
Hide file tree
Showing 37 changed files with 214 additions and 119 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Artifacts

on:
workflow_dispatch:
push:

jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: cargo build --release
uses: clechasseur/rs-cargo@v1
with:
command: build
args: --release
- uses: actions/upload-artifact@v3
with:
name: ecdar_app-${{ matrix.os }}
path: ${{ runner.os == 'Windows' && 'target/release/ecdar_app.exe' || 'target/release/ecdar_app' }}
if-no-files-found: error
retention-days: 7
30 changes: 30 additions & 0 deletions .github/workflows/check_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check formatting

on:
workflow_dispatch:
push:

jobs:
fmt:
name: cargo fmt & Clippy lint and check
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install llvm protobuf-compiler
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: cargo fmt --all
uses: clechasseur/rs-cargo@v1
with:
command: fmt
args: --all -- --check
- name: clippy --all-targets --all-features
uses: clechasseur/rs-clippy-check@v3
with:
args: --all-targets --all-features -- -D warnings
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test

on:
push:
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
# Label of the container job
container-job:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
# Docker Hub image that `container-job` executes in
container: rust

# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
ports:
- 5432:5432
# Provide the password and db name for postgres
env:
POSTGRES_PASSWORD: 1234
POSTGRES_DB: ecdar_api
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Install dependencies
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Run tests
env:
TEST_DATABASE_URL: "postgresql://postgres:1234@postgres:5432/ecdar_api"
run: cargo test -- --test-threads=1
56 changes: 0 additions & 56 deletions .github/workflows/test_format.yaml

This file was deleted.

6 changes: 5 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "Ecdar-GUI-Web"]
path = Ecdar-GUI-Web
url = https://github.com/ECDAR-AAU-SW-P5/Ecdar-GUI-Web.git
url = [email protected]:Ecdar/Ecdar-GUI-Web.git
[submodule "Ecdar-ProtoBuf"]
path = Ecdar-ProtoBuf
url = [email protected]:Ecdar/Ecdar-ProtoBuf.git
branch = SW5
8 changes: 8 additions & 0 deletions .idea/.gitignore

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

11 changes: 11 additions & 0 deletions .idea/Ecdar-GUI-Native.iml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

8 changes: 8 additions & 0 deletions .idea/vcs.xml

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

45 changes: 39 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
[workspace]
resolver = "2"
members = [
"src-tauri",
"ecdar-gui-macros"
]
[package]
name = "ecdar_app"
version = "0.1.0"
description = "A Tauri App"
authors = ["Thomas Krogh Lohse"]
build = "src/build.rs"
license = ""
repository = ""
default-run = "ecdar_app"
edition = "2021"


[lib]
proc-macro = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "1.4.0", features = [ ] }
tonic-build = "0.11.0"

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.4.0", features = [ "dialog-confirm", "dialog-save", "dialog-open", "fs-read-dir", "fs-create-dir", "fs-remove-dir", "fs-read-file", "fs-write-file", "fs-remove-file", "path-all" ] }
tauri-plugin-persisted-scope = "0.1.3"
tonic = "0.11.0"
prost = "0.12.3"
rand = "0.8.5"
tokio = "1.33.0"
ecdar-protobuf-transpiler = { git = "https://github.com/ECDAR-AAU-SW-P5/Ecdar-ProtoBuf-Transpiler-rs", version = "0.1.0" }
proc-macro2 = "1.0.69"
quote = "1.0.33"


[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
# DO NOT REMOVE!!
custom-protocol = [ "tauri/custom-protocol" ]
2 changes: 1 addition & 1 deletion Ecdar-GUI-Web
Submodule Ecdar-GUI-Web updated 75 files
+2 −0 .eslintignore
+10 −2 .eslintrc.cjs
+3 −0 .gitignore
+6 −0 .gitmodules
+2 −0 .prettierignore
+1 −0 Ecdar-ProtoBuf
+4 −1 bundleProjectExamples.ts
+75 −0 compileProtobuffers.ts
+5 −1 package.json
+16 −0 playwright.config.ts
+101 −4 src/lib/GlobalCssProperties.json
+1 −1 src/lib/classes/automaton/IdMap.ts
+55 −0 src/lib/classes/communication.ts
+31 −0 src/lib/classes/communication/ecdar-web.ts
+23 −0 src/lib/classes/communication/tauri.ts
+270 −34 src/lib/classes/styling/GlobalCssSchemesLoader.ts
+156 −0 src/lib/classes/styling/GlobalFontLoader.ts
+11 −0 src/lib/classes/styling/ZodSchemas/AttributeSchemas/FontAttribute.ts
+27 −0 src/lib/classes/styling/ZodSchemas/CSSVariables.ts
+13 −2 src/lib/classes/styling/ZodSchemas/MediaScheme.ts
+15 −3 src/lib/classes/styling/ZodSchemas/MediaSchemes.ts
+21 −10 src/lib/components/buttons/SvgButton.svelte
+15 −3 src/lib/components/contextMenu/contentTypes/locationMenu/LocationMenu.svelte
+66 −0 src/lib/components/modal/Modal.svelte
+9 −2 src/lib/components/overlayMenu/OverlayMenu.svelte
+9 −3 src/lib/components/overlayMenu/elements/Button.svelte
+50 −48 src/lib/components/project/ProjectItem.svelte
+3 −3 src/lib/components/project/ProjectItemDropDownMenu.svelte
+5 −1 src/lib/components/project/globalDeclaration/GlobalDeclaration.svelte
+517 −0 src/lib/components/settings/ColorSettings.svelte
+92 −0 src/lib/components/settings/FontSettings.svelte
+52 −0 src/lib/components/settings/SettingsView.svelte
+3 −0 src/lib/components/settings/showSettings.ts
+115 −43 src/lib/components/startScreen/StartScreen.svelte
+39 −0 src/lib/components/startScreen/TimeStamp.svelte
+0 −0 src/lib/components/svgView/DraggableSVG.svelte
+0 −0 src/lib/components/svgView/Edge.svelte
+0 −0 src/lib/components/svgView/Label.svelte
+0 −0 src/lib/components/svgView/Location.svelte
+2 −1 src/lib/components/svgView/Nail.svelte
+0 −0 src/lib/components/svgView/Node.svelte
+2 −2 src/lib/components/svgView/SvgView.svelte
+9 −0 src/lib/components/svgView/panzoom/css.ts
+9 −0 src/lib/components/svgView/panzoom/isExcluded.ts
+0 −0 src/lib/components/svgView/panzoom/panzoom.ts
+9 −0 src/lib/components/svgView/panzoom/pointers.ts
+9 −0 src/lib/components/svgView/panzoom/types.ts
+0 −0 src/lib/components/svgView/state.ts
+6 −0 src/lib/components/tabs/Tab.ts
+48 −0 src/lib/components/tabs/Tabs.svelte
+1 −2 src/lib/components/topBar/DropDownButton.svelte
+28 −11 src/lib/components/topBar/TopBar.svelte
+39 −0 src/lib/components/topBar/aboutUI/AboutUI.svelte
+3 −0 src/lib/components/topBar/aboutUI/showAboutUI.ts
+1 −1 src/lib/globalState/activeProject.ts
+3 −0 src/lib/interfaces/IAboutUI.ts
+4 −0 src/lib/interfaces/IModalComponent.ts
+10 −7 src/routes/+layout.svelte
+3 −2 src/routes/+page.svelte
+1 −1 src/tests/lib/classes/console/success.test.ts
+1 −1 src/tests/lib/classes/styling/GlobalCssSchemesLoader.test.ts
+1 −0 tests/lib/classes/styling/GlobalCssSchemesLoader.test.ts
+62 −11 tests/lib/components/project/project.test.ts
+34 −5 tests/lib/components/query/query.test.ts
+230 −0 tests/lib/components/settings/colorSettings.test.ts
+163 −0 tests/lib/components/settings/fontSettings.test.ts
+87 −0 tests/lib/components/settings/settings.test.ts
+ tests/lib/components/settings/testfiles/Lobster-Regular.ttf
+0 −0 tests/lib/components/settings/testfiles/emptyNonFontFile.ttf
+1 −0 tests/lib/components/settings/testfiles/hello.txt
+5 −0 tests/lib/components/sidePanel/sidePanel.test.ts
+20 −0 tests/lib/components/topBar/aboutUI/about.test.ts
+29 −0 tests/lib/components/topBar/topbar.test.ts
+2 −1 vite.config.ts
+706 −412 yarn.lock
1 change: 1 addition & 0 deletions Ecdar-ProtoBuf
Submodule Ecdar-ProtoBuf added at f5ae95
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $ git clone https://github.com/ECDAR-AAU-SW-P5/Ecdar-GUI-Web.git

#### Linux

Install `node`, `npm` and `cargo`
Install `node`, `npm` and `cargo`, along with [this guide for Tauri](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-linux)
###### Arch
```
$ sudo pacman -S cargo nodejs npm
Expand All @@ -34,6 +34,7 @@ $ sudo apt install cargo node npm
$ npm i -g vite
$ cd Ecdar-GUI-WEB
$ npm install
$ git submodule update --init --recursive
$ cd ..
```
### Cargo dependencies
Expand Down
14 changes: 0 additions & 14 deletions ecdar-gui-macros/Cargo.toml

This file was deleted.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
3 changes: 0 additions & 3 deletions src-tauri/.gitignore

This file was deleted.

32 changes: 0 additions & 32 deletions src-tauri/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions src-tauri/build.rs

This file was deleted.

7 changes: 7 additions & 0 deletions src/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
tonic_build::compile_protos("Ecdar-ProtoBuf/services.proto").unwrap();
// Tell cargo to invalidate the crate when the protobuf repository changes
println!("cargo:rerun-if-changed=Ecdar-ProtoBuf");

tauri_build::build()
}
File renamed without changes.
5 changes: 3 additions & 2 deletions src-tauri/src/main.rs → src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use tauri::Manager;
tonic::include_proto!("ecdar_proto_buf");

#[derive(serde::Serialize, serde::Deserialize)]
pub enum GrpcError {
FailedToConnect,
FailedResponse,
}

ecdar_gui_macros::create_functions!();
//ecdar_app::create_functions!();

fn main() {
tauri::Builder::default()
Expand All @@ -21,7 +22,7 @@ fn main() {
}
Ok(())
})
.invoke_handler(ecdar_gui_macros::generate_handler![])
//.invoke_handler(ecdar_app::generate_handler![])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
File renamed without changes.

0 comments on commit b761a0b

Please sign in to comment.