From 932d14c1431a6355e37234817e9d5152e81d88a8 Mon Sep 17 00:00:00 2001 From: amrbashir Date: Tue, 24 Oct 2023 04:30:23 +0300 Subject: [PATCH] update actions --- .github/workflows/audit.yml | 5 +-- .github/workflows/clippy-fmt.yml | 42 ++++++++----------- ...e-status-on-PR.yml => covector-status.yml} | 4 +- .../workflows/covector-version-or-publish.yml | 19 ++------- .github/workflows/test.yml | 28 +++++-------- examples/winit.rs | 18 ++++---- 6 files changed, 45 insertions(+), 71 deletions(-) rename .github/workflows/{change-status-on-PR.yml => covector-status.yml} (84%) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 555adad..fd10e86 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -27,8 +27,7 @@ jobs: audit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: rust audit - uses: actions-rs/audit-check@v1 + - uses: actions/checkout@v4 + - uses: rustsec/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/clippy-fmt.yml b/.github/workflows/clippy-fmt.yml index a5e26ca..eb253fe 100644 --- a/.github/workflows/clippy-fmt.yml +++ b/.github/workflows/clippy-fmt.yml @@ -11,44 +11,38 @@ on: pull_request: concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: clippy: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.platform }} + steps: - - uses: actions/checkout@v3 + - 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 libxdo-dev libayatana-appindicator3-dev - - name: install stable - uses: actions-rs/toolchain@v1 + sudo apt-get install -y libgtk-3-dev libxdo-dev + + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true components: clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-targets --all-features -- -D warnings + - run: cargo clippy --all-targets --all-features -- -D warnings fmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: install stable - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check \ No newline at end of file + - run: cargo fmt --all -- --check diff --git a/.github/workflows/change-status-on-PR.yml b/.github/workflows/covector-status.yml similarity index 84% rename from .github/workflows/change-status-on-PR.yml rename to .github/workflows/covector-status.yml index 526f734..aaa9217 100644 --- a/.github/workflows/change-status-on-PR.yml +++ b/.github/workflows/covector-status.yml @@ -10,9 +10,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 2b8918a..a3f38a6 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: MIT -name: version or publish +name: covector version or publish on: push: @@ -19,22 +19,11 @@ jobs: successfulPublish: ${{ steps.covector.outputs.successfulPublish }} steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - uses: pnpm/action-setup@v2.2.2 - with: - version: 7 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 16 - check-latest: true - registry-url: 'https://registry.npmjs.org' + - 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 }}" @@ -55,8 +44,8 @@ jobs: uses: tauri-apps/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: release/version-updates title: Apply Version Updates From Current Changes commit-message: 'apply version updates' labels: 'version updates' + branch: 'release' body: ${{ steps.covector.outputs.change }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09163d0..c60bf40 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,34 +14,26 @@ env: RUST_BACKTRACE: 1 concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: test: strategy: fail-fast: false matrix: - os: ['windows-latest', 'macos-latest', 'ubuntu-latest'] + platform: ["windows-latest", "macos-latest", "ubuntu-latest"] - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install system deps - if: contains(matrix.os, 'ubuntu') + if: matrix.platform == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev libxdo-dev libayatana-appindicator3-dev - - - name: install stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - uses: actions-rs/cargo@v1 - with: - command: test \ No newline at end of file + sudo apt-get install -y libgtk-3-dev libxdo-dev + + - uses: dtolnay/rust-toolchain@stable + - run: cargo test diff --git a/examples/winit.rs b/examples/winit.rs index 1bcc77e..598e71b 100644 --- a/examples/winit.rs +++ b/examples/winit.rs @@ -23,15 +23,17 @@ fn main() { let global_hotkey_channel = GlobalHotKeyEvent::receiver(); - event_loop.run(move |_event, event_loop| { - event_loop.set_control_flow(ControlFlow::Poll); + event_loop + .run(move |_event, event_loop| { + event_loop.set_control_flow(ControlFlow::Poll); - if let Ok(event) = global_hotkey_channel.try_recv() { - println!("{event:?}"); + if let Ok(event) = global_hotkey_channel.try_recv() { + println!("{event:?}"); - if hotkey2.id() == event.id && event.state == HotKeyState::Released { - hotkeys_manager.unregister(hotkey2).unwrap(); + if hotkey2.id() == event.id && event.state == HotKeyState::Released { + hotkeys_manager.unregister(hotkey2).unwrap(); + } } - } - }).unwrap(); + }) + .unwrap(); }