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

New CI #219

Merged
merged 8 commits into from
Jul 5, 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
50 changes: 20 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,41 @@ jobs:
command: fmt
args: --all -- --check

# Cross compilation is only needed for the main client and not the entire
# workspace.
cross-compile:
name: Cross Compile
docs:
name: Check Docs
runs-on: ubuntu-latest
env:
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- arm-unknown-linux-gnueabihf
- armv7-unknown-linux-gnueabihf
client:
- rspotify/cli,rspotify/env-file,rspotify/client-ureq,rspotify/ureq-rustls-tls,rspotify-http/client-ureq,rspotify-http/ureq-rustls-tls
- rspotify/cli,rspotify/env-file,rspotify/client-reqwest,rspotify/reqwest-rustls-tls,rspotify-http/client-reqwest,rspotify-http/reqwest-rustls-tls
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install gcc for armhf
run: sudo apt-get update && sudo apt-get install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}

- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: -p rspotify -p rspotify-http -p rspotify-model -p rspotify-macros --no-default-features --features=${{ matrix.client }} --target ${{ matrix.target }}
- name: Install cargo-deadlinks
run: cargo install cargo-deadlinks

- name: Build and Check
run: RUSTDOCFLAGS='-D warnings' cargo doc --features=cli,env-file
Copy link
Owner

Choose a reason for hiding this comment

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

Do we just check dead links for cli and env-file features, with ignoring other features?

Copy link
Collaborator Author

@marioortizmanero marioortizmanero Jul 5, 2021

Choose a reason for hiding this comment

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

The rest of the features don't add anything new to the docs. Here I just generate the docs with everything possible in order to check for dead links.


- name: Look for Dead Links
run: |
cd target
for crate in doc/rspotify*; do
echo ">> Checking in $crate"
cargo deadlinks --check-http --dir "$crate"
done
continue-on-error: true

test-client:
test:
name: Test and Lint for each Client
runs-on: ubuntu-latest
strategy:
matrix:
client:
features:
- rspotify/cli,rspotify/env-file,rspotify/client-ureq,rspotify/ureq-rustls-tls,rspotify-http/client-ureq,rspotify-http/ureq-rustls-tls
- rspotify/cli,rspotify/env-file,rspotify/client-reqwest,rspotify/reqwest-rustls-tls,rspotify-http/client-reqwest,rspotify-http/reqwest-rustls-tls
steps:
Expand All @@ -90,10 +80,10 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: -p rspotify -p rspotify-http -p rspotify-model -p rspotify-macros --no-default-features --features=${{ matrix.client }} -- -D warnings
args: -p rspotify -p rspotify-http -p rspotify-model -p rspotify-macros --no-default-features --features=${{ matrix.features }} -- -D warnings

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: -p rspotify -p rspotify-http -p rspotify-model -p rspotify-macros --no-default-features --features=${{ matrix.client }}
args: -p rspotify -p rspotify-http -p rspotify-model -p rspotify-macros --no-default-features --features=${{ matrix.features }}
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ __async = ["futures", "async-stream", "async-trait"]
__sync = ["maybe-async/is_sync"]

[package.metadata.docs.rs]
# Also documenting the CLI methods
features = ["cli"]
# Documenting the CLI methods, and working links for `dotenv`
features = ["cli", "env-file"]

