diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 00000000..9d31a0de --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,40 @@ +name: codspeed-benchmarks + +on: + # Run on pushes to the master branch + push: + branches: + - "master" + # Run on pull requests + pull_request: + # `workflow_dispatch` allows CodSpeed to trigger backtest + # performance analysis in order to generate initial data. + workflow_dispatch: + +jobs: + benchmarks: + strategy: + matrix: + runs-on: + - ubuntu-latest + - codspeed-macro + runs-on: ${{ matrix.runs-on }} + steps: + - uses: actions/checkout@v4 + - name: Setup rust toolchain, cache and cargo-codspeed binary + uses: moonrepo/setup-rust@v1 + with: + cache-target: release + bins: cargo-codspeed@2.8.0-alpha.3 + + - run: sudo apt install --yes --no-install-recommends libasound2-dev pkg-config + + - name: Build the benchmark target(s) + run: cargo codspeed build + + - name: Run the benchmarks + uses: CodSpeedHQ/action@v3 + with: + run: cargo codspeed run + runner-version: 3.3.0 + token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 1f661ffd..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CI - -on: - pull_request: - push: - branches: [ main, master ] - -env: - RUSTFLAGS: "-C debuginfo=0 -D warnings" - CARGO_TERM_COLOR: always - CARGO_INCREMENTAL: 0 - -jobs: - tests: - name: Tests - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.toolchain == 'nightly' }} - strategy: - fail-fast: false - matrix: - os: [ macos-latest, windows-latest, ubuntu-latest ] - toolchain: [ stable, beta, nightly ] - include: - - os: macos-latest - MACOS: true - - os: windows-latest - - os: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install linux build requirements - run: sudo apt install --yes --no-install-recommends libasound2-dev pkg-config - if: contains(matrix.os, 'ubuntu') - - - name: install ${{ matrix.toolchain }} toolchain - run: rustup toolchain install ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - - - run: cargo clippy -- -D warnings - if: matrix.toolchain == 'stable' && matrix.os == 'ubuntu-latest' - - - run: | - rustup component add rustfmt - cargo fmt --all -- --check - if: matrix.toolchain == 'stable' && matrix.os == 'ubuntu-latest' - - - run: cargo test --all-targets - - run: cargo test --lib --bins --tests --benches --features=experimental - - run: cargo test --all-targets --features=symphonia-all - # `cargo test` does not check benchmarks and `cargo test --all-targets` excludes - # documentation tests. Therefore, we need an additional docs test command here. - - run: cargo test --doc - # Check minimal build. `tests/seek.rs` fails if there are no decoders at all, - # adding one to make the tests check pass. - - run: cargo check --tests --lib --no-default-features --features mp3 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 4df455f0..00000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: Publish - -on: workflow_dispatch - -jobs: - cargo-publish: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.version_tag }} - - - name: Fetch tags - run: git fetch --prune --unshallow --tags - - - name: Install linux build requirements - run: sudo apt install --yes --no-install-recommends libasound2-dev pkg-config - - - name: Publish and tag - run: | - echo "Current git commit is $(git rev-list -n 1 HEAD)." - - VERSION="$(yq '.package.version' Cargo.toml)" - echo "Project version from Cargo.toml is $VERSION" - if ! (echo "$VERSION" | grep --quiet "^[0-9]\{1,2\}\.[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\?$"); then - echo "The version format does not look like a release version, not publishing the crate." - exit 1 - fi - - VERSION_TAG="v$VERSION" - if git tag | grep --quiet "^$VERSION_TAG$"; then - echo "Tag $VERSION_TAG already exists at $(git rev-list -n 1 $VERSION_TAG), not publishing the crate." - exit 1 - fi - - cargo publish --token "${{ secrets.CRATESIO_TOKEN }}" - - echo "Tagging current version with $VERSION_TAG ..." - # The bot name and email is taken from here https://github.com/actions/checkout/pull/1707 - # see also https://api.github.com/users/github-actions%5Bbot%5D - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag --annotate "$VERSION_TAG" --message "Release version $VERSION_TAG" - git push origin "$VERSION_TAG" diff --git a/Cargo.lock b/Cargo.lock index 636ea8cc..291932c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,7 +75,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", "regex", @@ -195,6 +195,69 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688" +[[package]] +name = "codspeed" +version = "2.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "430714d22e066484bc7f3a2a4e46d9394fa4e34389d7cb1341a99a2aba06de01" +dependencies = [ + "colored", + "libc", + "serde", + "serde_json", + "uuid", +] + +[[package]] +name = "codspeed-divan-compat" +version = "2.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb6f22e2a9ae92d8d332be81e26d56184c4f0d9a7dc9db254ce33c4549ebc442" +dependencies = [ + "codspeed", + "codspeed-divan-compat-macros", + "codspeed-divan-compat-walltime", +] + +[[package]] +name = "codspeed-divan-compat-macros" +version = "2.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f01d8b938e316ff557c8f9b0df646d37da64f357b26c5b3c6768860987409047" +dependencies = [ + "divan-macros", + "itertools 0.14.0", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "codspeed-divan-compat-walltime" +version = "2.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49b4e512b125cde561c3322d03ec5709f6bdbdfcbc8dcd743b592fd1ebc8dc1" +dependencies = [ + "cfg-if", + "clap", + "codspeed", + "condtype", + "divan-macros", + "libc", + "regex-lite", +] + +[[package]] +name = "colored" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +dependencies = [ + "lazy_static", + "windows-sys 0.59.0", +] + [[package]] name = "combine" version = "4.6.7" @@ -281,25 +344,11 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" -[[package]] -name = "divan" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc40f214f0d9e897cfc72e2edfa5c225d3252f758c537f11ac0a80371c073a6" -dependencies = [ - "cfg-if", - "clap", - "condtype", - "divan-macros", - "libc", - "regex-lite", -] - [[package]] name = "divan-macros" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bdb5411188f7f878a17964798c1264b6b0a9f915bd39b20bf99193c923e1b4e" +checksum = "8dc51d98e636f5e3b0759a39257458b22619cac7e96d932da6eeb052891bb67c" dependencies = [ "proc-macro2", "quote", @@ -456,7 +505,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets 0.52.6", ] [[package]] @@ -496,6 +557,21 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" + [[package]] name = "jni" version = "0.21.1" @@ -862,7 +938,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", ] [[package]] @@ -913,10 +989,10 @@ dependencies = [ "approx", "atomic_float", "claxon", + "codspeed-divan-compat", "cpal", "crossbeam-channel", "dasp_sample", - "divan", "hound", "lewton", "minimp3_fixed", @@ -998,6 +1074,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ryu" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" + [[package]] name = "same-file" version = "1.0.6" @@ -1013,6 +1095,38 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +[[package]] +name = "serde" +version = "1.0.217" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.217" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.138" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1305,6 +1419,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[package]] +name = "uuid" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced87ca4be083373936a67f8de945faa23b6b42384bd5b64434850802c6dccd0" +dependencies = [ + "getrandom 0.3.1", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -1321,6 +1444,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.13.3+wasi-0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-bindgen" version = "0.2.96" @@ -1616,6 +1748,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "zerocopy" version = "0.7.35" diff --git a/Cargo.toml b/Cargo.toml index 4e756567..f7a307f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ rstest = "0.18.2" rstest_reuse = "0.6.0" approx = "0.5.1" dasp_sample = "0.11.0" -divan = "0.1.14" +divan = { package = "codspeed-divan-compat", version = "2.8.0-alpha.3" } [[bench]] name = "effects"