From a9788305a8fdd386d7f8d0be0131aea03b1acadf Mon Sep 17 00:00:00 2001 From: Yotaro Kubo Date: Wed, 20 Sep 2023 14:44:53 +0900 Subject: [PATCH] Add CI for CLI tool crate. This commit also fixes a small issue found by clippy. --- .github/workflows/rust.yml | 38 +++++++++++++++++++++++++++++++------- flacenc-bin/src/main.rs | 2 +- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 763dc8e..cb43057 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,17 +24,29 @@ jobs: override: true components: rustfmt, clippy - name: Install external dependencies - run: sudo apt-get install -y libsndfile1-dev + run: sudo apt-get update && sudo apt-get install -y libsndfile1-dev - name: Run cargo check - uses: actions-rs/cargo@v1 + uses: ClementTsang/cargo-action@v0.0.3 with: command: check + args: --verbose --all-targets --all-features - name: Run tests - uses: actions-rs/cargo@v1 + uses: ClementTsang/cargo-action@v0.0.3 with: command: test - args: --verbose - + args: --verbose --all-targets --all-features + - name: Run cargo check (CLI) + uses: ClementTsang/cargo-action@v0.0.3 + with: + command: check + args: --verbose --all-targets --all-features + directory: flacenc-bin + - name: Run tests (CLI) + uses: ClementTsang/cargo-action@v0.0.3 + with: + command: test + args: --verbose --all-targets --all-features + directory: flacenc-bin lints: runs-on: ubuntu-latest steps: @@ -47,14 +59,26 @@ jobs: override: true components: rustfmt, clippy - name: Code format check - uses: actions-rs/cargo@v1 + uses: ClementTsang/cargo-action@v0.0.3 with: command: fmt args: --check - name: Clippy - uses: actions-rs/cargo@v1 + uses: ClementTsang/cargo-action@v0.0.3 with: command: clippy args: --tests -- -D warnings - name: Generate docs (for doc syntax checking) run: cargo doc + - name: Code format check (CLI tools) + uses: ClementTsang/cargo-action@v0.0.3 + with: + command: fmt + args: --check + directory: flacenc-bin + - name: Clippy (CLI tools) + uses: ClementTsang/cargo-action@v0.0.3 + with: + command: clippy + args: --tests -- -D warnings + directory: flacenc-bin diff --git a/flacenc-bin/src/main.rs b/flacenc-bin/src/main.rs index 4793060..01c61ee 100644 --- a/flacenc-bin/src/main.rs +++ b/flacenc-bin/src/main.rs @@ -151,7 +151,7 @@ fn run_encoder( source: source::PreloadedSignal, ) -> Result { let block_size = encoder_config.block_sizes[0]; - coding::encode_with_fixed_block_size(&encoder_config, source, block_size) + coding::encode_with_fixed_block_size(encoder_config, source, block_size) } #[allow(clippy::expect_used)]