[[example]]
name = "client_creds"
Expand Down
15 changes: 8 additions & 7 deletions rspotify-model/src/enums/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::Country;
/// `skipping_next`, `skipping_prev`, `toggling_repeat_context`,
/// `toggling_shuffle`, `toggling_repeat_track`, `transferring_playback`.
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/object-model/#disallows-object)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-disallowsobject)
#[derive(Clone, Serialize, Deserialize, Copy, PartialEq, Eq, Debug, Hash, AsRefStr)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
Expand Down Expand Up @@ -50,7 +50,7 @@ pub enum RepeatState {

/// Type for include_external: `audio`.
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/search/search/)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-search)
#[derive(Clone, Serialize, Deserialize, Copy, PartialEq, Eq, Debug, AsRefStr)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
Expand All @@ -72,7 +72,7 @@ pub enum DatePrecision {

/// The reason for the restriction: `market`, `product`, `explicit`
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/object-model/#track-restriction-object)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-albumrestrictionobject)
#[derive(Clone, Serialize, Deserialize, Copy, PartialEq, Eq, Debug, AsRefStr)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
Expand All @@ -82,11 +82,12 @@ pub enum RestrictionReason {
Explict,
}

/// Indicates the modality (major or minor) of a track
/// This field will contain a 0 for `minor`, a 1 for `major` or
/// a -1 for `no result`
/// Indicates the modality (major or minor) of a track.
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-analysis/#section-object)
/// This field will contain a 0 for `minor`, a 1 for `major` or a -1 for `no
/// result`
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#objects-index)
#[derive(Clone, Serialize, Deserialize, Copy, PartialEq, Eq, Debug, AsRefStr)]
pub enum Modality {
Minor = 0,
Expand Down
10 changes: 5 additions & 5 deletions rspotify-model/src/enums/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strum::{AsRefStr, Display, EnumString};
/// Copyright type: `C` = the copyright, `P` = the sound recording (performance)
/// copyright.
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/object-model/#copyright-object)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-copyrightobject)
#[derive(Clone, Serialize, Deserialize, Copy, PartialEq, Eq, Debug, AsRefStr)]
pub enum CopyrightType {
#[strum(serialize = "P")]
Expand All @@ -17,7 +17,7 @@ pub enum CopyrightType {

/// Album type: `album`, `single`, `appears_on`, `compilation`
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/object-model/#album-object-full)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#objects-index)
#[derive(Clone, Serialize, Deserialize, Copy, PartialEq, Eq, Debug, AsRefStr)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
Expand Down Expand Up @@ -89,7 +89,7 @@ pub enum SearchType {
///
/// (The subscription level "open" can be considered the same as "free".)
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/users-profile/get-current-users-profile/)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-current-users-profile)
#[derive(Clone, Serialize, Deserialize, Copy, PartialEq, Eq, Debug, AsRefStr)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
Expand All @@ -101,7 +101,7 @@ pub enum SubscriptionLevel {

/// Device Type: `computer`, `smartphone`, `speaker`, `TV`
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/player/get-a-users-available-devices/#device-types)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-deviceobject)
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, AsRefStr)]
#[strum(serialize_all = "snake_case")]
pub enum DeviceType {
Expand All @@ -122,7 +122,7 @@ pub enum DeviceType {

/// Recommendations seed type
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/object-model/#recommendations-seed-object)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-recommendationseedobject)
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, AsRefStr)]
#[serde(rename_all = "snake_case")]
pub enum RecommendationsSeedType {
Expand Down
4 changes: 2 additions & 2 deletions rspotify-model/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ pub struct SearchEpisodes {
pub episodes: Page<SimplifiedEpisode>,
}

/// Search result
/// Search result of any kind
///
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/search/search/)
/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#category-search)
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum SearchResult {
#[serde(rename = "playlists")]
Expand Down
6 changes: 3 additions & 3 deletions src/auth_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ use url::Url;
/// is that this doesn't require the user to log in, and that it's a simpler
/// procedure.
///
/// See [this related example](example-refresh-token) to learn more about
/// See [this related example][example-refresh-token] to learn more about
/// refreshing tokens.
///
/// There's a [webapp example](example-webapp) for more details on how you can
/// implement it for something like a web server, or [this one](example-main)
/// There's a [webapp example][example-webapp] for more details on how you can
/// implement it for something like a web server, or [this one][example-main]
/// for a CLI use case.
///
/// An example of the CLI authentication:
Expand Down
4 changes: 2 additions & 2 deletions src/auth_code_pkce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use maybe_async::maybe_async;
use url::Url;

/// The [Authorization Code Flow with Proof Key for Code Exchange
/// (PKCE)](reference) client for the Spotify API.
/// (PKCE)][reference] client for the Spotify API.
///
/// This flow is very similar to the regular Authorization Code Flow, so please
/// read [`AuthCodeSpotify`](crate::AuthCodeSpotify) for more information about
/// it. The main difference in this case is that you can avoid storing your
/// client secret by generating a *code verifier* and a *code challenge*.
///
/// There's an [example](example-main) available to learn how to use this
/// There's an [example][example-main] available to learn how to use this
/// client.
///
/// [reference]: https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow-with-proof-key-for-code-exchange-pkce
Expand Down
4 changes: 2 additions & 2 deletions src/client_creds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use crate::{

use maybe_async::maybe_async;

/// The [Client Credentials Flow](reference) client for the Spotify API.
/// The [Client Credentials Flow][reference] client for the Spotify API.
///
/// This is the most basic flow. It requests a token to Spotify given some
/// client credentials, without user authorization. The only step to take is to
/// call [`Self::request_token`]. See [this example](example-main).
/// call [`Self::request_token`]. See [this example][example-main].
///
/// Note: This flow does not include authorization and therefore cannot be used
/// to access or to manage the endpoints related to user private data in
Expand Down
31 changes: 15 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
//! Rspotify is a wrapper for the [Spotify Web API](spotify-main), inspired by
//! [spotipy](spotipy-github). It includes support for all the [authorization
//! flows](spotify-auth-flows), and helper methods for [all available endpoints
//! ](spotify-reference).
//! Rspotify is a wrapper for the [Spotify Web API][spotify-main], inspired by
//! [spotipy][spotipy-github]. It includes support for all the [authorization
//! flows][spotify-auth-flows], and helper methods for [all available
//! endpoints][spotify-reference].
//!
//! ## Configuration
//!
//! ### HTTP Client
//!
//! By default, Rspotify uses the [reqwest](reqwest-docs) asynchronous HTTP
//! By default, Rspotify uses the [reqwest][reqwest-docs] asynchronous HTTP
//! client with its default TLS, but you can customize both the HTTP client and
//! the TLS with the following features:
//!
//! - [reqwest](reqwest-docs): enabling
//! - [reqwest][reqwest-docs]: enabling
//! `client-reqwest`, TLS available:
//! + `reqwest-default-tls` (reqwest's default)
//! + `reqwest-rustls-tls`
//! + `reqwest-native-tls`
//! + `reqwest-native-tls-vendored`
//! - [ureq](ureq-docs): enabling `client-ureq`, TLS
//! - [ureq][ureq-docs]: enabling `client-ureq`, TLS
//! available:
//! + `ureq-rustls-tls` (ureq's default)
//!
Expand Down Expand Up @@ -49,7 +49,7 @@
//!
//! ### Proxies
//!
//! [reqwest supports system proxies by default](reqwest-proxies). It reads the
//! [reqwest supports system proxies by default][reqwest-proxies]. It reads the
//! environment variables `HTTP_PROXY` and `HTTPS_PROXY` environmental variables
//! to set HTTP and HTTPS proxies, respectively.
//!
Expand Down Expand Up @@ -77,22 +77,22 @@
//! All endpoints require app authorization; you will need to generate a token
//! that indicates that the client has been granted permission to perform
//! requests. You can start by [registering your app to get the necessary client
//! credentials](spotify-register-app). Read the [official guide for a detailed
//! credentials][spotify-register-app]. Read the [official guide for a detailed
//! explanation of the different authorization flows
//! available](spotify-auth-flows).
//! available][spotify-auth-flows].
//!
//! Rspotify has a different client for each of the available authentication
//! flows. They may implement the endpoints in
//! [`BaseClient`](crate::clients::BaseClient) or
//! [`OAuthClient`](crate::clients::OAuthClient) according to what kind of
//! flow it is. Please refer to their documentation for more details:
//!
//! * [Client Credentials Flow](spotify-client-creds): see
//! * [Client Credentials Flow][spotify-client-creds]: see
//! [`ClientCredsSpotify`].
//! * [Authorization Code Flow](spotify-auth-code): see [`AuthCodeSpotify`].
//! * [Authorization Code Flow][spotify-auth-code]: see [`AuthCodeSpotify`].
//! * [Authorization Code Flow with Proof Key for Code Exchange
//! (PKCE)](spotify-auth-code-pkce): see [`AuthCodePkceSpotify`].
//! * [Implicit Grant Flow](spotify-implicit-grant): unimplemented, as Rspotify
//! (PKCE)][spotify-auth-code-pkce]: see [`AuthCodePkceSpotify`].
//! * [Implicit Grant Flow][spotify-implicit-grant]: unimplemented, as Rspotify
//! has not been tested on a browser yet. If you'd like support for it, let us
//! know in an issue!
//!
Expand All @@ -105,7 +105,7 @@
//! ### Examples
//!
//! There are some [available examples on the GitHub
//! repository](examples-github) which can serve as a learning tool.
//! repository][examples-github] which can serve as a learning tool.
//!
//! [spotipy-github]: https://github.com/plamere/spotipy
//! [reqwest-docs]: https://docs.rs/reqwest/
Expand All @@ -116,7 +116,6 @@
//! [spotify-auth-flows]: https://developer.spotify.com/documentation/general/guides/authorization-guide
//! [spotify-reference]: https://developer.spotify.com/documentation/web-api/reference/
//! [spotify-register-app]: https://developer.spotify.com/dashboard/applications
//! [spotify]: https://developer.spotify.com/documentation/general/guides/authorization-guide/
//! [spotify-client-creds]: https://developer.spotify.com/documentation/general/guides/authorization-guide/#client-credentials-flow
//! [spotify-auth-code]: https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow
//! [spotify-auth-code-pkce]: https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow-with-proof-key-for-code-exchange-pkce
Expand Down