Skip to content

Commit

Permalink
Merge #206
Browse files Browse the repository at this point in the history
206: coverage r=Emilgardis a=Emilgardis

Trying to enable coverage again, this time allowing failure, and using instrument-coverage.

Co-authored-by: Emil Gardström <[email protected]>
  • Loading branch information
bors[bot] and Emilgardis authored Aug 22, 2021
2 parents 8c6b47e + 72df734 commit 8fd9309
Show file tree
Hide file tree
Showing 62 changed files with 122 additions and 112 deletions.
1 change: 1 addition & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
52 changes: 52 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This doesn't work currently there is a bug in the output of grcov
on:
push:
branches:
- master
- trying

name: Code Coverage
jobs:
coverage:
name: Run test coverage
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Toolchain setup
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: llvm-tools-preview
- name: Cache cargo
uses: actions/cache@v2
id: cache
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
key: ${{ runner.os }}-nightly-cargo-target-cov-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-nightly-cargo-target-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-llvm-cov
run: curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Generate code coverage
# env:
# RUSTFLAGS: '-Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
# RUSTDOCFLAGS: '-Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
run: cargo llvm-cov --features "twitch_oauth2/all all unsupported deny_unknown_fields trace_unknown_fields" --doctests --ignore-filename-regex "twitch_oauth2" --lcov --output-path lcov.info
- name: Determine PR number
if: ${{ github.ref == 'refs/heads/trying' }}
run: git log -1 --pretty=format:"%s" | awk '{ print "PR_NUMBER=" substr($NF,2,length($NF)-2) }' >> $GITHUB_ENV
# - name: Determine actual commit
# if: ${{ github.ref == 'refs/heads/trying' }}
# run: git rev-parse HEAD~1 | awk '{ print "ACTUAL_COMMIT_SHA=" $NF }' >> $GITHUB_ENV
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
files: ./lcov.info
override_pr: ${{env.PR_NUMBER}}
# override_commit: ${{env.ACTUAL_COMMIT_SHA}}
51 changes: 0 additions & 51 deletions .github/workflows/codecov.yml.x

This file was deleted.

