Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-organize crates #18

Merged
merged 3 commits into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:

doc:
runs-on: ubuntu-latest
needs: cargo-readme
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -50,6 +51,25 @@ jobs:
DOCS_RS: 1
with:
command: doc
- name: Setup Cargo readme
uses: actions/cache@v2
with:
path: ~/.cargo/bin/cargo-readme
key: ${{ runner.os }}-cargo-readme
- name: Generate READMEs
run: |
cargo readme --no-title --no-indent-headings --no-license --no-badges > README.md
(cd sys && cargo readme --no-title --no-indent-headings --no-license --no-badges > README.md)
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katyo Maybe this needs if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/tags/') }}? Seems like it would otherwise create a PR with readme update as soon as any CI build runs with documentation changes.

In Smithay/gbm.rs#11 I'm simply failing the build if the readme doesn't match, I prefer a PR to keep the documentation and readme in sync.

Copy link
Owner Author

@katyo katyo May 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarijnS95 Of course, this is expected behavior.
Any such automatic created sub PRs should be merged with main PR branch before merging the last (see de17d96).
In such case we don't need editing READMEs manually at all.

Note: Only single sub PR will be created per main PR, on any updates it will be updated too. If no updates required then no sub PRs will be generated.

Copy link

@MarijnS95 MarijnS95 May 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it can only create a single PR if this pushes to the same branch. But what happens if two PRs change the documentation? Will those override what the CI pushes to the readme PR? IMO it's saner to run it only on master, that way it's only regenerating things that actually changed and have been accepted. Or require contributors to update it, so that changes can be reviewed/cross-validated directly from the PR.

With the CI creating merges across the merge branch (ie. #19 wanting to merge into re-org here) this is only helping users to not have to install+run the command manually. I guess that's... fine? It's not something I'd do for my own projects, that's just way too much noise though.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating READMEs via CI is quite useable because contributors may forget to do it manually.
I don't see serious problems in such design excepting some minor disadvantages like this.
In any case PRs needs to be rebased before merging. New update PR will be created when needed.
Even if contributor do not merged sub PR youself it still can be done later after merging main PR on master branch.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a fair point. It's all about convenience for contributors vs convenience for maintainers in the end (the alternative being a simple CI failure if the file wasn't updated by the contributor).

Since this PRs to the target branch, does it create a PR in the fork if I were to submit a PR to this repo with a change in the module docs?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answer is yes because I set a github.head_ref to the base property of create-pull-request@v3 action.

From gh docs:

github.head_ref string The head_ref or source branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is a pull_request.

with:
base: ${{ github.head_ref }}
commit-message: Updated READMEs
branch: update-readmes
delete-branch: true
title: Update READMEs
body: |
READMEs should be updated to be consistent with latest changes

check:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -349,15 +369,15 @@ jobs:
RUST_LOG: bindgen=warn,bindgen::ir=error,bindgen::codegen=error
with:
command: build
args: --manifest-path aubio-sys/Cargo.toml --target ${{ matrix.target }} --features update-bindings
args: --manifest-path sys/Cargo.toml --target ${{ matrix.target }} --features update-bindings
- name: Upload bindings
if: matrix.task == 'bindings'
uses: actions/upload-artifact@v2
with:
name: bindings
path: |
aubio-sys/${{ env.AUBIO_SYS_BINDINGS_FILE_SINGLE }}
aubio-sys/${{ env.AUBIO_SYS_BINDINGS_FILE_DOUBLE }}
sys/${{ env.AUBIO_SYS_BINDINGS_FILE_SINGLE }}
sys/${{ env.AUBIO_SYS_BINDINGS_FILE_DOUBLE }}
LICENSE
README.md
- name: Build
Expand Down Expand Up @@ -397,6 +417,7 @@ jobs:
title: Update bindings
body: |
Bindings should be updated to be consistent with latest changes

