From 105bc664da1d2e53f8bb9efde510f2a3a52f4a33 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Mon, 2 Jan 2023 18:10:45 +0100 Subject: [PATCH 1/7] ci: don't use unmaintained actions-rs actions --- .github/workflows/audit-rust.yml | 13 +++++-- .github/workflows/lint-rust.yml | 59 ++++++++++++-------------------- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/.github/workflows/audit-rust.yml b/.github/workflows/audit-rust.yml index f3ae64e2..65eb0a14 100644 --- a/.github/workflows/audit-rust.yml +++ b/.github/workflows/audit-rust.yml @@ -28,6 +28,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/audit-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} + + - name: Download cargo-audit + run: | + curl -s https://api.github.com/repos/rustsec/rustsec/releases/latest | grep "browser_download_url.*cargo-audit-x86_64-unknown-linux-musl.*" | cut -d : -f 2,3 | tr -d \" | wget -qi - + tar -xvzf ./cargo-audit*.tgz + mv ./cargo-audit*/cargo-audit ./cargo-audit + chmod +x ./cargo-audit + + - name: Run cargo-audit + run: ./cargo-audit audit -D unmaintained -D yanked diff --git a/.github/workflows/lint-rust.yml b/.github/workflows/lint-rust.yml index 4ad8c167..7c9ff19e 100644 --- a/.github/workflows/lint-rust.yml +++ b/.github/workflows/lint-rust.yml @@ -28,42 +28,30 @@ jobs: steps: - uses: actions/checkout@v3 - - name: install webkit2gtk + + - name: install webkit2gtk and libudev for [authenticator] run: | sudo apt-get update - sudo apt-get install -y webkit2gtk-4.0 - - name: install libudev for [authenticator] - run: | - sudo apt-get install -y libudev-dev + sudo apt-get install -y webkit2gtk-4.0 libudev-dev + - name: Install clippy with stable toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true components: clippy + - uses: Swatinem/rust-cache@v1 - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings - name: clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings - name: clippy sql:sqlite - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings - name: clippy sql:mysql - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings - name: clippy sql:postgres + - name: clippy + run: --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings + + - name: clippy sql:sqlite + run: --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings + + - name: clippy sql:mysql + run: --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings + + - name: clippy sql:postgres + run: --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings fmt: runs-on: ubuntu-latest @@ -72,14 +60,11 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install rustfmt with nightly toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@nightly with: - profile: minimal - toolchain: nightly - override: true components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + + - name: Check formatting + run: cargo fmt --all -- --check From 3d4679a9ae862f8535026d4a709aae798c094531 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Mon, 2 Jan 2023 18:16:31 +0100 Subject: [PATCH 2/7] fix copy paste mistake --- .github/workflows/lint-rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint-rust.yml b/.github/workflows/lint-rust.yml index 7c9ff19e..2ab15be3 100644 --- a/.github/workflows/lint-rust.yml +++ b/.github/workflows/lint-rust.yml @@ -42,16 +42,16 @@ jobs: - uses: Swatinem/rust-cache@v1 - name: clippy - run: --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings + run: cargo clippy --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings - name: clippy sql:sqlite - run: --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings + run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings - name: clippy sql:mysql - run: --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings + run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings - name: clippy sql:postgres - run: --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings + run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings fmt: runs-on: ubuntu-latest From 78dd86a3a961b6fa35dfdcd784889c15ef199365 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Mon, 2 Jan 2023 18:45:51 +0100 Subject: [PATCH 3/7] set f --- .github/workflows/audit-rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/audit-rust.yml b/.github/workflows/audit-rust.yml index 65eb0a14..1c6e932b 100644 --- a/.github/workflows/audit-rust.yml +++ b/.github/workflows/audit-rust.yml @@ -31,10 +31,12 @@ jobs: - name: Download cargo-audit run: | + set +f curl -s https://api.github.com/repos/rustsec/rustsec/releases/latest | grep "browser_download_url.*cargo-audit-x86_64-unknown-linux-musl.*" | cut -d : -f 2,3 | tr -d \" | wget -qi - tar -xvzf ./cargo-audit*.tgz mv ./cargo-audit*/cargo-audit ./cargo-audit chmod +x ./cargo-audit + set -f - name: Run cargo-audit run: ./cargo-audit audit -D unmaintained -D yanked From 6f7b24bc42c54f23b5d0012ab67890c17f441111 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Fri, 6 Jan 2023 14:31:02 +0100 Subject: [PATCH 4/7] revert audit-rust.yml changes --- .github/workflows/audit-rust.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/audit-rust.yml b/.github/workflows/audit-rust.yml index 1c6e932b..f3ae64e2 100644 --- a/.github/workflows/audit-rust.yml +++ b/.github/workflows/audit-rust.yml @@ -28,15 +28,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - - name: Download cargo-audit - run: | - set +f - curl -s https://api.github.com/repos/rustsec/rustsec/releases/latest | grep "browser_download_url.*cargo-audit-x86_64-unknown-linux-musl.*" | cut -d : -f 2,3 | tr -d \" | wget -qi - - tar -xvzf ./cargo-audit*.tgz - mv ./cargo-audit*/cargo-audit ./cargo-audit - chmod +x ./cargo-audit - set -f - - - name: Run cargo-audit - run: ./cargo-audit audit -D unmaintained -D yanked + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} From 8befcf561b708658abf1ae01cb439258b4291b76 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 17:52:35 +0100 Subject: [PATCH 5/7] Update lib.rs --- plugins/persisted-scope/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index 9fbdf4f7..0230dfdb 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -56,15 +56,15 @@ pub fn init() -> TauriPlugin { .unwrap_or_default(); for allowed in scope.allowed_paths { // allows the path as is - let _ = fs_scope.allow_file(allowed); + let _ = fs_scope.allow_file(&allowed); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.allow_file(allowed); + let _ = asset_protocol_scope.allow_file(&allowed); } for forbidden in scope.forbidden_patterns { // forbid the path as is - let _ = fs_scope.forbid_file(forbidden); + let _ = fs_scope.forbid_file(&forbidden); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.forbid_file(forbidden); + let _ = asset_protocol_scope.forbid_file(&forbidden); } } From a56e9194da22bcbce023120bfd4738901ff0a5c9 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 18:08:15 +0100 Subject: [PATCH 6/7] only run clippy on sql package --- .github/workflows/lint-rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-rust.yml b/.github/workflows/lint-rust.yml index 2ab15be3..3f04eae9 100644 --- a/.github/workflows/lint-rust.yml +++ b/.github/workflows/lint-rust.yml @@ -45,13 +45,13 @@ jobs: run: cargo clippy --workspace --exclude 'tauri-plugin-sql' --all-targets --all-features -- -D warnings - name: clippy sql:sqlite - run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings + run: cargo clippy --package 'tauri-plugin-sql' --all-targets --features sqlite -- -D warnings - name: clippy sql:mysql - run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings + run: cargo clippy --package 'tauri-plugin-sql' --all-targets --features mysql -- -D warnings - name: clippy sql:postgres - run: cargo clippy --workspace --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings + run: cargo clippy --package 'tauri-plugin-sql' --all-targets --features postgres -- -D warnings fmt: runs-on: ubuntu-latest From c64b949b12383b7e607fd64db7a8ccd73c9e0943 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 6 Jan 2023 18:08:19 +0100 Subject: [PATCH 7/7] clippy --- plugins/persisted-scope/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/persisted-scope/src/lib.rs b/plugins/persisted-scope/src/lib.rs index 0230dfdb..ef0625ba 100644 --- a/plugins/persisted-scope/src/lib.rs +++ b/plugins/persisted-scope/src/lib.rs @@ -54,17 +54,17 @@ pub fn init() -> TauriPlugin { .map_err(Error::from) .and_then(|scope| bincode::deserialize(&scope).map_err(Into::into)) .unwrap_or_default(); - for allowed in scope.allowed_paths { + for allowed in &scope.allowed_paths { // allows the path as is - let _ = fs_scope.allow_file(&allowed); + let _ = fs_scope.allow_file(allowed); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.allow_file(&allowed); + let _ = asset_protocol_scope.allow_file(allowed); } - for forbidden in scope.forbidden_patterns { + for forbidden in &scope.forbidden_patterns { // forbid the path as is - let _ = fs_scope.forbid_file(&forbidden); + let _ = fs_scope.forbid_file(forbidden); #[cfg(feature = "protocol-asset")] - let _ = asset_protocol_scope.forbid_file(&forbidden); + let _ = asset_protocol_scope.forbid_file(forbidden); } }