From f6f12baf7422249a57f571b25f43b23a720ecd9d Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Mon, 1 Jun 2026 10:32:25 +0200 Subject: [PATCH 1/3] test in ci --- .github/workflows/ci.yml | 20 +++++++++++--------- app/src/main/rust/justfile | 24 ++++++++++++++++-------- app/src/main/rust/src/libgit2/merge.rs | 2 +- app/src/main/rust/src/url.rs | 17 ++++++++++++++--- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e132d70e..5a3cde2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,17 +52,19 @@ jobs: run: | ./gradlew assembleDebug lintDebug testDebugUnitTest --stacktrace - file-extension: - name: Check sort + tests: + name: Rust tests + strategy: + fail-fast: false runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + - run: rustup update + - uses: taiki-e/install-action@just + + - uses: Swatinem/rust-cache@v2 with: - lfs: true + workspaces: "./app/src/main/rust/" - - run: | - extension_dir=app/src/main/rust/supported_extensions - for f in $(ls $extension_dir 2>/dev/null); do - diff $extension_dir/$f <(sort $extension_dir/$f) - done - shell: bash + - name: Run tests + run: cargo test --verbose diff --git a/app/src/main/rust/justfile b/app/src/main/rust/justfile index 63f8093a..dba81cce 100644 --- a/app/src/main/rust/justfile +++ b/app/src/main/rust/justfile @@ -1,4 +1,4 @@ -set windows-powershell := true +set windows-shell := ["powershell.exe", "-NoLogo", "-Command"] zip_openssl_build arch: rm -rf openssl-prebuild/{{ arch }}/* @@ -6,10 +6,18 @@ zip_openssl_build arch: zip -r install.zip openssl-prebuild/{{ arch }}/install mv install.zip openssl-prebuild/{{ arch }} -sortext: - #!/usr/bin/env bash - extension_dir=supported_extensions - for f in $(ls $extension_dir 2>/dev/null); do - sort $extension_dir/$f -o $extension_dir/$f - echo sorted $f - done \ No newline at end of file +pull: prettier fix + +fix: fmt fmt-just + cargo clippy --workspace --all-features --fix --allow-dirty --allow-staged + +fmt: + cargo fmt --all + +fmt-just: + just --fmt --unstable + +prettier: + # install on Debian: sudo snap install node --classic + # npx is the command to run npm package, node is the runtime + npx prettier -w . diff --git a/app/src/main/rust/src/libgit2/merge.rs b/app/src/main/rust/src/libgit2/merge.rs index 3d6511dc..dfd36ac5 100644 --- a/app/src/main/rust/src/libgit2/merge.rs +++ b/app/src/main/rust/src/libgit2/merge.rs @@ -62,7 +62,7 @@ fn normal_merge( let mut checkout_opts = git2::build::CheckoutBuilder::new(); checkout_opts.force(); repo.checkout_head(Some(&mut checkout_opts))?; - + Ok(()) } diff --git a/app/src/main/rust/src/url.rs b/app/src/main/rust/src/url.rs index ce8fd262..9fd73991 100644 --- a/app/src/main/rust/src/url.rs +++ b/app/src/main/rust/src/url.rs @@ -42,19 +42,30 @@ mod test { fn test() { let url = parse_url("ssh://username@host:5555/dir/repo.git").unwrap(); - assert_eq!(&url.kind, &UrlKind::Ssh); let url = parse_url("https://github.com/wiiznokes/gitnote.git").unwrap(); - assert_eq!(&url.kind, &UrlKind::Https); let url = parse_url("git@github.com:wiiznokes/gitnote.git").unwrap(); - assert_eq!(&url.kind, &UrlKind::Ssh); let url = parse_url("git@git.sr.ht:~user/notes").unwrap(); + assert_eq!(&url.kind, &UrlKind::Ssh); + + let url = parse_url("ssh://name@9.9.9.9:111/name/name.git").unwrap(); + assert_eq!(&url.kind, &UrlKind::Ssh); + + let url = parse_url("name@git.dom.hu:111/name/name.git").unwrap(); + assert_eq!(&url.kind, &UrlKind::Ssh); + + let url = parse_url("ssh://name@git.dom.hu:111/name/name.git").unwrap(); + assert_eq!(&url.kind, &UrlKind::Ssh); + + let url = parse_url("name@git.dom.hu:/name/name.git").unwrap(); + assert_eq!(&url.kind, &UrlKind::Ssh); + let url = parse_url("name@git.dom.hu:repos/name.git").unwrap(); assert_eq!(&url.kind, &UrlKind::Ssh); } } From a89f8c34650fcfb4cfa124221614c2d1373ec766 Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Mon, 1 Jun 2026 10:35:41 +0200 Subject: [PATCH 2/3] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a3cde2b..81e84cee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,4 +67,5 @@ jobs: workspaces: "./app/src/main/rust/" - name: Run tests + working-directory: "./app/src/main/rust/" run: cargo test --verbose From 0266956bfc3db7b3a594d73bebaae302e1127d98 Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Mon, 1 Jun 2026 10:50:55 +0200 Subject: [PATCH 3/3] f --- .github/workflows/ci.yml | 4 ++-- app/src/main/rust/justfile | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81e84cee..38b2b4d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ concurrency: cancel-in-progress: true jobs: - build-ci: - name: Build-Debug-Ci + build: + name: Build-Debug runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 diff --git a/app/src/main/rust/justfile b/app/src/main/rust/justfile index dba81cce..91727526 100644 --- a/app/src/main/rust/justfile +++ b/app/src/main/rust/justfile @@ -21,3 +21,11 @@ prettier: # install on Debian: sudo snap install node --classic # npx is the command to run npm package, node is the runtime npx prettier -w . + +sortext: + #!/usr/bin/env bash + extension_dir=supported_extensions + for f in $(ls $extension_dir 2>/dev/null); do + sort $extension_dir/$f -o $extension_dir/$f + echo sorted $f + done \ No newline at end of file