publish:
if: github.repository == 'katyo/aubio-rs' && startsWith(github.ref, 'refs/tags/')
needs:
Expand All @@ -417,3 +438,19 @@ jobs:
registry-token: ${{ secrets.CRATES_TOKEN }}
args: --no-verify
#dry-run: true

cargo-readme:
runs-on: ubuntu-latest
steps:
- name: Prepare cache
uses: actions/cache@v2
id: cache
with:
path: ~/.cargo/bin/cargo-readme
key: ${{ runner.os }}-cargo-readme
- name: Install cargo readme
if: steps.cache.outputs.cache-hit != 'true'
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-readme
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "aubio-sys/aubio"]
path = aubio-sys/aubio
[submodule "sys/aubio"]
path = sys/aubio
url = ../../aubio/aubio
51 changes: 45 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,55 @@
[package]
name = "aubio-rs"
version = "0.2.0"
description = "Safe bindings for aubio library to label music and sounds."
categories = ["external-ffi-bindings", "multimedia::audio"]
keywords = ["aubio", "audio", "processing", "recognition", "ffi"]
authors = ["K. <kayo@illumium.org>"]
license = "GPL-3.0"
readme = "README.md"
repository = "https://github.com/katyo/aubio-rs"
edition = "2018"

[dependencies.aubio-sys]
version = "0.2.0"
path = "sys"

[dependencies.log]
version = "0.4"
optional = true

[dev-dependencies.hound]
version = "3.4"

[features]
default = []
bindgen = ["aubio-sys/bindgen"]
builtin = ["aubio-sys/builtin"]
pkg-config = ["aubio-sys/pkg-config"]
shared = ["aubio-sys/shared"]
static = ["aubio-sys/static"]
fftw3 = ["aubio-sys/fftw3"]
intelipp = ["aubio-sys/intelipp"]
double = ["aubio-sys/double"]
accelerate = ["aubio-sys/accelerate"]
blas = ["aubio-sys/blas"]
atlas = ["aubio-sys/atlas"]
rustdoc = ["aubio-sys/rustdoc"]
check-size = []

[package.metadata.docs.rs]
features = ["rustdoc"]

