From 9c78d8ca09b020c8a3a3c233f25836d2a031b5af Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 06:58:30 +0530 Subject: [PATCH 01/13] ci: Improve workflow configuration and code formatting --- .github/workflows/rust-clippy.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index ebcfb2ff..2b76dcfc 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -18,6 +18,14 @@ on: schedule: - cron: '29 19 * * 2' +concurrency: + # One build per PR, branch or tag + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + jobs: rust-clippy-analyze: name: Run rust-clippy analyzing @@ -30,13 +38,17 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Install Rust toolchain - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 + - name: Configure cache + uses: actions/cache@v3 with: - profile: minimal - toolchain: stable - components: clippy - override: true + path: | + ~/.cargo/registry + ~/.cargo/git + key: cargo-${{ hashFiles('**/Cargo.toml') }} + + - name: cargo fmt + run: cargo fmt --all -- --check + continue-on-error: true - name: Install required cargo run: cargo install clippy-sarif sarif-fmt @@ -45,7 +57,8 @@ jobs: run: cargo clippy --all-features - --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt + --message-format=json + --all-targets -- -D warnings | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt continue-on-error: true - name: Upload analysis results to GitHub From 6e4e760f4a62977bffe471ffa8847b4f38d85776 Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 07:06:47 +0530 Subject: [PATCH 02/13] chore: cargo fmt and install protoc --- .github/workflows/rust-clippy.yml | 9 +++++++++ bin/src/http.rs | 4 ++-- packages/media_utils/src/f16.rs | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 2b76dcfc..78410879 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -37,7 +37,16 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + + # Install protobuf-compiler (protoc) + - name: Install Protobuf Compiler + run: sudo apt-get install -y protobuf-compiler + - name: Set up Rust + uses: actions/setup-rust@v1 + with: + rust-version: stable + - name: Configure cache uses: actions/cache@v3 with: diff --git a/bin/src/http.rs b/bin/src/http.rs index 8d4fb10f..dd3d1083 100644 --- a/bin/src/http.rs +++ b/bin/src/http.rs @@ -8,8 +8,6 @@ use media_server_protocol::protobuf::cluster_connector::MediaConnectorServiceCli use media_server_protocol::rpc::quinn::{QuinnClient, QuinnStream}; use media_server_protocol::transport::{RpcReq, RpcRes}; use media_server_secure::{MediaEdgeSecure, MediaGatewaySecure}; -#[cfg(feature = "embed_static")] -use utils::EmbeddedFilesEndpoint; #[cfg(not(feature = "embed_static"))] use poem::endpoint::StaticFilesEndpoint; use poem::{listener::TcpListener, middleware::Cors, EndpointExt, Route, Server}; @@ -17,6 +15,8 @@ use poem_openapi::types::{ToJSON, Type}; use poem_openapi::OpenApiService; use poem_openapi::{types::ParseFromJSON, Object}; use tokio::sync::mpsc::Sender; +#[cfg(feature = "embed_static")] +use utils::EmbeddedFilesEndpoint; mod api_connector; mod api_console; diff --git a/packages/media_utils/src/f16.rs b/packages/media_utils/src/f16.rs index 6a51f9c7..e56e81ab 100644 --- a/packages/media_utils/src/f16.rs +++ b/packages/media_utils/src/f16.rs @@ -32,7 +32,7 @@ pub struct F16i(i16); impl From for f32 { fn from(val: F16i) -> Self { - val.0 as f32 / 100.0 + val.0 as f32 / 100.0 } } From 1392d170603941973c2e59928223f3f4df259e2f Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 07:13:15 +0530 Subject: [PATCH 03/13] chore: fix rust-clippy and rust-fmt --- .github/workflows/rust-clippy.yml | 14 ----------- .github/workflows/rust-fmt.yml | 42 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/rust-fmt.yml diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 78410879..6005aa4a 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -1,7 +1,3 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. # rust-clippy is a tool that runs a bunch of lints to catch common # mistakes in your Rust code and help improve your Rust code. # More details at https://github.com/rust-lang/rust-clippy @@ -41,11 +37,6 @@ jobs: # Install protobuf-compiler (protoc) - name: Install Protobuf Compiler run: sudo apt-get install -y protobuf-compiler - - - name: Set up Rust - uses: actions/setup-rust@v1 - with: - rust-version: stable - name: Configure cache uses: actions/cache@v3 @@ -55,10 +46,6 @@ jobs: ~/.cargo/git key: cargo-${{ hashFiles('**/Cargo.toml') }} - - name: cargo fmt - run: cargo fmt --all -- --check - continue-on-error: true - - name: Install required cargo run: cargo install clippy-sarif sarif-fmt @@ -68,7 +55,6 @@ jobs: --all-features --message-format=json --all-targets -- -D warnings | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt - continue-on-error: true - name: Upload analysis results to GitHub uses: github/codeql-action/upload-sarif@v3 diff --git a/.github/workflows/rust-fmt.yml b/.github/workflows/rust-fmt.yml new file mode 100644 index 00000000..546f8ef4 --- /dev/null +++ b/.github/workflows/rust-fmt.yml @@ -0,0 +1,42 @@ +name: rust-fmt analyze + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '29 19 * * 2' + +concurrency: + # One build per PR, branch or tag + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + +jobs: + rust-clippy-analyze: + name: Run rust-clippy analyzing + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Configure cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: cargo-${{ hashFiles('**/Cargo.toml') }} + + - name: cargo fmt + run: cargo fmt --all -- --check + continue-on-error: true From a613a408f53dc62726d93132472e21cf2c66e7b3 Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 07:14:28 +0530 Subject: [PATCH 04/13] ci: Refactor GitHub actions for rust-fmt workflow - Renamed the job from "rust-clippy-analyze" to "rust-fmt-analyze" - Updated the name of the job to "Run rust-fmt analyzing" - Removed unused permissions for "security-events" and "actions" - Added the step to configure the cache for cargo - Updated the command to run "cargo fmt" --- .github/workflows/rust-fmt.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust-fmt.yml b/.github/workflows/rust-fmt.yml index 546f8ef4..6d7e2d4d 100644 --- a/.github/workflows/rust-fmt.yml +++ b/.github/workflows/rust-fmt.yml @@ -18,8 +18,8 @@ env: CARGO_TERM_COLOR: always jobs: - rust-clippy-analyze: - name: Run rust-clippy analyzing + rust-fmt-analyze: + name: Run rust-fmt analyzing runs-on: ubuntu-latest permissions: contents: read From 007418f6e70ce48e6b45ff775808296a4986b04a Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 07:29:16 +0530 Subject: [PATCH 05/13] test: break clippy on purpose to test GH Actions --- packages/transport_webrtc/src/media/vp8.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/transport_webrtc/src/media/vp8.rs b/packages/transport_webrtc/src/media/vp8.rs index 9d43a29e..0e68455e 100644 --- a/packages/transport_webrtc/src/media/vp8.rs +++ b/packages/transport_webrtc/src/media/vp8.rs @@ -99,7 +99,6 @@ pub fn parse_rtp(packet: &[u8], rid: Option) -> Option { } } -#[allow(unused_assignments)] pub fn rewrite_rtp(payload: &mut [u8], sim: &Vp8Sim) { let mut payload_index = 0; From ede9328ec6657969a16ce8a20178c04b81a2cf89 Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 07:44:21 +0530 Subject: [PATCH 06/13] Refactor GitHub workflows and protoc compilation --- .github/workflows/rust-clippy.yml | 8 -------- .github/workflows/rust-fmt.yml | 8 -------- packages/protocol/build.rs | 1 + 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 6005aa4a..439bab85 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -37,14 +37,6 @@ jobs: # Install protobuf-compiler (protoc) - name: Install Protobuf Compiler run: sudo apt-get install -y protobuf-compiler - - - name: Configure cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: cargo-${{ hashFiles('**/Cargo.toml') }} - name: Install required cargo run: cargo install clippy-sarif sarif-fmt diff --git a/.github/workflows/rust-fmt.yml b/.github/workflows/rust-fmt.yml index 6d7e2d4d..58e8b3e0 100644 --- a/.github/workflows/rust-fmt.yml +++ b/.github/workflows/rust-fmt.yml @@ -29,14 +29,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Configure cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: cargo-${{ hashFiles('**/Cargo.toml') }} - - name: cargo fmt run: cargo fmt --all -- --check continue-on-error: true diff --git a/packages/protocol/build.rs b/packages/protocol/build.rs index 2c1543c0..0d698937 100644 --- a/packages/protocol/build.rs +++ b/packages/protocol/build.rs @@ -28,6 +28,7 @@ fn main() -> Result<()> { .type_attribute("cluster_connector.PeerEvent.LocalTrack", "#[derive(serde::Serialize)]") .type_attribute("cluster_connector.PeerEvent.LocalTrackAttach", "#[derive(serde::Serialize)]") .type_attribute("cluster_connector.PeerEvent.LocalTrackDetach", "#[derive(serde::Serialize)]") + .protoc_arg("--experimental_allow_proto3_optional") .compile_protos( &[ "./proto/shared.proto", From 8ff67237181043a4c7857117cb2c4e8a590f50f1 Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 07:51:10 +0530 Subject: [PATCH 07/13] chore: Update GitHub workflows for Rust code analysis - Update the configuration for running rust-clippy in GitHub Actions - Update the version of the Actions used in the workflow - Refactor the rust-fmt job in GitHub Actions to remove the continue-on-error flag --- .github/workflows/rust-clippy.yml | 2 +- .github/workflows/rust-fmt.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 439bab85..04d61b29 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -46,7 +46,7 @@ jobs: cargo clippy --all-features --message-format=json - --all-targets -- -D warnings | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt + --all-targets | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt - name: Upload analysis results to GitHub uses: github/codeql-action/upload-sarif@v3 diff --git a/.github/workflows/rust-fmt.yml b/.github/workflows/rust-fmt.yml index 58e8b3e0..55d0c878 100644 --- a/.github/workflows/rust-fmt.yml +++ b/.github/workflows/rust-fmt.yml @@ -31,4 +31,3 @@ jobs: - name: cargo fmt run: cargo fmt --all -- --check - continue-on-error: true From ca3eb2e1b2f529290418efe003f67a89d71c6824 Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 08:06:31 +0530 Subject: [PATCH 08/13] ci: Improve GitHub actions for Rust codebase --- .github/workflows/rust-clippy.yml | 20 ++++++++++++++++---- .github/workflows/rust-fmt.yml | 10 ++++++++++ .github/workflows/rust.yml | 13 +++++++++++-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 04d61b29..193df02a 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -33,10 +33,22 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - # Install protobuf-compiler (protoc) - - name: Install Protobuf Compiler - run: sudo apt-get install -y protobuf-compiler + + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Protoc + uses: arduino/setup-protoc@v3 + with: + version: "25.1" + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install required cargo run: cargo install clippy-sarif sarif-fmt diff --git a/.github/workflows/rust-fmt.yml b/.github/workflows/rust-fmt.yml index 55d0c878..f35bf226 100644 --- a/.github/workflows/rust-fmt.yml +++ b/.github/workflows/rust-fmt.yml @@ -29,5 +29,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: cargo fmt run: cargo fmt --all -- --check diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f0822714..676388da 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,8 +25,17 @@ jobs: run: | sudo apt-get update sudo apt install -y libsoxr-dev libopus-dev libssl-dev libfdk-aac-dev - - name: Install Rust - run: rustup update stable + + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install Protoc uses: arduino/setup-protoc@v3 with: From 640bc6b928e8c8f97760309558b58af52e867da8 Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 08:34:13 +0530 Subject: [PATCH 09/13] ci: fail clippy while piping, if need be --- .github/workflows/rust-clippy.yml | 28 ++++++++++++++-------------- .github/workflows/rust-fmt.yml | 4 ---- packages/media_core/src/cluster.rs | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 193df02a..52440fb9 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -1,21 +1,14 @@ -# rust-clippy is a tool that runs a bunch of lints to catch common -# mistakes in your Rust code and help improve your Rust code. -# More details at https://github.com/rust-lang/rust-clippy -# and https://rust-lang.github.io/rust-clippy/ - name: rust-clippy analyze on: push: branches: [ "master" ] pull_request: - # The branches below must be a subset of the branches above branches: [ "master" ] schedule: - cron: '29 19 * * 2' concurrency: - # One build per PR, branch or tag group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -29,7 +22,7 @@ jobs: permissions: contents: read security-events: write - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + actions: read steps: - name: Checkout code uses: actions/checkout@v4 @@ -48,17 +41,24 @@ jobs: uses: arduino/setup-protoc@v3 with: version: "25.1" - repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install required cargo run: cargo install clippy-sarif sarif-fmt - name: Run rust-clippy - run: - cargo clippy - --all-features - --message-format=json - --all-targets | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt + run: | + set -o pipefail + cargo clippy --all-targets --all-features --message-format=json | + clippy-sarif > rust-clippy-results.sarif + CLIPPY_EXIT_STATUS=${PIPESTATUS[0]} + if [ "$CLIPPY_EXIT_STATUS" -ne 0 ]; then + echo "Clippy found issues." + exit $CLIPPY_EXIT_STATUS + fi + + - name: Format SARIF file + run: sarif-fmt rust-clippy-results.sarif - name: Upload analysis results to GitHub uses: github/codeql-action/upload-sarif@v3 diff --git a/.github/workflows/rust-fmt.yml b/.github/workflows/rust-fmt.yml index f35bf226..1fd3b5b6 100644 --- a/.github/workflows/rust-fmt.yml +++ b/.github/workflows/rust-fmt.yml @@ -21,10 +21,6 @@ jobs: rust-fmt-analyze: name: Run rust-fmt analyzing runs-on: ubuntu-latest - permissions: - contents: read - security-events: write - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/packages/media_core/src/cluster.rs b/packages/media_core/src/cluster.rs index f38283dc..475c9bec 100644 --- a/packages/media_core/src/cluster.rs +++ b/packages/media_core/src/cluster.rs @@ -33,7 +33,7 @@ pub struct ClusterRoomHash(pub u64); impl From<&RoomId> for ClusterRoomHash { fn from(room: &RoomId) -> Self { - let mut hash = std::hash::DefaultHasher::new(); + let mut hash = std::hash::DefaultHasher::new(); room.as_ref().hash(&mut hash); Self(hash.finish()) } From cf10ae3c5e644d2ad9419209acc37c9a2f3bf248 Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 08:51:46 +0530 Subject: [PATCH 10/13] ci: Update GitHub Actions workflow for rust-clippy --- .github/workflows/rust-clippy.yml | 29 +++++++++++------------------ packages/media_core/src/cluster.rs | 2 +- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 52440fb9..43df4c50 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -28,37 +28,30 @@ jobs: uses: actions/checkout@v4 - uses: actions/cache@v3 + id: cache-cargo with: path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ + ~/.cargo/registry + ~/.cargo/git + target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - name: Install Protoc uses: arduino/setup-protoc@v3 with: version: "25.1" repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run rust-clippy + run: cargo clippy --all-targets --all-features -- -D warnings - name: Install required cargo run: cargo install clippy-sarif sarif-fmt - - name: Run rust-clippy - run: | - set -o pipefail - cargo clippy --all-targets --all-features --message-format=json | - clippy-sarif > rust-clippy-results.sarif - CLIPPY_EXIT_STATUS=${PIPESTATUS[0]} - if [ "$CLIPPY_EXIT_STATUS" -ne 0 ]; then - echo "Clippy found issues." - exit $CLIPPY_EXIT_STATUS - fi - - - name: Format SARIF file - run: sarif-fmt rust-clippy-results.sarif + - name: Run rust-sarif + run: cargo clippy --all-features --message-format=json | + clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt - name: Upload analysis results to GitHub uses: github/codeql-action/upload-sarif@v3 diff --git a/packages/media_core/src/cluster.rs b/packages/media_core/src/cluster.rs index 475c9bec..f38283dc 100644 --- a/packages/media_core/src/cluster.rs +++ b/packages/media_core/src/cluster.rs @@ -33,7 +33,7 @@ pub struct ClusterRoomHash(pub u64); impl From<&RoomId> for ClusterRoomHash { fn from(room: &RoomId) -> Self { - let mut hash = std::hash::DefaultHasher::new(); + let mut hash = std::hash::DefaultHasher::new(); room.as_ref().hash(&mut hash); Self(hash.finish()) } From d1584195673df41527edbfb41fae480f9174002b Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 09:00:39 +0530 Subject: [PATCH 11/13] ci: fix clippy warnings --- .../internal/local_track/packet_selector/video_vp8_sim.rs | 1 + .../internal/local_track/packet_selector/video_vp9_svc.rs | 1 + packages/media_record/src/storage/disk.rs | 4 ++-- packages/media_record/src/storage/memory.rs | 8 ++++---- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/media_core/src/endpoint/internal/local_track/packet_selector/video_vp8_sim.rs b/packages/media_core/src/endpoint/internal/local_track/packet_selector/video_vp8_sim.rs index 2efddf1b..a9cba716 100644 --- a/packages/media_core/src/endpoint/internal/local_track/packet_selector/video_vp8_sim.rs +++ b/packages/media_core/src/endpoint/internal/local_track/packet_selector/video_vp8_sim.rs @@ -254,6 +254,7 @@ mod tests { res } + #[allow(clippy::too_many_arguments)] fn video_pkt(seq: u16, ts: u32, key: bool, layers: Option<&[[u16; 3]]>, spatial: u8, temporal: u8, layer_sync: bool, tl0idx: u8, pic_id: u16) -> MediaPacket { MediaPacket { ts, diff --git a/packages/media_core/src/endpoint/internal/local_track/packet_selector/video_vp9_svc.rs b/packages/media_core/src/endpoint/internal/local_track/packet_selector/video_vp9_svc.rs index 90d64484..d6365a96 100644 --- a/packages/media_core/src/endpoint/internal/local_track/packet_selector/video_vp9_svc.rs +++ b/packages/media_core/src/endpoint/internal/local_track/packet_selector/video_vp9_svc.rs @@ -268,6 +268,7 @@ mod tests { res } + #[allow(clippy::too_many_arguments)] fn video_pkt(seq: u16, ts: u32, key: bool, layers: Option<&[[u16; 3]]>, spatial: u8, temporal: u8, switching_point: bool, end_frame: bool, pic_id: u16) -> MediaPacket { MediaPacket { ts, diff --git a/packages/media_record/src/storage/disk.rs b/packages/media_record/src/storage/disk.rs index 6180de62..e90aa7b0 100644 --- a/packages/media_record/src/storage/disk.rs +++ b/packages/media_record/src/storage/disk.rs @@ -154,8 +154,8 @@ mod test { let storage = DiskStorage::new("/tmp/"); let mut mem_file = MemoryFile::default(); - mem_file.write(&[1, 2, 3, 4]).await.expect("should write"); - mem_file.write(&[5, 6, 7, 8, 9]).await.expect("should write"); + mem_file.write_all(&[1, 2, 3, 4]).await.expect("should write"); + mem_file.write_all(&[5, 6, 7, 8, 9]).await.expect("should write"); let mut file = storage.copy_from_mem(mem_file).await.expect("Should create file"); diff --git a/packages/media_record/src/storage/memory.rs b/packages/media_record/src/storage/memory.rs index 4f31ee0c..5f43013d 100644 --- a/packages/media_record/src/storage/memory.rs +++ b/packages/media_record/src/storage/memory.rs @@ -159,8 +159,8 @@ mod test { use std::io::Write; let mut file = MemoryFile::default(); - file.write(&[1, 2, 3, 4]).expect("should write"); - file.write(&[5, 6, 7, 8, 9]).expect("should write"); + file.write_all(&[1, 2, 3, 4]).expect("should write"); + file.write_all(&[5, 6, 7, 8, 9]).expect("should write"); let mut buf = [0; 10]; let len = file.read(&mut buf).await.unwrap(); @@ -177,8 +177,8 @@ mod test { use tokio::io::AsyncWriteExt; let mut file = MemoryFile::default(); - file.write(&[1, 2, 3, 4]).await.expect("should write"); - file.write(&[5, 6, 7, 8, 9]).await.expect("should write"); + file.write_all(&[1, 2, 3, 4]).await.expect("should write"); + file.write_all(&[5, 6, 7, 8, 9]).await.expect("should write"); let mut buf = [0; 10]; let len = file.read(&mut buf).await.unwrap(); From 072139a98852f66451774606cd7b2ce77a31be0e Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 09:04:55 +0530 Subject: [PATCH 12/13] ci: fix last error --- packages/transport_webrtc/src/media/vp8.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/transport_webrtc/src/media/vp8.rs b/packages/transport_webrtc/src/media/vp8.rs index 0e68455e..e3c8ac6b 100644 --- a/packages/transport_webrtc/src/media/vp8.rs +++ b/packages/transport_webrtc/src/media/vp8.rs @@ -129,6 +129,7 @@ pub fn rewrite_rtp(payload: &mut [u8], sim: &Vp8Sim) { } } + #[allow(unused_assignments)] if l == 1 { payload[payload_index] = sim.tl0_pic_idx.unwrap_or(0); payload_index += 1; From 814b14caf3a7a12f2cd17cce6397427abd75128f Mon Sep 17 00:00:00 2001 From: dhilipsiva Date: Thu, 18 Jul 2024 09:16:09 +0530 Subject: [PATCH 13/13] ci: restore comments --- .github/workflows/rust-clippy.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index 43df4c50..3068840e 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -1,9 +1,15 @@ +# rust-clippy is a tool that runs a bunch of lints to catch common +# mistakes in your Rust code and help improve your Rust code. +# More details at https://github.com/rust-lang/rust-clippy +# and https://rust-lang.github.io/rust-clippy/ + name: rust-clippy analyze on: push: branches: [ "master" ] pull_request: + # The branches below must be a subset of the branches above branches: [ "master" ] schedule: - cron: '29 19 * * 2' @@ -22,7 +28,7 @@ jobs: permissions: contents: read security-events: write - actions: read + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status steps: - name: Checkout code uses: actions/checkout@v4