Skip to content

Commit

Permalink
ci: Modernize CI and add clippy (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
a1phyr authored Feb 29, 2024
1 parent d3b7742 commit a24cb97
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 53 deletions.
93 changes: 43 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,49 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, "windows-latest"]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
run: rustup install stable && rustup default stable

- name: Check default features
uses: actions-rs/cargo@v1
with:
command: check
args: --all
run: cargo check --all

- name: Check all features
uses: actions-rs/cargo@v1
with:
command: check
args: --all --all-features --exclude symphonia-play
run: cargo check --all --all-features --exclude symphonia-play

clippy:
name: Clippy ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Setup Toolchain
run: rustup install stable && rustup default stable

- name: Check default features
run: cargo clippy --all -- -D warnings

- name: Check all features
run: cargo clippy --all --all-features --exclude symphonia-play -- -D warnings

test:
name: Test ${{ matrix.config.target }} on ${{ matrix.config.os }}

env:
CARGO: cargo
CROSS_VERSION: v0.2.5

runs-on: ${{ matrix.config.os }}
strategy:
matrix:
Expand All @@ -51,55 +66,33 @@ jobs:
- { os: ubuntu-latest, target: powerpc-unknown-linux-gnu, use-cross: true }

steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
run: rustup install stable && rustup default stable

- name: Setup Cross
if: matrix.config.use-cross
run: |
cargo install cross --locked
echo "CARGO=cross" >> $GITHUB_ENV
- name: Test default features
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.config.target }} --all --exclude symphonia-play
use-cross: ${{ matrix.config.use-cross }}
run: ${{ env.CARGO }} test --target ${{ matrix.config.target }} --all --exclude symphonia-play

- name: Test all features
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.config.target }} --all --all-features --exclude symphonia-play
use-cross: ${{ matrix.config.use-cross }}

- name: Test documentation
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.config.target }} --all --all-features --doc --exclude symphonia-play
use-cross: ${{ matrix.config.use-cross }}
run: ${{ env.CARGO }} test --target ${{ matrix.config.target }} --all --all-features --exclude symphonia-play

fmt:
name: Rustfmt

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
run: rustup install nightly --profile minimal && rustup default nightly && rustup component add rustfmt

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ Symphonia reads untrusted data which may be corrupted or deliberately malicious.

A baseline level of quality is required before a PR is merged. All known audio glitches should be fixed, and the potential harm of any undiscovered audio glitch should be minimized.

The build must be free of any warnings.
A clean build must be free of compiler warnings.

Running clippy against the change is recommended, but not mandatory. Fuzzing is also recommended, but not mandatory.
In addition to any compiler warnings, please also fix any warnings generated by `cargo clippy`. GitHub will not allow a PR to be merged with outstanding clippy warnings.

Fuzzing is recommended, but not mandatory.

### Code Formatting

Expand Down
2 changes: 1 addition & 1 deletion symphonia-bundle-mp3/src/layer3/stereo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ lazy_static! {
///
/// The value of i0 is dependant on the least significant bit of scalefac_compress.
///
/// ```text
/// ```text
/// scalefac_compress & 1 | i0
/// ----------------------+---------------------
/// 0 | 1 / sqrt(sqrt(2.0))
Expand Down

0 comments on commit a24cb97

Please sign in to comment.