diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0f680cc..d0ddba5 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -46,6 +46,26 @@ jobs: cargo build --verbose --all-features cargo test --verbose --all-features fi + - name: Check common non-default feature configurations + run: | + echo "No features:" + cargo check --features="" --no-default-features + echo "Only client:" + cargo check --features="client" --no-default-features + echo "Only backend:" + cargo check --features="backend" --no-default-features + echo "Only voice:" + cargo check --features="voice" --no-default-features + echo "Only voice gateway:" + cargo check --features="voice_gateway" --no-default-features + echo "Backend + client:" + cargo check --features="backend, client" --no-default-features + echo "Backend + voice:" + cargo check --features="backend, voice" --no-default-features + echo "Backend + voice gateway:" + cargo check --features="backend, voice_gateway" --no-default-features + echo "Client + voice gateway:" + cargo check --features="client, voice_gateway" --no-default-features # wasm-safari: # runs-on: macos-latest # steps: @@ -75,7 +95,7 @@ jobs: # cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force # SAFARIDRIVER=$(which safaridriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt" --no-fail-fast wasm-gecko: - runs-on: macos-latest + runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v4 @@ -101,7 +121,7 @@ jobs: run: | rustup target add wasm32-unknown-unknown curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash - cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force + cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.92" --force GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway" wasm-chrome: runs-on: macos-latest @@ -130,5 +150,5 @@ jobs: run: | rustup target add wasm32-unknown-unknown curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash - cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force + cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.92" --force CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway" diff --git a/semver_release_checks.yml b/semver_release_checks.yml new file mode 100644 index 0000000..12dd718 --- /dev/null +++ b/semver_release_checks.yml @@ -0,0 +1,18 @@ +name: Semver release checks + +on: + pull_request: + branches: ["main"] + +env: + CARGO_TERM_COLOR: always + +jobs: + semver-checks: + + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v4 + - uses: obi1kenobi/cargo-semver-checks-action@v2 diff --git a/src/types/entities/message.rs b/src/types/entities/message.rs index 4f444e3..c4abb8e 100644 --- a/src/types/entities/message.rs +++ b/src/types/entities/message.rs @@ -255,61 +255,3 @@ pub struct MessageActivity { pub activity_type: i64, pub party_id: Option, } - -#[cfg(test)] -mod tests { - #[test] - fn test_deserialize_message() { - let raw = r#"{ - "id":"1246967362553443002", - "channel_id":"1246967361836216935", - "guild_id":"1246967361001550368", - "author":{ - "username":"integrationtestuser", - "discriminator":"3864", - "id":"1246967359860699591", - "public_flags":0, - "avatar":null, - "accent_color":null, - "banner":null, - "bio":"", - "bot":false, - "premium_since":"2024-06-02T23:23:06.124+00:00", - "premium_type":2, - "theme_colors":null, - "pronouns":null - }, - "member":{ - "index":142, - "id":"1246967359860699591", - "guild_id":"1246967361001550368", - "nick":null, - "joined_at":"2024-06-02T23:23:06.526+00:00", - "premium_since":null,"deaf":false,"mute":false,"pending":false, - "last_message_id":null, - "joined_by":null, - "avatar":null, - "banner":null, - "bio":"", - "theme_colors":null, - "pronouns":null, - "communication_disabled_until":null, - "roles":[] - }, - "content":"A Message!", - "timestamp":"2024-06-02T23:23:06.762+00:00", - "edited_timestamp":null, - "tts":false, - "mention_everyone":false, - "mentions":[], - "mention_roles":[], - "attachments":[], - "embeds":[], - "reactions":[], - "pinned":false, - "type":0, - "flags":null - }"#; - let message: super::Message = serde_json::from_str(raw).unwrap(); - } -} \ No newline at end of file diff --git a/src/types/events/channel.rs b/src/types/events/channel.rs index 911f249..dd16754 100644 --- a/src/types/events/channel.rs +++ b/src/types/events/channel.rs @@ -96,7 +96,7 @@ pub struct ChannelUnreadUpdate { pub struct ChannelUnreadUpdateObject { pub id: Snowflake, pub last_message_id: Snowflake, - pub last_pin_timestamp: Option, + pub last_pin_timestamp: Option>, } #[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField, WebSocketEvent)] diff --git a/src/types/schema/auth.rs b/src/types/schema/auth.rs index c1c1f55..83c88dc 100644 --- a/src/types/schema/auth.rs +++ b/src/types/schema/auth.rs @@ -2,9 +2,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -use chrono::{DateTime, Utc}; +use chrono::NaiveDate; use serde::{Deserialize, Serialize}; -use crate::types::utils::serde::ts_seconds_option_str; #[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] @@ -15,8 +14,8 @@ pub struct RegisterSchema { pub email: Option, pub fingerprint: Option, pub invite: Option, - #[serde(with = "ts_seconds_option_str")] - pub date_of_birth: Option>, + /// The user's date of birth, serialized as an ISO8601 date + pub date_of_birth: Option, pub gift_code_sku_id: Option, pub captcha_key: Option, pub promotional_email_opt_in: Option, diff --git a/tests/auth.rs b/tests/auth.rs index a2f2c3f..705328a 100644 --- a/tests/auth.rs +++ b/tests/auth.rs @@ -2,13 +2,16 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -use chrono::DateTime; +use std::str::FromStr; + use chorus::types::{LoginSchema, RegisterSchema}; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::*; #[cfg(target_arch = "wasm32")] wasm_bindgen_test_configure!(run_in_browser); +use chrono::NaiveDate; + mod common; #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] @@ -17,7 +20,7 @@ async fn test_registration() { let mut bundle = common::setup().await; let reg = RegisterSchema { username: "Hiiii".into(), - date_of_birth: Some(DateTime::from_timestamp(978325200, 0).unwrap()), + date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()), consent: true, ..Default::default() }; @@ -33,7 +36,7 @@ async fn test_login() { username: "Hiiii".into(), email: Some("testuser1@integrationtesting.xyz".into()), password: Some("Correct-Horse-Battery-Staple1".into()), - date_of_birth: Some(DateTime::from_timestamp(978325200, 0).unwrap()), + date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()), consent: true, ..Default::default() }; @@ -55,7 +58,7 @@ async fn test_wrong_login() { username: "Hiiii".into(), email: Some("testuser2@integrationtesting.xyz".into()), password: Some("Correct-Horse-Battery-Staple1".into()), - date_of_birth: Some(DateTime::from_timestamp(978325200, 0).unwrap()), + date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()), consent: true, ..Default::default() }; diff --git a/tests/common/mod.rs b/tests/common/mod.rs index a07e503..315db38 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -2,7 +2,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -use chrono::DateTime; +use std::str::FromStr; + use chorus::gateway::Gateway; use chorus::types::IntoShared; use chorus::{ @@ -14,6 +15,8 @@ use chorus::{ UrlBundle, }; +use chrono::NaiveDate; + #[allow(dead_code)] #[derive(Debug)] pub(crate) struct TestBundle { @@ -31,7 +34,7 @@ impl TestBundle { let register_schema = RegisterSchema { username: username.to_string(), consent: true, - date_of_birth: Some(DateTime::from_timestamp(978325200, 0).unwrap()), + date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()), ..Default::default() }; self.instance @@ -61,7 +64,7 @@ pub(crate) async fn setup() -> TestBundle { let reg = RegisterSchema { username: "integrationtestuser".into(), consent: true, - date_of_birth: Some(DateTime::from_timestamp(978325200, 0).unwrap()), + date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()), ..Default::default() }; let guild_create_schema = GuildCreateSchema {