From b761a0bb2c110ee7e959ff7d8a42d7843f5f3302 Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:05:31 +0100 Subject: [PATCH 01/15] refactor --- .github/workflows/build_artifacts.yml | 36 +++++++++++ .github/workflows/check_format.yml | 30 ++++++++++ .github/workflows/test.yml | 55 +++++++++++++++++ .github/workflows/test_format.yaml | 56 ------------------ .gitmodules | 6 +- .idea/.gitignore | 8 +++ .idea/Ecdar-GUI-Native.iml | 11 ++++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 8 +++ Cargo.toml | 45 ++++++++++++-- Ecdar-GUI-Web | 2 +- Ecdar-ProtoBuf | 1 + README.md | 3 +- ecdar-gui-macros/Cargo.toml | 14 ----- {src-tauri/icons => icons}/128x128.png | Bin {src-tauri/icons => icons}/128x128@2x.png | Bin {src-tauri/icons => icons}/32x32.png | Bin .../icons => icons}/Square107x107Logo.png | Bin .../icons => icons}/Square142x142Logo.png | Bin .../icons => icons}/Square150x150Logo.png | Bin .../icons => icons}/Square284x284Logo.png | Bin .../icons => icons}/Square30x30Logo.png | Bin .../icons => icons}/Square310x310Logo.png | Bin .../icons => icons}/Square44x44Logo.png | Bin .../icons => icons}/Square71x71Logo.png | Bin .../icons => icons}/Square89x89Logo.png | Bin {src-tauri/icons => icons}/StoreLogo.png | Bin {src-tauri/icons => icons}/icon.icns | Bin {src-tauri/icons => icons}/icon.ico | Bin {src-tauri/icons => icons}/icon.png | Bin src-tauri/.gitignore | 3 - src-tauri/Cargo.toml | 32 ---------- src-tauri/build.rs | 3 - src/build.rs | 7 +++ {ecdar-gui-macros/src => src}/lib.rs | 0 {src-tauri/src => src}/main.rs | 5 +- src-tauri/tauri.conf.json => tauri.conf.json | 0 37 files changed, 214 insertions(+), 119 deletions(-) create mode 100644 .github/workflows/build_artifacts.yml create mode 100644 .github/workflows/check_format.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_format.yaml create mode 100644 .idea/.gitignore create mode 100644 .idea/Ecdar-GUI-Native.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 160000 Ecdar-ProtoBuf delete mode 100644 ecdar-gui-macros/Cargo.toml rename {src-tauri/icons => icons}/128x128.png (100%) rename {src-tauri/icons => icons}/128x128@2x.png (100%) rename {src-tauri/icons => icons}/32x32.png (100%) rename {src-tauri/icons => icons}/Square107x107Logo.png (100%) rename {src-tauri/icons => icons}/Square142x142Logo.png (100%) rename {src-tauri/icons => icons}/Square150x150Logo.png (100%) rename {src-tauri/icons => icons}/Square284x284Logo.png (100%) rename {src-tauri/icons => icons}/Square30x30Logo.png (100%) rename {src-tauri/icons => icons}/Square310x310Logo.png (100%) rename {src-tauri/icons => icons}/Square44x44Logo.png (100%) rename {src-tauri/icons => icons}/Square71x71Logo.png (100%) rename {src-tauri/icons => icons}/Square89x89Logo.png (100%) rename {src-tauri/icons => icons}/StoreLogo.png (100%) rename {src-tauri/icons => icons}/icon.icns (100%) rename {src-tauri/icons => icons}/icon.ico (100%) rename {src-tauri/icons => icons}/icon.png (100%) delete mode 100644 src-tauri/.gitignore delete mode 100644 src-tauri/Cargo.toml delete mode 100644 src-tauri/build.rs create mode 100644 src/build.rs rename {ecdar-gui-macros/src => src}/lib.rs (100%) rename {src-tauri/src => src}/main.rs (83%) rename src-tauri/tauri.conf.json => tauri.conf.json (100%) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml new file mode 100644 index 0000000..c8a5d11 --- /dev/null +++ b/.github/workflows/build_artifacts.yml @@ -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 diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml new file mode 100644 index 0000000..1ace49e --- /dev/null +++ b/.github/workflows/check_format.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8aa3ff6 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/.github/workflows/test_format.yaml b/.github/workflows/test_format.yaml deleted file mode 100644 index 8753f0d..0000000 --- a/.github/workflows/test_format.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: Check formatting - -on: - push: - branches: [main] - pull_request: - branches: [main] - -permissions: - contents: read - -jobs: - fmt: - name: Cargo fmt lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - uses: Swatinem/rust-cache@v2 - - - name: Run fmt lint - run: cargo fmt --all -- --check - - clippy: - name: Cargo clippy lint - runs-on: ubuntu-latest - steps: - - # DO NOT EDIT THIS MANUALLY, please only use the official installation instructions from: - # https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-linux - - name: Install native Tauri dependencies - run: sudo apt-get install libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev - - - name: Install protobuf compiler - run: sudo apt-get install protobuf-compiler - - - uses: actions/checkout@v4 - with: - submodules: true - - - uses: Swatinem/rust-cache@v2 - - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: yarn - cache-dependency-path: 'Ecdar-GUI-Web/yarn.lock' - - - name: Install yarn dependencies - run: cd Ecdar-GUI-Web && yarn install - - - name: Run clippy lint - run: cargo clippy --all-targets -- -D warnings diff --git a/.gitmodules b/.gitmodules index f51a327..0d5465b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 = git@github.com:Ecdar/Ecdar-GUI-Web.git +[submodule "Ecdar-ProtoBuf"] + path = Ecdar-ProtoBuf + url = git@github.com:Ecdar/Ecdar-ProtoBuf.git + branch = SW5 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Ecdar-GUI-Native.iml b/.idea/Ecdar-GUI-Native.iml new file mode 100644 index 0000000..cf84ae4 --- /dev/null +++ b/.idea/Ecdar-GUI-Native.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..efc05be --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..0fc29e9 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index c2ac7a8..49e3c39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" ] diff --git a/Ecdar-GUI-Web b/Ecdar-GUI-Web index 7b93e3f..699f37f 160000 --- a/Ecdar-GUI-Web +++ b/Ecdar-GUI-Web @@ -1 +1 @@ -Subproject commit 7b93e3f8f03a538fb992c86fcbe53eafda5deed2 +Subproject commit 699f37f72637871ad9f7e276cff2481585d24c17 diff --git a/Ecdar-ProtoBuf b/Ecdar-ProtoBuf new file mode 160000 index 0000000..f5ae959 --- /dev/null +++ b/Ecdar-ProtoBuf @@ -0,0 +1 @@ +Subproject commit f5ae9598ebd6de74e17a7a03ae1b0896ae322ef7 diff --git a/README.md b/README.md index 99c3e0d..d7b5814 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/ecdar-gui-macros/Cargo.toml b/ecdar-gui-macros/Cargo.toml deleted file mode 100644 index 4e0418a..0000000 --- a/ecdar-gui-macros/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "ecdar-gui-macros" -version = "0.1.0" -edition = "2021" - -[lib] -proc-macro = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -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" diff --git a/src-tauri/icons/128x128.png b/icons/128x128.png similarity index 100% rename from src-tauri/icons/128x128.png rename to icons/128x128.png diff --git a/src-tauri/icons/128x128@2x.png b/icons/128x128@2x.png similarity index 100% rename from src-tauri/icons/128x128@2x.png rename to icons/128x128@2x.png diff --git a/src-tauri/icons/32x32.png b/icons/32x32.png similarity index 100% rename from src-tauri/icons/32x32.png rename to icons/32x32.png diff --git a/src-tauri/icons/Square107x107Logo.png b/icons/Square107x107Logo.png similarity index 100% rename from src-tauri/icons/Square107x107Logo.png rename to icons/Square107x107Logo.png diff --git a/src-tauri/icons/Square142x142Logo.png b/icons/Square142x142Logo.png similarity index 100% rename from src-tauri/icons/Square142x142Logo.png rename to icons/Square142x142Logo.png diff --git a/src-tauri/icons/Square150x150Logo.png b/icons/Square150x150Logo.png similarity index 100% rename from src-tauri/icons/Square150x150Logo.png rename to icons/Square150x150Logo.png diff --git a/src-tauri/icons/Square284x284Logo.png b/icons/Square284x284Logo.png similarity index 100% rename from src-tauri/icons/Square284x284Logo.png rename to icons/Square284x284Logo.png diff --git a/src-tauri/icons/Square30x30Logo.png b/icons/Square30x30Logo.png similarity index 100% rename from src-tauri/icons/Square30x30Logo.png rename to icons/Square30x30Logo.png diff --git a/src-tauri/icons/Square310x310Logo.png b/icons/Square310x310Logo.png similarity index 100% rename from src-tauri/icons/Square310x310Logo.png rename to icons/Square310x310Logo.png diff --git a/src-tauri/icons/Square44x44Logo.png b/icons/Square44x44Logo.png similarity index 100% rename from src-tauri/icons/Square44x44Logo.png rename to icons/Square44x44Logo.png diff --git a/src-tauri/icons/Square71x71Logo.png b/icons/Square71x71Logo.png similarity index 100% rename from src-tauri/icons/Square71x71Logo.png rename to icons/Square71x71Logo.png diff --git a/src-tauri/icons/Square89x89Logo.png b/icons/Square89x89Logo.png similarity index 100% rename from src-tauri/icons/Square89x89Logo.png rename to icons/Square89x89Logo.png diff --git a/src-tauri/icons/StoreLogo.png b/icons/StoreLogo.png similarity index 100% rename from src-tauri/icons/StoreLogo.png rename to icons/StoreLogo.png diff --git a/src-tauri/icons/icon.icns b/icons/icon.icns similarity index 100% rename from src-tauri/icons/icon.icns rename to icons/icon.icns diff --git a/src-tauri/icons/icon.ico b/icons/icon.ico similarity index 100% rename from src-tauri/icons/icon.ico rename to icons/icon.ico diff --git a/src-tauri/icons/icon.png b/icons/icon.png similarity index 100% rename from src-tauri/icons/icon.png rename to icons/icon.png diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore deleted file mode 100644 index aba21e2..0000000 --- a/src-tauri/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by Cargo -# will have compiled files and executables -/target/ diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml deleted file mode 100644 index 5aa4acd..0000000 --- a/src-tauri/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -[package] -name = "app" -version = "0.1.0" -description = "A Tauri App" -authors = ["you"] -license = "" -repository = "" -default-run = "app" -edition = "2021" -rust-version = "1.60" - -# 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 = [ ] } - -[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.10.2" -rand = "0.8.5" -tokio = "1.33.0" -ecdar-protobuf = { git = "https://github.com/ECDAR-AAU-SW-P5/Ecdar-ProtoBuf-rs", version = "0.1.0", features = ["client", "serde"] } -ecdar-gui-macros = { version = "0.1.0", path = "../ecdar-gui-macros" } - -[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" ] diff --git a/src-tauri/build.rs b/src-tauri/build.rs deleted file mode 100644 index d860e1e..0000000 --- a/src-tauri/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - tauri_build::build() -} diff --git a/src/build.rs b/src/build.rs new file mode 100644 index 0000000..30bbe91 --- /dev/null +++ b/src/build.rs @@ -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() +} diff --git a/ecdar-gui-macros/src/lib.rs b/src/lib.rs similarity index 100% rename from ecdar-gui-macros/src/lib.rs rename to src/lib.rs diff --git a/src-tauri/src/main.rs b/src/main.rs similarity index 83% rename from src-tauri/src/main.rs rename to src/main.rs index daf2e89..e1431e1 100644 --- a/src-tauri/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ #![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 { @@ -9,7 +10,7 @@ pub enum GrpcError { FailedResponse, } -ecdar_gui_macros::create_functions!(); +//ecdar_app::create_functions!(); fn main() { tauri::Builder::default() @@ -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"); } diff --git a/src-tauri/tauri.conf.json b/tauri.conf.json similarity index 100% rename from src-tauri/tauri.conf.json rename to tauri.conf.json From 6ee025a3be7b0859c894325aed2d29ce488b4fec Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:12:40 +0100 Subject: [PATCH 02/15] CI changes --- .github/workflows/build_artifacts.yml | 31 ++++++++++++++++++++------- .idea/vcs.xml | 2 ++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index c8a5d11..c789230 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -5,13 +5,9 @@ on: push: jobs: - build: - strategy: - matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] - name: Build ${{ matrix.os }} - runs-on: ${{ matrix.os }} - + build-linux: + name: Build Linux + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: @@ -23,6 +19,25 @@ jobs: - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true + - name: Install deps + run: | + sudo apt update + sudo apt install node npm + sudo apt install libwebkit2gtk-4.0-dev \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + npm i -g vite + cd Ecdar-GUI-WEB + npm install + git submodule update --init --recursive + cd .. + cargo install tauri-cli - name: cargo build --release uses: clechasseur/rs-cargo@v1 with: @@ -31,6 +46,6 @@ jobs: - uses: actions/upload-artifact@v3 with: name: ecdar_app-${{ matrix.os }} - path: ${{ runner.os == 'Windows' && 'target/release/ecdar_app.exe' || 'target/release/ecdar_app' }} + path: target/release/ecdar_app if-no-files-found: error retention-days: 7 diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 0fc29e9..a5103da 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -3,6 +3,8 @@ + + \ No newline at end of file From 575f3cef8f03e0beb59ce7dfb12fa3c4ffc382df Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:16:42 +0100 Subject: [PATCH 03/15] CI changes --- .github/workflows/build_artifacts.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index c789230..4cd8318 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -19,10 +19,12 @@ jobs: - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true + - uses: actions/setup-node@v4 + with: + node-version: 18 - name: Install deps run: | sudo apt update - sudo apt install node npm sudo apt install libwebkit2gtk-4.0-dev \ build-essential \ curl \ From 5f142f35f01bd389a59776f2ad9a46d5cb0121c1 Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:19:29 +0100 Subject: [PATCH 04/15] CI changes --- .github/workflows/build_artifacts.yml | 33 ++++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index 4cd8318..48d80fc 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -24,22 +24,23 @@ jobs: node-version: 18 - name: Install deps run: | - sudo apt update - sudo apt install libwebkit2gtk-4.0-dev \ - build-essential \ - curl \ - wget \ - file \ - libssl-dev \ - libgtk-3-dev \ - libayatana-appindicator3-dev \ - librsvg2-dev - npm i -g vite - cd Ecdar-GUI-WEB - npm install - git submodule update --init --recursive - cd .. - cargo install tauri-cli + git submodule update --init --recursive + sudo apt update + sudo apt install libwebkit2gtk-4.0-dev \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + npm i -g vite + cd Ecdar-GUI-WEB + npm install + git submodule update --init --recursive + cd .. + cargo install tauri-cli - name: cargo build --release uses: clechasseur/rs-cargo@v1 with: From 95a74afb209c157b2d1f0033119458b10e492d39 Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:21:08 +0100 Subject: [PATCH 05/15] CI changes --- .github/workflows/build_artifacts.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index 48d80fc..ce8de49 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -36,7 +36,7 @@ jobs: libayatana-appindicator3-dev \ librsvg2-dev npm i -g vite - cd Ecdar-GUI-WEB + cd Ecdar-GUI-Web npm install git submodule update --init --recursive cd .. diff --git a/README.md b/README.md index d7b5814..b267c5d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ $ sudo apt install cargo node npm ### Npm Dependencies ``` $ npm i -g vite -$ cd Ecdar-GUI-WEB +$ cd Ecdar-GUI-Web $ npm install $ git submodule update --init --recursive $ cd .. From bc075ccac29c45ced0e71f1000050b1bd7637d56 Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:36:24 +0100 Subject: [PATCH 06/15] CI changes --- .github/workflows/build_artifacts.yml | 2 + .github/workflows/test.yml | 76 ++++++++++++--------------- 2 files changed, 37 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index ce8de49..82f4ea0 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -6,6 +6,8 @@ on: jobs: build-linux: + needs: + - test-linux name: Build Linux runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8aa3ff6..32f1376 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,55 +1,49 @@ -name: Test +name: Tests on: + workflow_dispatch: 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 + test-linux: + name: Tests Ubuntu 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 + - uses: actions/checkout@v3 with: submodules: 'true' - - - name: Install dependencies - uses: arduino/setup-protoc@v2 + - uses: arduino/setup-protoc@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy - 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 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install deps + run: | + git submodule update --init --recursive + sudo apt update + sudo apt install libwebkit2gtk-4.0-dev \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + npm i -g vite + cd Ecdar-GUI-Web + npm install + git submodule update --init --recursive + cd .. + cargo install tauri-cli + - name: cargo test + uses: clechasseur/rs-cargo@v1 + with: + command: test From db22b5f9e4db598997e87f2146bf8058d51d80e7 Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:42:29 +0100 Subject: [PATCH 07/15] CI changes --- .github/workflows/build_artifacts.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index 82f4ea0..b12b465 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -6,9 +6,8 @@ on: jobs: build-linux: - needs: - - test-linux name: Build Linux + uses: .github/test.yml runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 556c692e07b9526841e2d87d31ac27136c9fabe9 Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:44:07 +0100 Subject: [PATCH 08/15] CI changes --- .github/workflows/build_artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index b12b465..fc11307 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -7,7 +7,7 @@ on: jobs: build-linux: name: Build Linux - uses: .github/test.yml + needs: test-linux runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 79839f34afd8cbbc8ecff2599dd2c6693a0d1d7c Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 16:48:15 +0100 Subject: [PATCH 09/15] CI changes --- .github/workflows/build_artifacts.yml | 1 - .github/workflows/check_format.yml | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index fc11307..ce8de49 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -7,7 +7,6 @@ on: jobs: build-linux: name: Build Linux - needs: test-linux runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml index 1ace49e..9b22a37 100644 --- a/.github/workflows/check_format.yml +++ b/.github/workflows/check_format.yml @@ -19,6 +19,28 @@ jobs: - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install deps + run: | + git submodule update --init --recursive + sudo apt update + sudo apt install libwebkit2gtk-4.0-dev \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + npm i -g vite + cd Ecdar-GUI-Web + npm install + git submodule update --init --recursive + cd .. + cargo install tauri-cli - name: cargo fmt --all uses: clechasseur/rs-cargo@v1 with: From 967749c93d84f38b5125b253439def262e38f5c7 Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 17:27:04 +0100 Subject: [PATCH 10/15] CI update and clean --- .github/workflows/build_artifacts.yml | 1 + .github/workflows/check_format.yml | 1 + src/main.rs | 6 +++--- tauri.conf.json | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index ce8de49..1f95c85 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -41,6 +41,7 @@ jobs: git submodule update --init --recursive cd .. cargo install tauri-cli + cargo tauri build - name: cargo build --release uses: clechasseur/rs-cargo@v1 with: diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml index 9b22a37..0950357 100644 --- a/.github/workflows/check_format.yml +++ b/.github/workflows/check_format.yml @@ -41,6 +41,7 @@ jobs: git submodule update --init --recursive cd .. cargo install tauri-cli + cargo tauri build - name: cargo fmt --all uses: clechasseur/rs-cargo@v1 with: diff --git a/src/main.rs b/src/main.rs index e1431e1..6a4d828 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,6 @@ // Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use tauri::Manager; tonic::include_proto!("ecdar_proto_buf"); #[derive(serde::Serialize, serde::Deserialize)] @@ -15,10 +14,11 @@ pub enum GrpcError { fn main() { tauri::Builder::default() .plugin(tauri_plugin_persisted_scope::init()) - .setup(|app| { + .setup(|_app| { #[cfg(debug_assertions)] { - app.get_window("main").unwrap().open_devtools(); + use tauri::Manager; + _app.get_window("main").unwrap().open_devtools(); } Ok(()) }) diff --git a/tauri.conf.json b/tauri.conf.json index 26a966a..96671a7 100644 --- a/tauri.conf.json +++ b/tauri.conf.json @@ -3,7 +3,7 @@ "beforeBuildCommand": "yarn --cwd=./Ecdar-GUI-Web/ build", "beforeDevCommand": "yarn --cwd=./Ecdar-GUI-Web/ dev", "devPath": "http://localhost:5173", - "distDir": "../Ecdar-GUI-Web/build/", + "distDir": "./Ecdar-GUI-Web/build/", "withGlobalTauri" : true }, "package": { From 527d53f082f7756754bbf4bcde1c2d466247c7fa Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 17:37:33 +0100 Subject: [PATCH 11/15] CI update and clean --- .github/workflows/build_artifacts.yml | 5 +++-- .github/workflows/check_format.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index 1f95c85..937799d 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -21,7 +21,7 @@ jobs: cache-on-failure: true - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Install deps run: | git submodule update --init --recursive @@ -34,7 +34,8 @@ jobs: libssl-dev \ libgtk-3-dev \ libayatana-appindicator3-dev \ - librsvg2-dev + librsvg2-dev \ + yarn npm i -g vite cd Ecdar-GUI-Web npm install diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml index 0950357..80b0001 100644 --- a/.github/workflows/check_format.yml +++ b/.github/workflows/check_format.yml @@ -21,7 +21,7 @@ jobs: cache-on-failure: true - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Install deps run: | git submodule update --init --recursive @@ -34,7 +34,8 @@ jobs: libssl-dev \ libgtk-3-dev \ libayatana-appindicator3-dev \ - librsvg2-dev + librsvg2-dev \ + yarn npm i -g vite cd Ecdar-GUI-Web npm install From 224ca47961974263ce78a81cb69a9f3ede537239 Mon Sep 17 00:00:00 2001 From: Thomas Lohse Date: Mon, 26 Feb 2024 17:51:29 +0100 Subject: [PATCH 12/15] CI update --- .github/workflows/build_artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index 937799d..ba35dd8 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -50,7 +50,7 @@ jobs: args: --release - uses: actions/upload-artifact@v3 with: - name: ecdar_app-${{ matrix.os }} + name: ecdar_app path: target/release/ecdar_app if-no-files-found: error retention-days: 7 From d0470fad451bb201f26e502463b67ebe0fd39877 Mon Sep 17 00:00:00 2001 From: Thomas Lohse <49527735+t-lohse@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:53:17 +0100 Subject: [PATCH 13/15] Update .gitmodules --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 0d5465b..4af84f0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "Ecdar-GUI-Web"] path = Ecdar-GUI-Web - url = git@github.com:Ecdar/Ecdar-GUI-Web.git + url = https://github.com/Ecdar/Ecdar-GUI-Web [submodule "Ecdar-ProtoBuf"] path = Ecdar-ProtoBuf - url = git@github.com:Ecdar/Ecdar-ProtoBuf.git + url = https://github.com/Ecdar/Ecdar-ProtoBuf branch = SW5 From 818ebe3f3a1a310894391c8bfb146d86b0451cb6 Mon Sep 17 00:00:00 2001 From: Thomas Lohse <49527735+t-lohse@users.noreply.github.com> Date: Wed, 13 Mar 2024 17:00:11 +0100 Subject: [PATCH 14/15] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 6985cf1..7aa7025 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb + +.idea From 10cf7a5a80e8be773e56223448427be74a91658c Mon Sep 17 00:00:00 2001 From: Thomas Lohse <49527735+t-lohse@users.noreply.github.com> Date: Wed, 13 Mar 2024 17:00:18 +0100 Subject: [PATCH 15/15] Delete .idea directory --- .idea/.gitignore | 8 -------- .idea/Ecdar-GUI-Native.iml | 11 ----------- .idea/modules.xml | 8 -------- .idea/vcs.xml | 10 ---------- 4 files changed, 37 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/Ecdar-GUI-Native.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/Ecdar-GUI-Native.iml b/.idea/Ecdar-GUI-Native.iml deleted file mode 100644 index cf84ae4..0000000 --- a/.idea/Ecdar-GUI-Native.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index efc05be..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index a5103da..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file