Skip to content

Commit

Permalink
Merge branch 'master' into chore/codeowners-update
Browse files Browse the repository at this point in the history
  • Loading branch information
parfeon authored Oct 30, 2023
2 parents 423f4bd + 65fb9c7 commit dec4065
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 106 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/commands-handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -42,4 +40,4 @@ jobs:
with:
token: ${{ secrets.GH_TOKEN }}
listener: ${{ secrets.CLEN_BOT }}
jira-api-key: ${{ secrets.JIRA_API_KEY }}
jira-api-key: ${{ secrets.JIRA_API_KEY }}
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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:
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Tests

on:
on:
push:
workflow_dispatch:
concurrency:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
115 changes: 52 additions & 63 deletions .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/core/event_engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
4 changes: 1 addition & 3 deletions src/dx/parse_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ impl Deserializer for CiboriumDeserializer {
&self,
bytes: &[u8],
) -> Result<Token, PubNubError> {
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(),
})
}
Expand Down
6 changes: 3 additions & 3 deletions src/dx/presence/event_engine/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions src/dx/subscribe/event_engine/effects/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ pub(super) async fn execute(
) -> Vec<SubscribeEvent> {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/dx/subscribe/event_engine/effects/receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/dx/subscribe/event_engine/effects/receive_reconnection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/dx/subscribe/event_engine/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit dec4065

Please sign in to comment.