Skip to content

Commit 8fd9309

Browse files
Merge #206
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]>
2 parents 8c6b47e + 72df734 commit 8fd9309

File tree

62 files changed

+122
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+122
-112
lines changed

.github/codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: false

.github/workflows/codecov.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This doesn't work currently there is a bug in the output of grcov
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- trying
7+
8+
name: Code Coverage
9+
jobs:
10+
coverage:
11+
name: Run test coverage
12+
runs-on: ubuntu-latest
13+
continue-on-error: true
14+
steps:
15+
- uses: actions/checkout@v1
16+
with:
17+
submodules: recursive
18+
- name: Toolchain setup
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: nightly
22+
override: true
23+
components: llvm-tools-preview
24+
- name: Cache cargo
25+
uses: actions/cache@v2
26+
id: cache
27+
with:
28+
path: |
29+
~/.cargo/registry
30+
~/.cargo/git
31+
~/.cargo/bin
32+
key: ${{ runner.os }}-nightly-cargo-target-cov-${{ hashFiles('**/Cargo.lock') }}
33+
restore-keys: ${{ runner.os }}-nightly-cargo-target-${{ hashFiles('**/Cargo.lock') }}
34+
- name: Install cargo-llvm-cov
35+
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
36+
- name: Generate code coverage
37+
# env:
38+
# RUSTFLAGS: '-Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
39+
# RUSTDOCFLAGS: '-Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
40+
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
41+
- name: Determine PR number
42+
if: ${{ github.ref == 'refs/heads/trying' }}
43+
run: git log -1 --pretty=format:"%s" | awk '{ print "PR_NUMBER=" substr($NF,2,length($NF)-2) }' >> $GITHUB_ENV
44+
# - name: Determine actual commit
45+
# if: ${{ github.ref == 'refs/heads/trying' }}
46+
# run: git rev-parse HEAD~1 | awk '{ print "ACTUAL_COMMIT_SHA=" $NF }' >> $GITHUB_ENV
47+
- name: Upload to codecov.io
48+
uses: codecov/codecov-action@v2
49+
with:
50+
files: ./lcov.info
51+
override_pr: ${{env.PR_NUMBER}}
52+
# override_commit: ${{env.ACTUAL_COMMIT_SHA}}

.github/workflows/codecov.yml.x

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/eventsub/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//!
1010
//! To parse these, use [`Payload::parse`]
1111
//!
12-
//! ```rust,no_run
12+
//! ```rust
1313
//! use twitch_api2::eventsub::Payload;
1414
//! let payload = r#"{
1515
//! "subscription": {

src/helix/bits/get_cheermotes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! To use this endpoint, construct a [`GetCheermotesRequest`] with the [`GetCheermotesRequest::builder()`] method.
99
//! If you do not provide an ID, the request will only include global cheermotes as defined by twitch.
1010
//!
11-
//! ```rust, no_run
11+
//! ```rust
1212
//! use twitch_api2::helix::bits::get_cheermotes;
1313
//! let request = get_cheermotes::GetCheermotesRequest::builder()
1414
//! .broadcaster_id(Some("1234".into()))

src/helix/channels/get_channel_editors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetChannelEditorsRequest`] with the [`GetChannelEditorsRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::channels::get_channel_editors;
1212
//! let request = get_channel_editors::GetChannelEditorsRequest::builder()
1313
//! .broadcaster_id("1234")

src/helix/channels/get_channel_information.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetChannelInformationRequest`] with the [`GetChannelInformationRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::channels::get_channel_information;
1212
//! let request = get_channel_information::GetChannelInformationRequest::builder()
1313
//! .broadcaster_id("1234")

