diff --git a/.github/workflows/clippy-fmt.yml b/.github/workflows/clippy-fmt.yml new file mode 100644 index 0000000..3fda2a6 --- /dev/null +++ b/.github/workflows/clippy-fmt.yml @@ -0,0 +1,48 @@ +# Copyright 2022-2022 Tauri Programme within The Commons Conservancy +# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: MIT + +name: clippy & fmt + +on: + push: + branches: + - dev + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + clippy: + strategy: + fail-fast: false + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v4 + - name: install system deps + if: matrix.platform == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev + + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - run: cargo clippy --all-targets --all-features -- -D warnings + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - run: cargo fmt --all -- --check diff --git a/.github/workflows/covector-status.yml b/.github/workflows/covector-status.yml index 72f9bee..8cc1b54 100644 --- a/.github/workflows/covector-status.yml +++ b/.github/workflows/covector-status.yml @@ -6,9 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - uses: actions/checkout@v4 - name: covector status uses: jbolda/covector/packages/action@covector-v0 id: covector diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index 4fff8af..48c4752 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -1,4 +1,4 @@ -name: version or publish +name: covector version or publish on: push: @@ -15,16 +15,16 @@ jobs: successfulPublish: ${{ steps.covector.outputs.successfulPublish }} steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - run: rustup update + - uses: actions/checkout@v4 + - name: cargo login run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }} + - name: git config run: | git config --global user.name "${{ github.event.pusher.name }}" git config --global user.email "${{ github.event.pusher.email }}" + - name: covector version or publish (publish when no change files present) uses: jbolda/covector/packages/action@covector-v0 id: covector @@ -34,14 +34,15 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} command: "version-or-publish" createRelease: true + - name: Create Pull Request With Versions Bumped id: cpr uses: tauri-apps/create-pull-request@v3 if: steps.covector.outputs.commandRan == 'version' with: token: ${{ secrets.GITHUB_TOKEN }} - title: "Publish New Versions" - commit-message: "publish new versions" - labels: "version updates" - branch: "release" + title: Apply Version Updates From Current Changes + commit-message: 'apply version updates' + labels: 'version updates' + branch: 'release' body: ${{ steps.covector.outputs.change }} diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml deleted file mode 100644 index c052837..0000000 --- a/.github/workflows/fmt.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Format - -on: - push: - branches: - - dev - pull_request: - branches: - - dev - -jobs: - format: - runs-on: ubuntu-latest - strategy: - fail-fast: false - - steps: - - uses: actions/checkout@v2 - - name: Install rustfmt with nightly toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --manifest-path=Cargo.toml --all -- --check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f3a6a22..6f68155 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,32 +1,27 @@ -name: Test +name: test on: push: branches: - dev pull_request: - branches: - - dev jobs: - build-and-test: - runs-on: ${{ matrix.os }} + test: strategy: fail-fast: false matrix: - os: [macos-latest, windows-latest] + platform: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: install system deps + if: matrix.platform == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --manifest-path ./Cargo.toml --release + - uses: dtolnay/rust-toolchain@stable + - run: cargo test diff --git a/Cargo.toml b/Cargo.toml index bdc3bd7..71e9ac1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ raw-window-handle = "0.5" [dev-dependencies] tao = "0.23" -winit = {version = "0.29", default-features = false, features = ["rwh_05"] } +winit = {version = "0.29", default-features = false, features = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita", "rwh_05"] } [target."cfg(target_os = \"windows\")".dependencies] windows-sys = { version = "0.48.0", features = [ diff --git a/examples/tao.rs b/examples/tao.rs index f8b9bb4..2e302e4 100644 --- a/examples/tao.rs +++ b/examples/tao.rs @@ -24,12 +24,12 @@ fn main() { event_loop.run(move |event, _, control_flow| { *control_flow = ControlFlow::Wait; - match event { - Event::WindowEvent { - event: WindowEvent::CloseRequested, - .. - } => *control_flow = ControlFlow::Exit, - _ => (), + if let Event::WindowEvent { + event: WindowEvent::CloseRequested, + .. + } = event + { + *control_flow = ControlFlow::Exit } }); } diff --git a/examples/tauri/src-tauri/Cargo.toml b/examples/tauri/src-tauri/Cargo.toml index 8a858d4..72a11f4 100644 --- a/examples/tauri/src-tauri/Cargo.toml +++ b/examples/tauri/src-tauri/Cargo.toml @@ -7,13 +7,13 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -serde_json = "1.0" +serde_json = "1" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.0.3", features = ["api-all"] } +tauri = { version = "1", features = ["api-all"] } window-shadows = { path = "../../../" } [build-dependencies] -tauri-build = { version = "1.0.3" } +tauri-build = { version = "1" } [features] default = ["custom-protocol"] diff --git a/examples/winit.rs b/examples/winit.rs index a80462c..b8c2c96 100644 --- a/examples/winit.rs +++ b/examples/winit.rs @@ -21,15 +21,17 @@ fn main() { window.set_title("A fantastic window!"); - event_loop.run(move |event, event_loop| { - event_loop.set_control_flow(ControlFlow::Wait); + event_loop + .run(move |event, event_loop| { + event_loop.set_control_flow(ControlFlow::Wait); - match event { - Event::WindowEvent { + if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. - } => event_loop.exit(), - _ => (), - } - }); + } = event + { + event_loop.exit() + } + }) + .unwrap(); } diff --git a/src/lib.rs b/src/lib.rs index ab9a875..dbfa03b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,7 @@ /// - **Linux**: Unsupported, Shadows are controlled by the compositor installed on the end-user system. pub fn set_shadow( window: impl raw_window_handle::HasRawWindowHandle, - enable: bool, + #[allow(unused)] enable: bool, ) -> Result<(), Error> { match window.raw_window_handle() { #[cfg(target_os = "macos")]