From f81f6b3f5fc0d53536568521b9b2f70b262d123e Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 22 Nov 2024 20:25:50 -0800 Subject: [PATCH 1/5] release-plz --- .github/workflows/pr.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..8325078 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,28 @@ +name: pr + +on: + pull_request: + branches: ["main"] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # Install Rust with clippy/rustfmt + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy, rustfmt + + # Make sure u guys don't write bad code + - run: cargo test --verbose + - run: cargo clippy --no-deps + - run: cargo fmt --check + + # Check for unused dependencies + - uses: bnjbvr/cargo-machete@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..34d50d1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: release + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + steps: + # Checkout the repository + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Instal Rust + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + # Run release-plz to create PRs and releases + - name: Run release-plz + uses: MarcoIeni/release-plz-action@v0.5 + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} From 93f0fdcaa6cf73e47de9aaa2fae159196f011692 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 22 Nov 2024 20:29:31 -0800 Subject: [PATCH 2/5] Fix build --- .github/workflows/pr.yml | 2 +- src/audio/mod.rs | 2 -- src/video/color.rs | 20 +++++++++++++------- src/video/mod.rs | 1 - 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8325078..32f6c32 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,7 +20,7 @@ jobs: components: clippy, rustfmt # Make sure u guys don't write bad code - - run: cargo test --verbose + - run: cargo check - run: cargo clippy --no-deps - run: cargo fmt --check diff --git a/src/audio/mod.rs b/src/audio/mod.rs index 091e213..c63a414 100644 --- a/src/audio/mod.rs +++ b/src/audio/mod.rs @@ -1,5 +1,3 @@ mod decoder; mod encoder; -pub use decoder::*; -pub use encoder::*; diff --git a/src/video/color.rs b/src/video/color.rs index e2db776..3d4c928 100644 --- a/src/video/color.rs +++ b/src/video/color.rs @@ -2,6 +2,12 @@ pub struct ColorSpaceConfig { inner: web_sys::VideoColorSpaceInit, } +impl Default for ColorSpaceConfig { + fn default() -> Self { + Self::new() + } +} + impl ColorSpaceConfig { pub fn new() -> Self { Self { @@ -9,23 +15,23 @@ impl ColorSpaceConfig { } } - pub fn full_range(mut self, enabled: bool) -> Self { + pub fn full_range(self, enabled: bool) -> Self { self.inner.set_full_range(enabled); self } - pub fn matrix(mut self, matrix: MatrixCoefficients) -> Self { - self.inner.set_matrix(matrix.into()); + pub fn matrix(self, matrix: MatrixCoefficients) -> Self { + self.inner.set_matrix(matrix); self } - pub fn primaries(mut self, primaries: ColorPrimaries) -> Self { - self.inner.set_primaries(primaries.into()); + pub fn primaries(self, primaries: ColorPrimaries) -> Self { + self.inner.set_primaries(primaries); self } - pub fn transfer(mut self, transfer: TransferCharacteristics) -> Self { - self.inner.set_transfer(transfer.into()); + pub fn transfer(self, transfer: TransferCharacteristics) -> Self { + self.inner.set_transfer(transfer); self } } diff --git a/src/video/mod.rs b/src/video/mod.rs index dd4f8de..24e4043 100644 --- a/src/video/mod.rs +++ b/src/video/mod.rs @@ -5,5 +5,4 @@ mod frame; pub use color::*; pub use decoder::*; -pub use encoder::*; pub use frame::*; From c3b94fbf02240727c0b749f005fb3bdc37941f80 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 22 Nov 2024 20:32:49 -0800 Subject: [PATCH 3/5] Install WASM --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 32f6c32..73a0abd 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -17,6 +17,7 @@ jobs: # Install Rust with clippy/rustfmt - uses: actions-rust-lang/setup-rust-toolchain@v1 with: + target: wasm32-unknown-unknown components: clippy, rustfmt # Make sure u guys don't write bad code From b59a66295287491a2518fcab3fad18c67fe6616c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 22 Nov 2024 20:34:48 -0800 Subject: [PATCH 4/5] Unstable flags? --- .github/workflows/pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 73a0abd..f2769fa 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,6 +20,9 @@ jobs: target: wasm32-unknown-unknown components: clippy, rustfmt + # Set RUSTFLAGS + - run: echo "RUSTFLAGS=--cfg=web_sys_unstable_apis" >> $GITHUB_ENV + # Make sure u guys don't write bad code - run: cargo check - run: cargo clippy --no-deps From 1c256c533c4365dae3792c2396bed3b726706767 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 22 Nov 2024 20:37:19 -0800 Subject: [PATCH 5/5] cargo fmt --- src/audio/decoder.rs | 1 + src/audio/encoder.rs | 1 + src/audio/mod.rs | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/decoder.rs b/src/audio/decoder.rs index e69de29..8b13789 100644 --- a/src/audio/decoder.rs +++ b/src/audio/decoder.rs @@ -0,0 +1 @@ + diff --git a/src/audio/encoder.rs b/src/audio/encoder.rs index e69de29..8b13789 100644 --- a/src/audio/encoder.rs +++ b/src/audio/encoder.rs @@ -0,0 +1 @@ + diff --git a/src/audio/mod.rs b/src/audio/mod.rs index c63a414..02c46b0 100644 --- a/src/audio/mod.rs +++ b/src/audio/mod.rs @@ -1,3 +1,2 @@ mod decoder; mod encoder; -