|
| 1 | +name: Code Quality |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + paths-ignore: |
| 7 | + - "**.md" |
| 8 | + - "docs/**" |
| 9 | + - "LICENSE*" |
| 10 | + - ".gitignore" |
| 11 | + pull_request: |
| 12 | + branches: [master] |
| 13 | + paths-ignore: |
| 14 | + - "**.md" |
| 15 | + - "docs/**" |
| 16 | + - "LICENSE*" |
| 17 | + - ".gitignore" |
| 18 | + |
| 19 | +jobs: |
| 20 | + formatting: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v5 |
| 24 | + |
| 25 | + - name: Install Rust toolchain |
| 26 | + uses: dtolnay/rust-toolchain@stable |
| 27 | + with: |
| 28 | + components: rustfmt |
| 29 | + |
| 30 | + - name: Check formatting |
| 31 | + run: cargo fmt --all -- --check |
| 32 | + |
| 33 | + lints-stable: |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + include: |
| 38 | + # Linux - ALSA/JACK backend |
| 39 | + - target: x86_64-unknown-linux-gnu |
| 40 | + name: Linux |
| 41 | + features: --all-features |
| 42 | + os: ubuntu-latest |
| 43 | + |
| 44 | + # Windows - WASAPI backend |
| 45 | + - target: x86_64-pc-windows-msvc |
| 46 | + name: Windows |
| 47 | + features: --all-features |
| 48 | + os: windows-latest |
| 49 | + |
| 50 | + # macOS - CoreAudio backend |
| 51 | + - target: aarch64-apple-darwin |
| 52 | + name: macOS |
| 53 | + features: --all-features |
| 54 | + os: ubuntu-latest |
| 55 | + |
| 56 | + # Android - Oboe backend |
| 57 | + - target: armv7-linux-androideabi |
| 58 | + name: Android |
| 59 | + features: "" |
| 60 | + os: ubuntu-latest |
| 61 | + |
| 62 | + # iOS - CoreAudio (iOS) backend |
| 63 | + - target: aarch64-apple-ios |
| 64 | + name: iOS |
| 65 | + features: "" |
| 66 | + os: ubuntu-latest |
| 67 | + |
| 68 | + # WASM - wasm-bindgen feature |
| 69 | + - target: wasm32-unknown-unknown |
| 70 | + name: WASM-bindgen |
| 71 | + features: --features wasm-bindgen |
| 72 | + os: ubuntu-latest |
| 73 | + |
| 74 | + # WASM - Emscripten |
| 75 | + - target: wasm32-unknown-emscripten |
| 76 | + name: WASM-emscripten |
| 77 | + features: "" |
| 78 | + os: ubuntu-latest |
| 79 | + |
| 80 | + # WASM - WASI |
| 81 | + - target: wasm32-wasip1 |
| 82 | + name: WASI |
| 83 | + features: "" |
| 84 | + os: ubuntu-latest |
| 85 | + |
| 86 | + name: clippy-${{ matrix.name }} |
| 87 | + runs-on: ${{ matrix.os }} |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v5 |
| 90 | + |
| 91 | + - name: Cache Linux audio packages |
| 92 | + if: runner.os == 'Linux' |
| 93 | + uses: awalsh128/cache-apt-pkgs-action@latest |
| 94 | + with: |
| 95 | + packages: libasound2-dev libjack-jackd2-dev libjack-jackd2-0 libdbus-1-dev |
| 96 | + |
| 97 | + - name: Setup ASIO SDK |
| 98 | + if: runner.os == 'Windows' |
| 99 | + run: | |
| 100 | + curl -L -o asio.zip https://www.steinberg.net/asiosdk |
| 101 | + 7z x -oasio asio.zip |
| 102 | + move asio\*\* asio\ |
| 103 | + choco install asio4all |
| 104 | + choco install llvm |
| 105 | +
|
| 106 | + - name: Install Rust toolchain |
| 107 | + uses: dtolnay/rust-toolchain@stable |
| 108 | + with: |
| 109 | + components: clippy |
| 110 | + targets: ${{ matrix.target }} |
| 111 | + |
| 112 | + - name: Rust Cache |
| 113 | + uses: Swatinem/rust-cache@v2 |
| 114 | + with: |
| 115 | + key: clippy-${{ matrix.target }}-${{ matrix.name }} |
| 116 | + |
| 117 | + - name: Run clippy |
| 118 | + env: |
| 119 | + CPAL_ASIO_DIR: ${{ runner.os == 'Windows' && format('{0}/asio', github.workspace) || '' }} |
| 120 | + run: cargo clippy --all --target ${{ matrix.target }} ${{ matrix.features }} -- -D warnings |
| 121 | + |
| 122 | + lints-nightly: |
| 123 | + name: clippy-WASM-worklet |
| 124 | + runs-on: ubuntu-latest |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@v5 |
| 127 | + |
| 128 | + - name: Cache Linux audio packages |
| 129 | + uses: awalsh128/cache-apt-pkgs-action@latest |
| 130 | + with: |
| 131 | + packages: libasound2-dev libjack-jackd2-dev libjack-jackd2-0 libdbus-1-dev |
| 132 | + |
| 133 | + - name: Install Rust toolchain |
| 134 | + uses: dtolnay/rust-toolchain@nightly |
| 135 | + with: |
| 136 | + components: clippy, rust-src |
| 137 | + targets: wasm32-unknown-unknown |
| 138 | + |
| 139 | + - name: Rust Cache |
| 140 | + uses: Swatinem/rust-cache@v2 |
| 141 | + with: |
| 142 | + key: clippy-wasm32-worklet |
| 143 | + |
| 144 | + - name: Run clippy (web_audio_worklet) |
| 145 | + env: |
| 146 | + RUSTFLAGS: -C target-feature=+atomics,+bulk-memory,+mutable-globals |
| 147 | + run: cargo +nightly clippy --all --target wasm32-unknown-unknown --features web_audio_worklet -Z build-std=std,panic_abort -- -D warnings |
0 commit comments