[workspace]
members = [
"aubio-sys",
"aubio-rs",
]
members = ["sys"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = false
lto = true
debug-assertions = false
codegen-units = 16
codegen-units = 1
panic = 'unwind'
incremental = false
overflow-checks = false
108 changes: 58 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,58 @@
# Aubio library bindings

[![github](https://img.shields.io/badge/github-katyo/aubio--rs-8da0cb.svg?style=for-the-badge&logo=github)](https://github.com/katyo/aubio-rs)
[![crate](https://img.shields.io/crates/v/aubio-rs.svg?style=for-the-badge&color=fc8d62&logo=rust)](https://crates.io/crates/aubio-rs)
[![docs](https://img.shields.io/badge/docs.rs-aubio--rs-66c2a5?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K)](https://docs.rs/aubio-rs)
[![GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-brightgreen.svg?style=for-the-badge)](https://opensource.org/licenses/GPL-3.0)
[![CI](https://img.shields.io/github/workflow/status/katyo/aubio-rs/Rust?style=for-the-badge&logo=github-actions&logoColor=white)](https://github.com/katyo/aubio-rs/actions?query=workflow%3ARust)

This projects aims provide safe Rust bindings for [_aubio_](//github.com/aubio/aubio) C library.

> _Aubio_ is a library to label music and sounds.
>
> It listens to audio signals and attempts to detect events.
> For instance, when a drum is hit, at which frequency is a note,
> or at what tempo is a rhythmic melody.
>
> Its features include segmenting a sound file before each of its attacks,
> performing pitch detection, tapping the beat and producing midi streams
> from live audio.
>
> aubio provide several algorithms and routines, including:
>
> * several onset detection methods
> * different pitch detection methods
> * tempo tracking and beat detection
> * MFCC (mel-frequency cepstrum coefficients)
> * FFT and phase vocoder
> * up/down-sampling
> * digital filters (low pass, high pass, and more)
> * spectral filtering
> * transient/steady-state separation
> * sound file read and write access
> * various mathematics utilities for music applications
>
> The name _aubio_ comes from audio with a typo: some errors are likely
> to be found in the results.

## Crate features

The following features can be used to customize crate configuration:

* __bindgen__ Force generate bindings itself instead of use pre-generated (_useful for unsupported archs_)
* __builtin__ Force compile builtin _aubio_ C-library
* __pkg-config__ Use _pkg-config_ to find installed libraries
* __shared__ Build shared _aubio_ C-library
* __static__ Build static _aubio_ C-library
* __fftw3__ Enable using _fftw3_ library

When __pkg-config__ feature is used the installed __aubio__ library will be used if found.
To force build and link builtin version you can use __builtin__ feature.
# Safe bindings for _aubio_ library

[![github](https://img.shields.io/badge/github-katyo/aubio--rs-8da0cb.svg?style=for-the-badge&logo=github)](https://github.com/katyo/aubio-rs)
[![crate](https://img.shields.io/crates/v/aubio-rs.svg?style=for-the-badge&color=fc8d62&logo=rust)](https://crates.io/crates/aubio-rs)
[![docs](https://img.shields.io/badge/docs.rs-aubio--rs-66c2a5?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K)](https://docs.rs/aubio-rs)
[![GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-brightgreen.svg?style=for-the-badge)](https://opensource.org/licenses/GPL-3.0)
[![CI](https://img.shields.io/github/workflow/status/katyo/aubio-rs/Rust?style=for-the-badge&logo=github-actions&logoColor=white)](https://github.com/katyo/aubio-rs/actions?query=workflow%3ARust)

This crate provides safe Rust bindings to [_aubio_](https://github.com/aubio/aubio) C library.

> _Aubio_ is a library to label music and sounds.
>
> It listens to audio signals and attempts to detect events.
> For instance, when a drum is hit, at which frequency is a note,
> or at what tempo is a rhythmic melody.
>
> Its features include segmenting a sound file before each of its attacks,
> performing pitch detection, tapping the beat and producing midi streams
> from live audio.
>
> Aubio provide several algorithms and routines, including:
>
> - several onset detection methods
> - different pitch detection methods
> - tempo tracking and beat detection
> - MFCC (mel-frequency cepstrum coefficients)
> - FFT and phase vocoder
> - up/down-sampling
> - digital filters (low pass, high pass, and more)
> - spectral filtering
> - transient/steady-state separation
> - sound file read and write access
> - various mathematics utilities for music applications
>
> The name _aubio_ comes from audio with a typo: some errors are likely
> to be found in the results.

## Crate features

The following features can be used to customize configuration:

- __bindgen__ Force generate bindings itself instead of use pre-generated (_useful for unsupported archs_)
- __builtin__ Force compile builtin _aubio_ C library
- __pkg-config__ Use _pkg-config_ to find installed libraries
- __shared__ Build shared _aubio_ C-library
- __static__ Build static _aubio_ C-library
- __fftw3__ Enable using _fftw3_ library
- __intelipp__ Enable using _Intel IPP_ library
- __accelerate__ Enable using acceleration framework on _apple_ platforms
- __blas__ Enable using _blas_ library
- __atlas__ Enable using _atlas_ library
- __double__ Enable double presicion of audio sample data

When __pkg-config__ feature is used the installed __aubio__ library will be used if found.

To force build and link builtin version you can use __builtin__ feature.

The features such as __fftw3__, __intelipp__, __accelerate__, __blas__, __atlas__ and __double__ is take an effect only for builtin _aubio_ C library.
41 changes: 0 additions & 41 deletions aubio-rs/Cargo.toml

This file was deleted.

97 changes: 0 additions & 97 deletions aubio-rs/src/lib.rs

This file was deleted.

Loading