diff --git a/.github/workflows/commands-handler.yml b/.github/workflows/commands-handler.yml index 0b5d4702..48f71d24 100644 --- a/.github/workflows/commands-handler.yml +++ b/.github/workflows/commands-handler.yml @@ -11,7 +11,8 @@ jobs: process: name: Process command if: github.event.issue.pull_request && endsWith(github.repository, '-private') != true - runs-on: ubuntu-latest + runs-on: + group: Default steps: - name: Check referred user id: user-check @@ -23,12 +24,12 @@ jobs: run: echo -e "\033[38;2;19;181;255mThis is regular commit which should be ignored.\033[0m" - name: Checkout repository if: steps.user-check.outputs.expected-user == 'true' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} - name: Checkout release actions if: steps.user-check.outputs.expected-user == 'true' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: pubnub/client-engineering-deployment-tools ref: v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5afb2eed..fe1c839c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,13 +8,14 @@ on: jobs: check-release: name: Check release required - runs-on: ubuntu-latest if: github.event.pull_request.merged && endsWith(github.repository, '-private') != true + runs-on: + group: Default outputs: release: ${{ steps.check.outputs.ready }} steps: - name: Checkout actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: pubnub/client-engineering-deployment-tools ref: v1 @@ -27,18 +28,19 @@ jobs: token: ${{ secrets.GH_TOKEN }} publish: name: Publish package - runs-on: ubuntu-latest needs: check-release if: needs.check-release.outputs.release == 'true' + runs-on: + group: Default steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # This should be the same as the one specified for on.pull_request.branches ref: master token: ${{ secrets.GH_TOKEN }} - name: Checkout actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: pubnub/client-engineering-deployment-tools ref: v1 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b8ef1864..aad0f3e0 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -19,10 +19,11 @@ env: jobs: tests: name: Unit tests - runs-on: ubuntu-latest + runs-on: + group: Default steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run unit tests run: | cargo test --features="full" @@ -34,12 +35,13 @@ jobs: # uses: ./.github/.release/actions/actions/utils/fast-jobs-failure acceptance-tests: name: Acceptance tests - runs-on: ubuntu-latest + runs-on: + group: Default steps: - name: Checkout project - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checkout mock-server action - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: pubnub/client-engineering-deployment-tools ref: v1 @@ -56,15 +58,16 @@ jobs: run: | cargo test --features contract_test --test contract_test - name: Expose acceptance tests reports - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: acceptance-test-reports path: tests/reports/*.xml retention-days: 7 all-tests: name: Tests - runs-on: ubuntu-latest needs: [tests, acceptance-tests] + runs-on: + group: Default steps: - name: Tests summary run: echo -e "\033[38;2;95;215;0m\033[1mAll tests successfully passed" diff --git a/.github/workflows/run-validations.yml b/.github/workflows/run-validations.yml index 353ebaf8..0f014734 100644 --- a/.github/workflows/run-validations.yml +++ b/.github/workflows/run-validations.yml @@ -19,12 +19,14 @@ env: jobs: # pubnub-yml: # name: "Validate .pubnub.yml" - # runs-on: ubuntu-latest + # runs-on: + # group: Default Larger Runners + # labels: ubuntu-latest-m # steps: # - name: Checkout project - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - name: Checkout validator action - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # with: # repository: pubnub/client-engineering-deployment-tools # ref: v1 @@ -40,9 +42,10 @@ jobs: linters: name: Launch all cargo linters to check condition of the code - runs-on: ubuntu-latest + runs-on: + group: Default steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run cargo check tool to check if the code are valid run: | @@ -68,7 +71,8 @@ jobs: cargo-deny: name: Check Cargo crate dependencies - runs-on: ubuntu-latest + runs-on: + group: Default strategy: matrix: checks: @@ -77,16 +81,17 @@ jobs: # Prevent sudden announcement of a new advisory from failing ci: continue-on-error: ${{ matrix.checks == 'advisories' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: EmbarkStudios/cargo-deny-action@v1 with: command: check ${{ matrix.checks }} wasm-target: name: Check if Web Assembly target compiles as expected - runs-on: ubuntu-latest + runs-on: + group: Default steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install WASM target uses: actions-rs/toolchain@v1 @@ -102,9 +107,10 @@ jobs: no_std-target: name: Check if `no_std` target compiles as expected - runs-on: ubuntu-latest + runs-on: + group: Default steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install `no_std` target uses: actions-rs/toolchain@v1 @@ -126,8 +132,9 @@ jobs: all-validations: name: Validations - runs-on: ubuntu-latest needs: [linters, cargo-deny, wasm-target, no_std-target] + runs-on: + group: Default steps: - name: Validations summary run: echo -e "\033[38;2;95;215;0m\033[1mAll validations passed" diff --git a/examples/presence_state.rs b/examples/presence_state.rs index 25b97d4f..4494dbf4 100644 --- a/examples/presence_state.rs +++ b/examples/presence_state.rs @@ -7,11 +7,6 @@ struct State { is_doing: String, flag: bool, } -#[derive(Debug, serde::Serialize)] -struct State2 { - is_doing: String, - business: String, -} #[tokio::main] async fn main() -> Result<(), Box> { diff --git a/src/core/event_engine/effect_dispatcher.rs b/src/core/event_engine/effect_dispatcher.rs index ea219e49..6fa8559a 100644 --- a/src/core/event_engine/effect_dispatcher.rs +++ b/src/core/event_engine/effect_dispatcher.rs @@ -159,7 +159,6 @@ where mod should { use super::*; use crate::core::event_engine::Event; - use std::future::Future; struct TestEvent; @@ -261,27 +260,6 @@ mod should { } } - #[derive(Clone)] - struct TestRuntime {} - - #[async_trait::async_trait] - impl Runtime for TestRuntime { - fn spawn(&self, _future: impl Future + Send + 'static) - where - R: Send + 'static, - { - // Do nothing. - } - - async fn sleep(self, _delay: u64) { - // Do nothing. - } - - async fn sleep_microseconds(self, _delay: u64) { - // Do nothing. - } - } - #[test] fn create_not_managed_effect() { let (_tx, rx) = async_channel::bounded::(5); diff --git a/src/core/retry_policy.rs b/src/core/retry_policy.rs index 37dd0146..58e39c12 100644 --- a/src/core/retry_policy.rs +++ b/src/core/retry_policy.rs @@ -304,9 +304,7 @@ impl RequestRetryConfiguration { /// * `Some(delay_in_microseconds)` - The delay in microseconds. /// * `None` - If `delay_in_seconds` is `None`. fn delay_in_microseconds(delay_in_seconds: Option) -> Option { - let Some(delay_in_seconds) = delay_in_seconds else { - return None; - }; + let delay_in_seconds = delay_in_seconds?; const MICROS_IN_SECOND: u64 = 1_000_000; let delay = delay_in_seconds * MICROS_IN_SECOND; diff --git a/src/dx/access/mod.rs b/src/dx/access/mod.rs index 03bf7f35..b83fad26 100644 --- a/src/dx/access/mod.rs +++ b/src/dx/access/mod.rs @@ -350,7 +350,7 @@ mod it_should { response: None, request_handler: Some(Box::new(|req| { assert!(req.query_parameters.contains_key("timestamp")); - assert!(req.query_parameters.get("timestamp").is_some()); + assert!(req.query_parameters.contains_key("timestamp")); })), }; @@ -368,7 +368,7 @@ mod it_should { response: None, request_handler: Some(Box::new(|req| { assert!(req.query_parameters.contains_key("signature")); - assert!(req.query_parameters.get("signature").is_some()); + assert!(req.query_parameters.contains_key("signature")); assert!(req .query_parameters .get("signature") diff --git a/src/dx/presence/mod.rs b/src/dx/presence/mod.rs index b0baeb76..04980354 100644 --- a/src/dx/presence/mod.rs +++ b/src/dx/presence/mod.rs @@ -840,7 +840,7 @@ mod it_should { response: None, request_handler: Some(Box::new(|req| { assert!(req.query_parameters.contains_key("state")); - assert!(req.query_parameters.get("state").is_some()); + assert!(req.query_parameters.contains_key("state")); let state = req.query_parameters.get("state").unwrap(); assert!(state.contains("channel_a")); diff --git a/src/dx/subscribe/event_engine/state.rs b/src/dx/subscribe/event_engine/state.rs index f5debe80..b8ad7ecf 100644 --- a/src/dx/subscribe/event_engine/state.rs +++ b/src/dx/subscribe/event_engine/state.rs @@ -329,7 +329,7 @@ impl SubscribeState { // Merge stored cursor with service-provided. let mut next_cursor = next_cursor.clone(); if let Some(cursor) = cursor { - next_cursor.timetoken = cursor.timetoken.clone(); + next_cursor.timetoken.clone_from(&cursor.timetoken); } Some(self.transition_to( diff --git a/src/dx/subscribe/subscription.rs b/src/dx/subscribe/subscription.rs index 9bca92ff..66f57c60 100644 --- a/src/dx/subscribe/subscription.rs +++ b/src/dx/subscribe/subscription.rs @@ -537,7 +537,7 @@ where .gt(current_cursor) .then(|| *cursor_slot = Some(catchup_cursor)); } else { - *cursor_slot = cursor.clone(); + cursor_slot.clone_from(&cursor); } } } diff --git a/src/dx/subscribe/subscription_manager.rs b/src/dx/subscribe/subscription_manager.rs index 93cc16aa..e74b278a 100644 --- a/src/dx/subscribe/subscription_manager.rs +++ b/src/dx/subscribe/subscription_manager.rs @@ -346,7 +346,7 @@ where if !event_handlers.is_empty() { if let Some((_, handler)) = event_handlers.iter().next() { if let Some(handler) = handler.upgrade().clone() { - client = handler.client().upgrade().clone(); + client.clone_from(&handler.client().upgrade()); } } } diff --git a/src/dx/subscribe/subscription_set.rs b/src/dx/subscribe/subscription_set.rs index a967aceb..da2242c4 100644 --- a/src/dx/subscribe/subscription_set.rs +++ b/src/dx/subscribe/subscription_set.rs @@ -903,7 +903,7 @@ where .gt(current_cursor) .then(|| *cursor_slot = Some(catchup_cursor)); } else { - *cursor_slot = cursor.clone(); + cursor_slot.clone_from(&cursor); } } } @@ -1174,7 +1174,7 @@ mod it_should { .into_iter() .map(|name| client.channel(name).subscription(None)) .collect::>>(); - let channels_3_subscriptions = vec![ + let channels_3_subscriptions = [ channels_1_subscriptions[0].clone(), channels_2_subscriptions[1].clone(), ];