merge latest dev

This commit is contained in:
Quat3rnion 2024-06-03 01:55:12 -04:00
commit 7548f0e592
7 changed files with 58 additions and 73 deletions

View File

@ -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"

18
semver_release_checks.yml Normal file
View File

@ -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

View File

@ -255,61 +255,3 @@ pub struct MessageActivity {
pub activity_type: i64,
pub party_id: Option<String>,
}
#[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();
}
}

View File

@ -96,7 +96,7 @@ pub struct ChannelUnreadUpdate {
pub struct ChannelUnreadUpdateObject {
pub id: Snowflake,
pub last_message_id: Snowflake,
pub last_pin_timestamp: Option<String>,
pub last_pin_timestamp: Option<DateTime<Utc>>,
}
#[derive(Debug, Default, Deserialize, Serialize, Clone, JsonField, SourceUrlField, WebSocketEvent)]

View File

@ -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<String>,
pub fingerprint: Option<String>,
pub invite: Option<String>,
#[serde(with = "ts_seconds_option_str")]
pub date_of_birth: Option<DateTime<Utc>>,
/// The user's date of birth, serialized as an ISO8601 date
pub date_of_birth: Option<NaiveDate>,
pub gift_code_sku_id: Option<String>,
pub captcha_key: Option<String>,
pub promotional_email_opt_in: Option<bool>,

View File

@ -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()
};

View File

@ -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 {