diff --git a/.github/workflows/commands-handler.yml b/.github/workflows/commands-handler.yml index 38844eec..0b5d4702 100644 --- a/.github/workflows/commands-handler.yml +++ b/.github/workflows/commands-handler.yml @@ -11,9 +11,7 @@ jobs: process: name: Process command if: github.event.issue.pull_request && endsWith(github.repository, '-private') != true - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest steps: - name: Check referred user id: user-check @@ -42,4 +40,4 @@ jobs: with: token: ${{ secrets.GH_TOKEN }} listener: ${{ secrets.CLEN_BOT }} - jira-api-key: ${{ secrets.JIRA_API_KEY }} \ No newline at end of file + jira-api-key: ${{ secrets.JIRA_API_KEY }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65cf27f9..5afb2eed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,9 +8,7 @@ on: jobs: check-release: name: Check release required - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest if: github.event.pull_request.merged && endsWith(github.repository, '-private') != true outputs: release: ${{ steps.check.outputs.ready }} @@ -29,9 +27,7 @@ jobs: token: ${{ secrets.GH_TOKEN }} publish: name: Publish package - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest needs: check-release if: needs.check-release.outputs.release == 'true' steps: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 20d3085f..b8ef1864 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,6 +1,6 @@ name: Tests -on: +on: push: workflow_dispatch: concurrency: @@ -19,9 +19,7 @@ env: jobs: tests: name: Unit tests - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 @@ -31,14 +29,12 @@ jobs: - name: Run doc tests run: | cargo test --doc -# - name: Cancel workflow runs for commit on error -# if: failure() -# uses: ./.github/.release/actions/actions/utils/fast-jobs-failure + # - name: Cancel workflow runs for commit on error + # if: failure() + # uses: ./.github/.release/actions/actions/utils/fast-jobs-failure acceptance-tests: name: Acceptance tests - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest steps: - name: Checkout project uses: actions/checkout@v3 @@ -67,9 +63,7 @@ jobs: retention-days: 7 all-tests: name: Tests - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest needs: [tests, acceptance-tests] steps: - name: Tests summary diff --git a/.github/workflows/run-validations.yml b/.github/workflows/run-validations.yml index f456e6bb..353ebaf8 100644 --- a/.github/workflows/run-validations.yml +++ b/.github/workflows/run-validations.yml @@ -17,62 +17,58 @@ env: SDK_PAM_SEC_KEY: ${{ secrets.SDK_PAM_SEC_KEY }} jobs: -# pubnub-yml: -# name: "Validate .pubnub.yml" -# runs-on: ubuntu-latest -# steps: -# - name: Checkout project -# uses: actions/checkout@v3 -# - name: Checkout validator action -# uses: actions/checkout@v3 -# with: -# repository: pubnub/client-engineering-deployment-tools -# ref: v1 -# token: ${{ secrets.GH_TOKEN }} -# path: .github/.release/actions -# - name: "Run '.pubnub.yml' file validation" -# uses: ./.github/.release/actions/actions/validators/pubnub-yml -# with: -# token: ${{ secrets.GH_TOKEN }} -# - name: Cancel workflow runs for commit on error -# if: failure() -# uses: ./.github/.release/actions/actions/utils/fast-jobs-failure + # pubnub-yml: + # name: "Validate .pubnub.yml" + # runs-on: ubuntu-latest + # steps: + # - name: Checkout project + # uses: actions/checkout@v3 + # - name: Checkout validator action + # uses: actions/checkout@v3 + # with: + # repository: pubnub/client-engineering-deployment-tools + # ref: v1 + # token: ${{ secrets.GH_TOKEN }} + # path: .github/.release/actions + # - name: "Run '.pubnub.yml' file validation" + # uses: ./.github/.release/actions/actions/validators/pubnub-yml + # with: + # token: ${{ secrets.GH_TOKEN }} + # - name: Cancel workflow runs for commit on error + # if: failure() + # uses: ./.github/.release/actions/actions/utils/fast-jobs-failure linters: name: Launch all cargo linters to check condition of the code - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Run cargo check tool to check if the code are valid - run: | - cargo check --workspace --all-targets --features="full" - - name: Run cargo check tool to check if the raw domain code are valid - run: | - cargo check --workspace --no-default-features --features="pubnub_only" - - name: Run cargo check tool to check if the `no_std` code are valid - run: | - cargo check --workspace --all-targets --no-default-features --features="full_no_std" - - name: Run cargo clippy tool to check if all the best code practices are followed - run: | - cargo clippy --workspace --all-targets --features="full" -- -D warnings - - name: Run cargo clippy tool to check if all the best code practices are followed for raw domain code - run: | - cargo clippy --workspace --no-default-features --features="pubnub_only" -- -D warnings - - name: Run cargo clippy tool to check if all the best code practices are followed for `no_std` code - run: | - cargo clippy --workspace --all-targets --no-default-features --features="full_no_std" -- -D warnings - - name: Run cargo fmt tool to check if code are well formatted - run: | - cargo fmt --check --verbose --all + - name: Run cargo check tool to check if the code are valid + run: | + cargo check --workspace --all-targets --features="full" + - name: Run cargo check tool to check if the raw domain code are valid + run: | + cargo check --workspace --no-default-features --features="pubnub_only" + - name: Run cargo check tool to check if the `no_std` code are valid + run: | + cargo check --workspace --all-targets --no-default-features --features="full_no_std" + - name: Run cargo clippy tool to check if all the best code practices are followed + run: | + cargo clippy --workspace --all-targets --features="full" -- -D warnings + - name: Run cargo clippy tool to check if all the best code practices are followed for raw domain code + run: | + cargo clippy --workspace --no-default-features --features="pubnub_only" -- -D warnings + - name: Run cargo clippy tool to check if all the best code practices are followed for `no_std` code + run: | + cargo clippy --workspace --all-targets --no-default-features --features="full_no_std" -- -D warnings + - name: Run cargo fmt tool to check if code are well formatted + run: | + cargo fmt --check --verbose --all cargo-deny: name: Check Cargo crate dependencies - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest strategy: matrix: checks: @@ -81,16 +77,14 @@ jobs: # Prevent sudden announcement of a new advisory from failing ci: continue-on-error: ${{ matrix.checks == 'advisories' }} steps: - - uses: actions/checkout@v3 - - uses: EmbarkStudios/cargo-deny-action@v1 - with: - command: check ${{ matrix.checks }} + - uses: actions/checkout@v3 + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + command: check ${{ matrix.checks }} wasm-target: name: Check if Web Assembly target compiles as expected - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -108,9 +102,7 @@ jobs: no_std-target: name: Check if `no_std` target compiles as expected - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -128,16 +120,13 @@ jobs: - name: Run cargo check tool to check if the additional example code are valid uses: actions-rs/cargo@v1 - with: + with: command: check args: --manifest-path examples/no_std/Cargo.toml --target thumbv7m-none-eabi - all-validations: name: Validations - runs-on: - group: Default Larger Runners - labels: ubuntu-latest-m + runs-on: ubuntu-latest needs: [linters, cargo-deny, wasm-target, no_std-target] steps: - name: Validations summary diff --git a/src/core/event_engine/mod.rs b/src/core/event_engine/mod.rs index e4394f6b..450d5684 100644 --- a/src/core/event_engine/mod.rs +++ b/src/core/event_engine/mod.rs @@ -215,10 +215,10 @@ mod should { Transition { invocations: self .exit() - .unwrap_or(vec![]) + .unwrap_or_default() .into_iter() - .chain(invocations.unwrap_or(vec![])) - .chain(state.enter().unwrap_or(vec![])) + .chain(invocations.unwrap_or_default()) + .chain(state.enter().unwrap_or_default()) .collect(), state, } diff --git a/src/dx/parse_token.rs b/src/dx/parse_token.rs index 9cdbbc7b..469d2f60 100644 --- a/src/dx/parse_token.rs +++ b/src/dx/parse_token.rs @@ -27,9 +27,7 @@ impl Deserializer for CiboriumDeserializer { &self, bytes: &[u8], ) -> Result { - use crate::lib::core::ops::Deref; - - from_reader(bytes.deref()).map_err(|e| PubNubError::TokenDeserialization { + from_reader(bytes).map_err(|e| PubNubError::TokenDeserialization { details: e.to_string(), }) } diff --git a/src/dx/presence/event_engine/state.rs b/src/dx/presence/event_engine/state.rs index 09d0d24a..6af5ecc3 100644 --- a/src/dx/presence/event_engine/state.rs +++ b/src/dx/presence/event_engine/state.rs @@ -367,10 +367,10 @@ impl State for PresenceState { Transition { invocations: self .exit() - .unwrap_or(vec![]) + .unwrap_or_default() .into_iter() - .chain(invocations.unwrap_or(vec![])) - .chain(state.enter().unwrap_or(vec![])) + .chain(invocations.unwrap_or_default()) + .chain(state.enter().unwrap_or_default()) .collect(), state, } diff --git a/src/dx/subscribe/event_engine/effects/handshake.rs b/src/dx/subscribe/event_engine/effects/handshake.rs index 587df86a..5327c635 100644 --- a/src/dx/subscribe/event_engine/effects/handshake.rs +++ b/src/dx/subscribe/event_engine/effects/handshake.rs @@ -15,8 +15,8 @@ pub(super) async fn execute( ) -> Vec { info!( "Handshake for\nchannels: {:?}\nchannel groups: {:?}", - input.channels().unwrap_or(Vec::new()), - input.channel_groups().unwrap_or(Vec::new()) + input.channels().unwrap_or_default(), + input.channel_groups().unwrap_or_default() ); if input.is_empty { diff --git a/src/dx/subscribe/event_engine/effects/handshake_reconnection.rs b/src/dx/subscribe/event_engine/effects/handshake_reconnection.rs index d35c83b4..2cf5a6a5 100644 --- a/src/dx/subscribe/event_engine/effects/handshake_reconnection.rs +++ b/src/dx/subscribe/event_engine/effects/handshake_reconnection.rs @@ -23,8 +23,8 @@ pub(super) async fn execute( info!( "Handshake reconnection for\nchannels: {:?}\nchannel groups: {:?}", - input.channels().unwrap_or(Vec::new()), - input.channel_groups().unwrap_or(Vec::new()) + input.channels().unwrap_or_default(), + input.channel_groups().unwrap_or_default() ); if input.is_empty { diff --git a/src/dx/subscribe/event_engine/effects/receive.rs b/src/dx/subscribe/event_engine/effects/receive.rs index 1829892b..0f2d7830 100644 --- a/src/dx/subscribe/event_engine/effects/receive.rs +++ b/src/dx/subscribe/event_engine/effects/receive.rs @@ -22,8 +22,8 @@ pub(crate) async fn execute( info!( "Receive at {:?} for\nchannels: {:?}\nchannel groups: {:?}", cursor.timetoken, - input.channels().unwrap_or(Vec::new()), - input.channel_groups().unwrap_or(Vec::new()) + input.channels().unwrap_or_default(), + input.channel_groups().unwrap_or_default() ); if input.is_empty { diff --git a/src/dx/subscribe/event_engine/effects/receive_reconnection.rs b/src/dx/subscribe/event_engine/effects/receive_reconnection.rs index eb472902..f3875f49 100644 --- a/src/dx/subscribe/event_engine/effects/receive_reconnection.rs +++ b/src/dx/subscribe/event_engine/effects/receive_reconnection.rs @@ -30,8 +30,8 @@ pub(crate) async fn execute( info!( "Receive reconnection at {:?} for\nchannels: {:?}\nchannel groups: {:?}", cursor.timetoken, - input.channels().unwrap_or(Vec::new()), - input.channel_groups().unwrap_or(Vec::new()) + input.channels().unwrap_or_default(), + input.channel_groups().unwrap_or_default() ); if input.is_empty { diff --git a/src/dx/subscribe/event_engine/state.rs b/src/dx/subscribe/event_engine/state.rs index a4070258..f097c383 100644 --- a/src/dx/subscribe/event_engine/state.rs +++ b/src/dx/subscribe/event_engine/state.rs @@ -648,10 +648,10 @@ impl State for SubscribeState { Transition { invocations: self .exit() - .unwrap_or(vec![]) + .unwrap_or_default() .into_iter() - .chain(invocations.unwrap_or(vec![])) - .chain(state.enter().unwrap_or(vec![])) + .chain(invocations.unwrap_or_default()) + .chain(state.enter().unwrap_or_default()) .collect(), state, }