src/helix/channels/modify_channel_information.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`ModifyChannelInformationRequest`] with the [`ModifyChannelInformationRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::channels::modify_channel_information;
1212
//! let request = modify_channel_information::ModifyChannelInformationRequest::builder()
1313
//! .broadcaster_id("1234")

src/helix/channels/start_commercial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`StartCommercialRequest`] with the [`StartCommercialRequest::new()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::channels::start_commercial;
1212
//! let request = start_commercial::StartCommercialRequest::new();
1313
//! ```

src/helix/chat/get_channel_chat_badges.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetChannelChatBadgesRequest`] with the [`GetChannelChatBadgesRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::chat::get_channel_chat_badges;
1212
//! let request = get_channel_chat_badges::GetChannelChatBadgesRequest::builder()
1313
//! .broadcaster_id("1234".to_string())

src/helix/chat/get_channel_emotes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetChannelEmotesRequest`] with the [`GetChannelEmotesRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::chat::get_channel_emotes;
1212
//! let request = get_channel_emotes::GetChannelEmotesRequest::builder()
1313
//! .broadcaster_id("1234".to_string())

src/helix/chat/get_emote_sets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetEmoteSetsRequest`] with the [`GetEmoteSetsRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::chat::get_emote_sets;
1212
//! let request = get_emote_sets::GetEmoteSetsRequest::builder()
1313
//! .emote_set_id(vec!["1234".into()])

src/helix/chat/get_global_chat_badges.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetGlobalChatBadgesRequest`] with the [`GetGlobalChatBadgesRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::chat::get_global_chat_badges;
1212
//! let request = get_global_chat_badges::GetGlobalChatBadgesRequest::new();
1313
//! ```

src/helix/chat/get_global_emotes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetGlobalEmotesRequest`] with the [`GetGlobalEmotesRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::chat::get_global_emotes;
1212
//! let request = get_global_emotes::GetGlobalEmotesRequest::default();
1313
//! ```

src/helix/clips/get_clips.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetClipsRequest`] with the [`GetClipsRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::clips::get_clips;
1212
//! let request = get_clips::GetClipsRequest::builder()
1313
//! .broadcaster_id(Some("1234".into()))

src/helix/games/get_games.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetGamesRequest`] with the [`GetGamesRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::games::get_games;
1212
//! let request = get_games::GetGamesRequest::builder()
1313
//! .id(vec!["4321".into()])

src/helix/games/get_top_games.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetTopGamesRequest`] with the [`GetTopGamesRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::games::get_top_games;
1212
//! let request = get_top_games::GetTopGamesRequest::builder()
1313
//! .first(100)

src/helix/hypetrain/get_hypetrain_events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetHypeTrainEventsRequest`] with the [`GetHypeTrainEventsRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::hypetrain::get_hypetrain_events;
1212
//! let request = get_hypetrain_events::GetHypeTrainEventsRequest::builder()
1313
//! .broadcaster_id("4321".to_string())

src/helix/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! Aside from using [`HelixClient`] as described on [the crate documentation](crate),
55
//! you can decide to use this library without any specific client implementation.
66
//!
7-
//! ```rust,no_run
7+
//! ```rust
88
//! use twitch_api2::helix::{self, Request, RequestGet, users::{GetUsersRequest, User}};
99
//!
1010
//! # #[tokio::main]
@@ -24,8 +24,16 @@
2424
//! println!("{:#?}", user);
2525
//! # Ok(())
2626
//! # }
27-
//! # fn send_http_request(_: http::Request<Vec<u8>>) -> Result<http::Response<Vec<u8>>,&'static str> {todo!()}
27+
//! # fn send_http_request(_: http::Request<Vec<u8>>) -> Result<http::Response<Vec<u8>>,&'static str> {
28+
//! # 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())
29+
//! # }
2830
//! ```
31+
//!
32+
33+
// fn send_http_request(_: http::Request<Vec<u8>>) -> Result<http::Response<Vec<u8>>, &'static str> {
34+
// 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())
35+
// }
36+
2937
use serde::Deserialize;
3038
use std::{convert::TryInto, str::FromStr};
3139
#[cfg(feature = "twitch_oauth2")]

src/helix/moderation/check_automod_status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`CheckAutoModStatusRequest`] with the [`CheckAutoModStatusRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::moderation::check_automod_status;
1212
//! let request = check_automod_status::CheckAutoModStatusRequest::builder()
1313
//! .broadcaster_id("1234")

src/helix/moderation/get_banned_events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetBannedEventsRequest`] with the [`GetBannedEventsRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::moderation::get_banned_events;
1212
//! let request = get_banned_events::GetBannedEventsRequest::builder()
1313
//! .broadcaster_id("1234")

src/helix/moderation/get_banned_users.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetBannedUsersRequest`] with the [`GetBannedUsersRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::moderation::get_banned_users;
1212
//! let request = get_banned_users::GetBannedUsersRequest::builder()
1313
//! .broadcaster_id("1234")

src/helix/moderation/get_moderator_events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetModeratorEventsRequest`] with the [`GetModeratorEventsRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::moderation::get_moderator_events;
1212
//! let request = get_moderator_events::GetModeratorEventsRequest::builder()
1313
//! .broadcaster_id("1234")

src/helix/moderation/get_moderators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`GetModeratorsRequest`] with the [`GetModeratorsRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::moderation::get_moderators;
1212
//! let request = get_moderators::GetModeratorsRequest::builder()
1313
//! .broadcaster_id("1234")

src/helix/moderation/manage_held_automod_messages.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`ManageHeldAutoModMessagesRequest`] with the [`ManageHeldAutoModMessagesRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::moderation::manage_held_automod_messages;
1212
//! let request = manage_held_automod_messages::ManageHeldAutoModMessagesRequest::new();
1313
//! ```
@@ -132,7 +132,7 @@ impl Request for ManageHeldAutoModMessagesRequest {
132132
impl RequestPost for ManageHeldAutoModMessagesRequest {
133133
type Body = ManageHeldAutoModMessagesBody;
134134

135-
fn parse_inner_response(
135+
fn parse_inner_response<'d>(
136136
request: Option<Self>,
137137
uri: &http::Uri,
138138
response: &str,

src/helix/points/create_custom_rewards.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`CreateCustomRewardRequest`] with the [`CreateCustomRewardRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::points::create_custom_rewards;
1212
//! let request = create_custom_rewards::CreateCustomRewardRequest::builder()
1313
//! .broadcaster_id("274637212")

src/helix/points/delete_custom_reward.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`DeleteCustomRewardRequest`] with the [`DeleteCustomRewardRequest::builder()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::points::delete_custom_reward;
1212
//! let request = delete_custom_reward::DeleteCustomRewardRequest::builder()
1313
//! .broadcaster_id("274637212")

src/helix/points/get_custom_reward.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//!
1010
//! To use this endpoint, construct a [`GetCustomRewardRequest`] with the [`GetCustomRewardRequest::builder()`] method.
1111
//!
12-
//! ```rust, no_run
12+
//! ```rust
1313
//! use twitch_api2::helix::points::GetCustomRewardRequest;
1414
//! let request = GetCustomRewardRequest::builder()
1515
//! .broadcaster_id("274637212".to_string())

src/helix/points/get_custom_reward_redemption.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//!
1010
//! To use this endpoint, construct a [`GetCustomRewardRedemptionRequest`] with the [`GetCustomRewardRedemptionRequest::builder()`] method.
1111
//!
12-
//! ```rust, no_run
12+
//! ```rust
1313
//! use twitch_api2::helix::points::{CustomRewardRedemptionStatus, GetCustomRewardRedemptionRequest};
1414
//! let request = GetCustomRewardRedemptionRequest::builder()
1515
//! .broadcaster_id("274637212".to_string())

src/helix/points/update_custom_reward.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//!
1010
//! To use this endpoint, construct an [`UpdateCustomRewardRequest`] with the [`UpdateCustomRewardRequest::builder()`] method.
1111
//!
12-
//! ```rust, no_run
12+
//! ```rust
1313
//! use twitch_api2::helix::points::update_custom_reward;
1414
//! let request = update_custom_reward::UpdateCustomRewardRequest::builder()
1515
//! .broadcaster_id("274637212")

src/helix/points/update_redemption_status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//!
1010
//! To use this endpoint, construct a [`UpdateRedemptionStatusRequest`] with the [`UpdateRedemptionStatusRequest::builder()`] method.
1111
//!
12-
//! ```rust, no_run
12+
//! ```rust
1313
//! use twitch_api2::helix::points::UpdateRedemptionStatusRequest;
1414
//! let request = UpdateRedemptionStatusRequest::builder()
1515
//! .broadcaster_id("274637212".to_string())

src/helix/polls/create_poll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! To use this endpoint, construct a [`CreatePollRequest`] with the [`CreatePollRequest::new()`] method.
99
//!
10-
//! ```rust, no_run
10+
//! ```rust
1111
//! use twitch_api2::helix::polls::create_poll;
1212
//! let request = create_poll::CreatePollRequest::new();
1313
//! ```

0 commit comments

Comments
 (0)