mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-02 22:06:50 +02:00
ci: run clippy on all platforms (#3650)
This commit is contained in:
5 files changed
+48
-21
No files matched your search
@@ -149,24 +149,48 @@ jobs:
|
||||
clippy:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }}
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ${{ fromJSON(needs.changes.outputs.packages) }}
|
||||
platform:
|
||||
- target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
cargo: 'cargo'
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
os: ubuntu-latest
|
||||
cargo: 'cargo'
|
||||
- target: aarch64-apple-darwin
|
||||
os: macos-latest
|
||||
cargo: 'cargo'
|
||||
- target: aarch64-apple-ios
|
||||
os: macos-latest
|
||||
cargo: 'cargo'
|
||||
- target: aarch64-linux-android
|
||||
os: ubuntu-latest
|
||||
cargo: 'cross'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: install webkit2gtk
|
||||
- name: install Linux dependencies
|
||||
if: contains(matrix.platform.target, 'unknown-linux')
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev
|
||||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1 libayatana-appindicator3-dev
|
||||
|
||||
- name: Install cross
|
||||
if: ${{ matrix.platform.cargo == 'cross' }}
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cross@0.2.5
|
||||
|
||||
- name: Install clippy with stable toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: clippy
|
||||
targets: ${{ matrix.platform.target }}
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
@@ -176,8 +200,8 @@ jobs:
|
||||
save-if: ${{ (github.ref == 'refs/heads/v2' || github.ref == 'refs/heads/v3') && matrix.package == needs.changes.outputs.saver }}
|
||||
|
||||
- name: clippy ${{ matrix.package }}
|
||||
run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings
|
||||
run: ${{ matrix.platform.cargo }} clippy --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets -- -D warnings
|
||||
|
||||
- name: clippy ${{ matrix.package }} --all-features
|
||||
if: matrix.package != 'tauri-plugin-dialog'
|
||||
run: cargo clippy --package ${{ matrix.package }} --all-targets --all-features -- -D warnings
|
||||
run: ${{ matrix.platform.cargo }} clippy --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --all-features -- -D warnings
|
||||
+1
-1
@@ -6,7 +6,7 @@ members = [
|
||||
"plugins/*/examples/*/src-tauri",
|
||||
"examples/*/src-tauri",
|
||||
]
|
||||
resolver = "2"
|
||||
resolver = "3"
|
||||
|
||||
[workspace.dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
|
||||
@@ -26,6 +26,9 @@ export default defineConfig(async () => {
|
||||
host: host || false,
|
||||
port: 5173,
|
||||
strictPort: true,
|
||||
watch: {
|
||||
ignored: ['**/src-tauri/**']
|
||||
},
|
||||
fs: {
|
||||
allow: ['.']
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ struct UserData<R: Runtime> {
|
||||
|
||||
impl<R: Runtime> UserData<R> {
|
||||
unsafe fn from_hwnd_raw(hwnd: HWND) -> *mut Self {
|
||||
GetWindowLongPtrW(hwnd, GWLP_USERDATA) as *mut Self
|
||||
unsafe { GetWindowLongPtrW(hwnd, GWLP_USERDATA) as *mut Self }
|
||||
}
|
||||
|
||||
unsafe fn from_hwnd<'a>(hwnd: HWND) -> &'a mut Self {
|
||||
&mut *Self::from_hwnd_raw(hwnd)
|
||||
unsafe { &mut *Self::from_hwnd_raw(hwnd) }
|
||||
}
|
||||
|
||||
fn run_callback(&mut self, args: Vec<String>, cwd: String) {
|
||||
@@ -147,18 +147,18 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
|
||||
) -> LRESULT {
|
||||
match msg {
|
||||
WM_CREATE => {
|
||||
let create_struct = &*(lparam as *const CREATESTRUCTW);
|
||||
let create_struct = unsafe { &*(lparam as *const CREATESTRUCTW) };
|
||||
let userdata = create_struct.lpCreateParams as *const UserData<R>;
|
||||
SetWindowLongPtrW(hwnd, GWLP_USERDATA, userdata as _);
|
||||
unsafe { SetWindowLongPtrW(hwnd, GWLP_USERDATA, userdata as _) };
|
||||
0
|
||||
}
|
||||
|
||||
WM_COPYDATA => {
|
||||
let cds_ptr = lparam as *const COPYDATASTRUCT;
|
||||
if (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA {
|
||||
let userdata = UserData::<R>::from_hwnd(hwnd);
|
||||
if unsafe { (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA } {
|
||||
let userdata = unsafe { UserData::<R>::from_hwnd(hwnd) };
|
||||
|
||||
let data = CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy();
|
||||
let data = unsafe { CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy() };
|
||||
let mut s = data.split('|');
|
||||
let cwd = s.next().unwrap();
|
||||
let args = s.map(|s| s.to_string()).collect();
|
||||
@@ -169,11 +169,11 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
|
||||
}
|
||||
|
||||
WM_DESTROY => {
|
||||
let userdata = UserData::<R>::from_hwnd_raw(hwnd);
|
||||
drop(Box::from_raw(userdata));
|
||||
let userdata = unsafe { UserData::<R>::from_hwnd_raw(hwnd) };
|
||||
drop(unsafe { Box::from_raw(userdata) });
|
||||
0
|
||||
}
|
||||
_ => DefWindowProcW(hwnd, msg, wparam, lparam),
|
||||
_ => unsafe { DefWindowProcW(hwnd, msg, wparam, lparam) },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,23 +245,23 @@ pub fn encode_wide(string: impl AsRef<std::ffi::OsStr>) -> Vec<u16> {
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn SetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX, value: isize) -> isize {
|
||||
w32wm::SetWindowLongW(hwnd, index, value as _) as _
|
||||
unsafe { w32wm::SetWindowLongW(hwnd, index, value as _) as _ }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn SetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX, value: isize) -> isize {
|
||||
w32wm::SetWindowLongPtrW(hwnd, index, value)
|
||||
unsafe { w32wm::SetWindowLongPtrW(hwnd, index, value) }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn GetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX) -> isize {
|
||||
w32wm::GetWindowLongW(hwnd, index) as _
|
||||
unsafe { w32wm::GetWindowLongW(hwnd, index) as _ }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn GetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX) -> isize {
|
||||
w32wm::GetWindowLongPtrW(hwnd, index)
|
||||
unsafe { w32wm::GetWindowLongPtrW(hwnd, index) }
|
||||
}
|
||||
@@ -1963,7 +1963,7 @@ mod tests {
|
||||
assert_eq!(cases.len(), cases_escaped.len());
|
||||
|
||||
for (orig, escaped) in cases.iter().zip(cases_escaped) {
|
||||
assert_eq!(escape_nsis_current_exe_arg(&OsStr::new(orig)), escaped);
|
||||
assert_eq!(escape_nsis_current_exe_arg(OsStr::new(orig)), escaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user