2 changes: 1 addition & 1 deletion src/eventsub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//!
//! To parse these, use [`Payload::parse`]
//!
//! ```rust,no_run
//! ```rust
//! use twitch_api2::eventsub::Payload;
//! let payload = r#"{
//! "subscription": {
Expand Down
2 changes: 1 addition & 1 deletion src/helix/bits/get_cheermotes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! To use this endpoint, construct a [`GetCheermotesRequest`] with the [`GetCheermotesRequest::builder()`] method.
//! If you do not provide an ID, the request will only include global cheermotes as defined by twitch.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::bits::get_cheermotes;
//! let request = get_cheermotes::GetCheermotesRequest::builder()
//! .broadcaster_id(Some("1234".into()))
Expand Down
2 changes: 1 addition & 1 deletion src/helix/channels/get_channel_editors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetChannelEditorsRequest`] with the [`GetChannelEditorsRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::channels::get_channel_editors;
//! let request = get_channel_editors::GetChannelEditorsRequest::builder()
//! .broadcaster_id("1234")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/channels/get_channel_information.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetChannelInformationRequest`] with the [`GetChannelInformationRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::channels::get_channel_information;
//! let request = get_channel_information::GetChannelInformationRequest::builder()
//! .broadcaster_id("1234")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/channels/modify_channel_information.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`ModifyChannelInformationRequest`] with the [`ModifyChannelInformationRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::channels::modify_channel_information;
//! let request = modify_channel_information::ModifyChannelInformationRequest::builder()
//! .broadcaster_id("1234")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/channels/start_commercial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`StartCommercialRequest`] with the [`StartCommercialRequest::new()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::channels::start_commercial;
//! let request = start_commercial::StartCommercialRequest::new();
//! ```
Expand Down
2 changes: 1 addition & 1 deletion src/helix/chat/get_channel_chat_badges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetChannelChatBadgesRequest`] with the [`GetChannelChatBadgesRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::chat::get_channel_chat_badges;
//! let request = get_channel_chat_badges::GetChannelChatBadgesRequest::builder()
//! .broadcaster_id("1234".to_string())
Expand Down
2 changes: 1 addition & 1 deletion src/helix/chat/get_channel_emotes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetChannelEmotesRequest`] with the [`GetChannelEmotesRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::chat::get_channel_emotes;
//! let request = get_channel_emotes::GetChannelEmotesRequest::builder()
//! .broadcaster_id("1234".to_string())
Expand Down
2 changes: 1 addition & 1 deletion src/helix/chat/get_emote_sets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetEmoteSetsRequest`] with the [`GetEmoteSetsRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::chat::get_emote_sets;
//! let request = get_emote_sets::GetEmoteSetsRequest::builder()
//! .emote_set_id(vec!["1234".into()])
Expand Down
2 changes: 1 addition & 1 deletion src/helix/chat/get_global_chat_badges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetGlobalChatBadgesRequest`] with the [`GetGlobalChatBadgesRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::chat::get_global_chat_badges;
//! let request = get_global_chat_badges::GetGlobalChatBadgesRequest::new();
//! ```
Expand Down
2 changes: 1 addition & 1 deletion src/helix/chat/get_global_emotes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetGlobalEmotesRequest`] with the [`GetGlobalEmotesRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::chat::get_global_emotes;
//! let request = get_global_emotes::GetGlobalEmotesRequest::default();
//! ```
Expand Down
2 changes: 1 addition & 1 deletion src/helix/clips/get_clips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetClipsRequest`] with the [`GetClipsRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::clips::get_clips;
//! let request = get_clips::GetClipsRequest::builder()
//! .broadcaster_id(Some("1234".into()))
Expand Down
2 changes: 1 addition & 1 deletion src/helix/games/get_games.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetGamesRequest`] with the [`GetGamesRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::games::get_games;
//! let request = get_games::GetGamesRequest::builder()
//! .id(vec!["4321".into()])
Expand Down
2 changes: 1 addition & 1 deletion src/helix/games/get_top_games.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetTopGamesRequest`] with the [`GetTopGamesRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::games::get_top_games;
//! let request = get_top_games::GetTopGamesRequest::builder()
//! .first(100)
Expand Down
2 changes: 1 addition & 1 deletion src/helix/hypetrain/get_hypetrain_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetHypeTrainEventsRequest`] with the [`GetHypeTrainEventsRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::hypetrain::get_hypetrain_events;
//! let request = get_hypetrain_events::GetHypeTrainEventsRequest::builder()
//! .broadcaster_id("4321".to_string())
Expand Down
12 changes: 10 additions & 2 deletions src/helix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! Aside from using [`HelixClient`] as described on [the crate documentation](crate),
//! you can decide to use this library without any specific client implementation.
//!
//! ```rust,no_run
//! ```rust
//! use twitch_api2::helix::{self, Request, RequestGet, users::{GetUsersRequest, User}};
//!
//! # #[tokio::main]
Expand All @@ -24,8 +24,16 @@
//! println!("{:#?}", user);
//! # Ok(())
//! # }
//! # fn send_http_request(_: http::Request<Vec<u8>>) -> Result<http::Response<Vec<u8>>,&'static str> {todo!()}
//! # fn send_http_request(_: http::Request<Vec<u8>>) -> Result<http::Response<Vec<u8>>,&'static str> {
//! # Ok(http::Response::builder().body(r#"{"data":[{"id":"141981764","login":"twitchdev","display_name":"TwitchDev","type":"","broadcaster_type":"partner","description":"Supportingthird-partydevelopersbuildingTwitchintegrationsfromchatbotstogameintegrations.","profile_image_url":"https://static-cdn.jtvnw.net/jtv_user_pictures/8a6381c7-d0c0-4576-b179-38bd5ce1d6af-profile_image-300x300.png","offline_image_url":"https://static-cdn.jtvnw.net/jtv_user_pictures/3f13ab61-ec78-4fe6-8481-8682cb3b0ac2-channel_offline_image-1920x1080.png","view_count":5980557,"email":"[email protected]","created_at":"2016-12-14T20:32:28.894263Z"}]}"#.as_bytes().to_owned()).unwrap())
//! # }
//! ```
//!
// fn send_http_request(_: http::Request<Vec<u8>>) -> Result<http::Response<Vec<u8>>, &'static str> {
// Ok(http::Response::builder().body(r#"{"data":[{"id":"141981764","login":"twitchdev","display_name":"TwitchDev","type":"","broadcaster_type":"partner","description":"Supportingthird-partydevelopersbuildingTwitchintegrationsfromchatbotstogameintegrations.","profile_image_url":"https://static-cdn.jtvnw.net/jtv_user_pictures/8a6381c7-d0c0-4576-b179-38bd5ce1d6af-profile_image-300x300.png","offline_image_url":"https://static-cdn.jtvnw.net/jtv_user_pictures/3f13ab61-ec78-4fe6-8481-8682cb3b0ac2-channel_offline_image-1920x1080.png","view_count":5980557,"email":"[email protected]","created_at":"2016-12-14T20:32:28.894263Z"}]}"#.as_bytes().to_owned()).unwrap())
// }

