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
25 changes: 14 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -52,17 +52,20 @@ 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
working-directory: "./app/src/main/rust/"
run: cargo test --verbose
18 changes: 17 additions & 1 deletion app/src/main/rust/justfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
set windows-powershell := true
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]

zip_openssl_build arch:
rm -rf openssl-prebuild/{{ arch }}/*
cp -r target/{{ arch }}-linux-android/release/build/openssl-sys-*/out/openssl-build/install openssl-prebuild/{{ arch }}
zip -r install.zip openssl-prebuild/{{ arch }}/install
mv install.zip openssl-prebuild/{{ arch }}

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 .

sortext:
#!/usr/bin/env bash
extension_dir=supported_extensions
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/rust/src/libgit2/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand Down
17 changes: 14 additions & 3 deletions app/src/main/rust/src/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("[email protected]:wiiznokes/gitnote.git").unwrap();

assert_eq!(&url.kind, &UrlKind::Ssh);

let url = parse_url("[email protected]:~user/notes").unwrap();
assert_eq!(&url.kind, &UrlKind::Ssh);

let url = parse_url("ssh://[email protected]:111/name/name.git").unwrap();
assert_eq!(&url.kind, &UrlKind::Ssh);

let url = parse_url("[email protected]:111/name/name.git").unwrap();
assert_eq!(&url.kind, &UrlKind::Ssh);

let url = parse_url("ssh://[email protected]:111/name/name.git").unwrap();
assert_eq!(&url.kind, &UrlKind::Ssh);

let url = parse_url("[email protected]:/name/name.git").unwrap();
assert_eq!(&url.kind, &UrlKind::Ssh);

let url = parse_url("[email protected]:repos/name.git").unwrap();
assert_eq!(&url.kind, &UrlKind::Ssh);
}
}