use serde::Deserialize;
use std::{convert::TryInto, str::FromStr};
#[cfg(feature = "twitch_oauth2")]
Expand Down
2 changes: 1 addition & 1 deletion src/helix/moderation/check_automod_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`CheckAutoModStatusRequest`] with the [`CheckAutoModStatusRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::moderation::check_automod_status;
//! let request = check_automod_status::CheckAutoModStatusRequest::builder()
//! .broadcaster_id("1234")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/moderation/get_banned_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetBannedEventsRequest`] with the [`GetBannedEventsRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::moderation::get_banned_events;
//! let request = get_banned_events::GetBannedEventsRequest::builder()
//! .broadcaster_id("1234")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/moderation/get_banned_users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetBannedUsersRequest`] with the [`GetBannedUsersRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::moderation::get_banned_users;
//! let request = get_banned_users::GetBannedUsersRequest::builder()
//! .broadcaster_id("1234")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/moderation/get_moderator_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetModeratorEventsRequest`] with the [`GetModeratorEventsRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::moderation::get_moderator_events;
//! let request = get_moderator_events::GetModeratorEventsRequest::builder()
//! .broadcaster_id("1234")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/moderation/get_moderators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`GetModeratorsRequest`] with the [`GetModeratorsRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::moderation::get_moderators;
//! let request = get_moderators::GetModeratorsRequest::builder()
//! .broadcaster_id("1234")
Expand Down
4 changes: 2 additions & 2 deletions src/helix/moderation/manage_held_automod_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`ManageHeldAutoModMessagesRequest`] with the [`ManageHeldAutoModMessagesRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::moderation::manage_held_automod_messages;
//! let request = manage_held_automod_messages::ManageHeldAutoModMessagesRequest::new();
//! ```
Expand Down Expand Up @@ -132,7 +132,7 @@ impl Request for ManageHeldAutoModMessagesRequest {
impl RequestPost for ManageHeldAutoModMessagesRequest {
type Body = ManageHeldAutoModMessagesBody;

fn parse_inner_response(
fn parse_inner_response<'d>(
request: Option<Self>,
uri: &http::Uri,
response: &str,
Expand Down
2 changes: 1 addition & 1 deletion src/helix/points/create_custom_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`CreateCustomRewardRequest`] with the [`CreateCustomRewardRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::points::create_custom_rewards;
//! let request = create_custom_rewards::CreateCustomRewardRequest::builder()
//! .broadcaster_id("274637212")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/points/delete_custom_reward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`DeleteCustomRewardRequest`] with the [`DeleteCustomRewardRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::points::delete_custom_reward;
//! let request = delete_custom_reward::DeleteCustomRewardRequest::builder()
//! .broadcaster_id("274637212")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/points/get_custom_reward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//!
//! To use this endpoint, construct a [`GetCustomRewardRequest`] with the [`GetCustomRewardRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::points::GetCustomRewardRequest;
//! let request = GetCustomRewardRequest::builder()
//! .broadcaster_id("274637212".to_string())
Expand Down
2 changes: 1 addition & 1 deletion src/helix/points/get_custom_reward_redemption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//!
//! To use this endpoint, construct a [`GetCustomRewardRedemptionRequest`] with the [`GetCustomRewardRedemptionRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::points::{CustomRewardRedemptionStatus, GetCustomRewardRedemptionRequest};
//! let request = GetCustomRewardRedemptionRequest::builder()
//! .broadcaster_id("274637212".to_string())
Expand Down
2 changes: 1 addition & 1 deletion src/helix/points/update_custom_reward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//!
//! To use this endpoint, construct an [`UpdateCustomRewardRequest`] with the [`UpdateCustomRewardRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::points::update_custom_reward;
//! let request = update_custom_reward::UpdateCustomRewardRequest::builder()
//! .broadcaster_id("274637212")
Expand Down
2 changes: 1 addition & 1 deletion src/helix/points/update_redemption_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//!
//! To use this endpoint, construct a [`UpdateRedemptionStatusRequest`] with the [`UpdateRedemptionStatusRequest::builder()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::points::UpdateRedemptionStatusRequest;
//! let request = UpdateRedemptionStatusRequest::builder()
//! .broadcaster_id("274637212".to_string())
Expand Down
2 changes: 1 addition & 1 deletion src/helix/polls/create_poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! To use this endpoint, construct a [`CreatePollRequest`] with the [`CreatePollRequest::new()`] method.
//!
//! ```rust, no_run
//! ```rust
//! use twitch_api2::helix::polls::create_poll;
//! let request = create_poll::CreatePollRequest::new();
//! ```
Expand Down
Loading

0 comments on commit 8fd9309

Please sign in to comment.