7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 1 | use std::{ |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 2 | collections::BTreeMap, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 3 | env::consts::{DLL_PREFIX, DLL_SUFFIX}, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 4 | fmt::Display, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 5 | }; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 6 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 7 | use clap::{Args, Subcommand, ValueEnum}; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 8 | use xshell::cmd; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 9 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 10 | use crate::{DenyWarnings, NIGHTLY, Result, build_docs, sh, workspace}; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 11 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 12 | const WASM_TIMEOUT_ENV_KEY: &str = "WASM_BINDGEN_TEST_TIMEOUT"; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 13 | const WASM_TIMEOUT_VALUE: &str = "180"; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 14 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 15 | #[derive(Args)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 16 | pub struct CiArgs { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 17 | #[clap(subcommand)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 18 | cmd: Option<CiCommand>, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 19 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 20 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 21 | /// The kind of runner for WebAssembly tests run with `wasm-pack test`. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 22 | #[derive(Clone, Copy, Debug, Default, ValueEnum)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 23 | enum WasmTestRunner { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 24 | // Run with all available runners. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 25 | #[default] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 26 | All, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 27 | // Run with the Node.js runner. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 28 | Node, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 29 | // Run with the Firefox runner. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 30 | Firefox, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 31 | // Run with the Chrome runner. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 32 | Chrome, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 33 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 34 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 35 | impl Display for WasmTestRunner { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 36 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 37 | match self { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 38 | WasmTestRunner::All => write!(f, "all"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 39 | WasmTestRunner::Node => write!(f, "node"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 40 | WasmTestRunner::Firefox => write!(f, "firefox"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 41 | WasmTestRunner::Chrome => write!(f, "chrome"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 42 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 43 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 44 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 45 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 46 | #[derive(Subcommand)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 47 | enum CiCommand { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 48 | /// Check style |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 49 | Style, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 50 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 51 | /// Check for typos |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 52 | Typos, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 53 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 54 | /// Check clippy lints |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 55 | Clippy, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 56 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 57 | /// Check documentation |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 58 | Docs, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 59 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 60 | /// Run tests with a specific feature set |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 61 | TestFeatures { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 62 | #[clap(subcommand)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 63 | cmd: Option<FeatureSet>, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 64 | }, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 65 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 66 | /// Run clippy checks for the wasm target |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 67 | Wasm { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 68 | #[clap(subcommand)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 69 | cmd: Option<WasmFeatureSet>, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 70 | }, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 71 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 72 | /// Run tests with `wasm-pack test` |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 73 | WasmPack { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 74 | #[clap(subcommand)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 75 | cmd: Option<WasmFeatureSet>, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 76 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 77 | #[clap(long, default_value_t = WasmTestRunner::All)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 78 | runner: WasmTestRunner, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 79 | }, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 80 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 81 | /// Run tests for the different crypto crate features |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 82 | TestCrypto, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 83 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 84 | /// Check that bindings can be generated |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 85 | Bindings, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 86 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 87 | /// Check that the examples compile |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 88 | Examples, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 89 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 90 | /// Run the workspace tests and create a code coverage report using |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 91 | /// llvm-cov. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 92 | /// |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 93 | /// Note: This requires the docker container for the integration tests to be |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 94 | /// running. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 95 | Coverage { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 96 | /// Specify the output format that we're going to use. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 97 | #[arg(long, short, default_value_t = CoverageOutputFormat::Text)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 98 | output_format: CoverageOutputFormat, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 99 | }, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 100 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 101 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 102 | #[derive(Clone, Debug, Default, ValueEnum)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 103 | enum CoverageOutputFormat { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 104 | /// Output the coverage report to stdout. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 105 | #[default] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 106 | Text, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 107 | /// Output the coverage report as a HTML report in the target/llvm-cov/html |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 108 | /// folder. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 109 | Html, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 110 | /// Output the coverage report as the custom Codecov coverage format. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 111 | /// folder. |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 112 | Codecov, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 113 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 114 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 115 | impl Display for CoverageOutputFormat { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 116 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 117 | match self { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 118 | CoverageOutputFormat::Text => write!(f, "text"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 119 | CoverageOutputFormat::Html => write!(f, "html"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 120 | CoverageOutputFormat::Codecov => write!(f, "codecov"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 121 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 122 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 123 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 124 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 125 | #[derive(Subcommand, PartialEq, Eq, PartialOrd, Ord)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 126 | enum FeatureSet { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 127 | NoEncryption, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 128 | NoSqlite, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 129 | NoEncryptionAndSqlite, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 130 | SqliteCryptostore, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 131 | ExperimentalEncryptedStateEvents, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 132 | Markdown, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 133 | Socks, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 134 | SsoLogin, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 135 | Search, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 136 | ElementRecentEmojis, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 137 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 138 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 139 | #[derive(Subcommand, PartialEq, Eq, PartialOrd, Ord)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 140 | #[allow(clippy::enum_variant_names)] |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 141 | enum WasmFeatureSet { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 142 | /// Check `matrix-sdk-qrcode` crate |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 143 | MatrixSdkQrcode, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 144 | /// Check `matrix-sdk-base` crate |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 145 | MatrixSdkBase, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 146 | /// Check `matrix-sdk-common` crate |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 147 | MatrixSdkCommon, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 148 | /// Check `matrix-sdk` crate with no default features |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 149 | MatrixSdkNoDefault, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 150 | /// Check `matrix-sdk-ui` crate |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 151 | MatrixSdkUi, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 152 | /// Check `matrix-sdk` crate with `indexeddb` feature (but not |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 153 | /// `e2e-encryption`) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 154 | MatrixSdkIndexeddbStoresNoCrypto, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 155 | /// Check `matrix-sdk` crate with `indexeddb` and `e2e-encryption` features |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 156 | MatrixSdkIndexeddbStores, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 157 | /// Check `matrix-sdk-indexeddb` crate with all features |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 158 | IndexeddbAllFeatures, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 159 | /// Check `matrix-sdk-indexeddb` crate with `e2e-encryption` feature |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 160 | IndexeddbCrypto, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 161 | /// Check `matrix-sdk-indexeddb` crate with `state-store` feature |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 162 | IndexeddbState, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 163 | /// Equivalent to `indexeddb-all-features`, `indexeddb-crypto` and |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 164 | /// `indexeddb-state` |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 165 | Indexeddb, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 166 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 167 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 168 | impl CiArgs { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 169 | pub fn run(self) -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 170 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 171 | let _p = sh.push_dir(workspace::root_path()?); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 172 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 173 | match self.cmd { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 174 | Some(cmd) => match cmd { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 175 | CiCommand::Style => check_style(), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 176 | CiCommand::Typos => check_typos(), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 177 | CiCommand::Clippy => check_clippy(), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 178 | CiCommand::Docs => check_docs(), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 179 | CiCommand::TestFeatures { cmd } => run_feature_tests(cmd), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 180 | CiCommand::Wasm { cmd } => run_wasm_checks(cmd), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 181 | CiCommand::WasmPack { cmd, runner } => run_wasm_pack_tests(cmd, runner), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 182 | CiCommand::TestCrypto => run_crypto_tests(), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 183 | CiCommand::Bindings => check_bindings(), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 184 | CiCommand::Examples => check_examples(), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 185 | CiCommand::Coverage { output_format } => run_coverage(output_format), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 186 | }, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 187 | None => { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 188 | check_style()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 189 | check_clippy()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 190 | check_typos()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 191 | check_docs()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 192 | run_feature_tests(None)?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 193 | run_wasm_checks(None)?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 194 | run_crypto_tests()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 195 | check_examples()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 196 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 197 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 198 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 199 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 200 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 201 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 202 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 203 | fn check_bindings() -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 204 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 205 | cmd!(sh, "rustup run stable cargo build -p matrix-sdk-crypto-ffi -p matrix-sdk-ffi --features sentry,experimental-element-recent-emojis").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 206 | cmd!( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 207 | sh, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 208 | " |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 209 | rustup run stable cargo run -p uniffi-bindgen -- generate |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 210 | --library |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 211 | --language kotlin |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 212 | --language swift |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 213 | --out-dir target/generated-bindings |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 214 | target/debug/{DLL_PREFIX}matrix_sdk_ffi{DLL_SUFFIX} |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 215 | " |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 216 | ) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 217 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 218 | cmd!( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 219 | sh, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 220 | " |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 221 | rustup run stable cargo run -p uniffi-bindgen -- generate |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 222 | --library |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 223 | --language kotlin |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 224 | --language swift |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 225 | --out-dir target/generated-bindings |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 226 | target/debug/{DLL_PREFIX}matrix_sdk_crypto_ffi{DLL_SUFFIX} |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 227 | " |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 228 | ) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 229 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 230 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 231 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 232 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 233 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 234 | fn check_examples() -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 235 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 236 | cmd!(sh, "rustup run stable cargo check -p example-*").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 237 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 238 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 239 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 240 | fn check_style() -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 241 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 242 | cmd!(sh, "rustup run {NIGHTLY} cargo fmt -- --check").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 243 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 244 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 245 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 246 | fn check_typos() -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 247 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 248 | // FIXME: Print install instructions if command-not-found (needs an xshell |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 249 | // change: https://github.com/matklad/xshell/issues/46) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 250 | cmd!(sh, "typos").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 251 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 252 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 253 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 254 | fn check_clippy() -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 255 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 256 | cmd!(sh, "rustup run {NIGHTLY} cargo clippy --all-targets --features testing -- -D warnings") |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 257 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 258 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 259 | cmd!( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 260 | sh, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 261 | "rustup run {NIGHTLY} cargo clippy --workspace --all-targets |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 262 | --exclude matrix-sdk-crypto --exclude xtask |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 263 | --no-default-features |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 264 | --features sso-login,sqlite,testing,experimental-element-recent-emojis |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 265 | -- -D warnings" |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 266 | ) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 267 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 268 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 269 | cmd!( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 270 | sh, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 271 | "rustup run {NIGHTLY} cargo clippy --all-targets -p matrix-sdk-crypto |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 272 | --no-default-features -- -D warnings" |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 273 | ) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 274 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 275 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 276 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 277 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 278 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 279 | fn check_docs() -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 280 | build_docs([], DenyWarnings::Yes) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 281 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 282 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 283 | fn run_feature_tests(cmd: Option<FeatureSet>) -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 284 | let args = BTreeMap::from([ |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 285 | (FeatureSet::NoEncryption, "--no-default-features --features sqlite,testing"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 286 | (FeatureSet::NoSqlite, "--no-default-features --features e2e-encryption,testing"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 287 | (FeatureSet::NoEncryptionAndSqlite, "--no-default-features --features testing"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 288 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 289 | FeatureSet::SqliteCryptostore, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 290 | "--no-default-features --features e2e-encryption,sqlite,testing", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 291 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 292 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 293 | FeatureSet::ExperimentalEncryptedStateEvents, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 294 | "--no-default-features --features experimental-encrypted-state-events,e2e-encryption,sqlite,testing", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 295 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 296 | (FeatureSet::Markdown, "--features markdown,testing"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 297 | (FeatureSet::Socks, "--features socks,testing"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 298 | (FeatureSet::SsoLogin, "--features sso-login,testing"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 299 | (FeatureSet::Search, "--features experimental-search"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 300 | (FeatureSet::ElementRecentEmojis, "--features experimental-element-recent-emojis"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 301 | ]); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 302 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 303 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 304 | let run = |arg_set: &str| { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 305 | cmd!(sh, "rustup run stable cargo nextest run -p matrix-sdk") |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 306 | .args(arg_set.split_whitespace()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 307 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 308 | cmd!(sh, "rustup run stable cargo test --doc -p matrix-sdk") |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 309 | .args(arg_set.split_whitespace()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 310 | .run() |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 311 | }; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 312 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 313 | match cmd { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 314 | Some(cmd) => { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 315 | run(args[&cmd])?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 316 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 317 | None => { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 318 | for &arg_set in args.values() { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 319 | run(arg_set)?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 320 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 321 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 322 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 323 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 324 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 325 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 326 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 327 | fn run_crypto_tests() -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 328 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 329 | cmd!(sh, "rustup run stable cargo clippy -p matrix-sdk-crypto -- -D warnings").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 330 | cmd!(sh, "rustup run stable cargo nextest run -p matrix-sdk-crypto --no-default-features --features testing").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 331 | cmd!(sh, "rustup run stable cargo nextest run -p matrix-sdk-crypto --features=testing") |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 332 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 333 | cmd!(sh, "rustup run stable cargo test --doc -p matrix-sdk-crypto --features=testing").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 334 | cmd!( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 335 | sh, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 336 | "rustup run stable cargo clippy -p matrix-sdk-crypto --features=experimental-algorithms -- -D warnings" |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 337 | ) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 338 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 339 | cmd!( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 340 | sh, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 341 | "rustup run stable cargo nextest run -p matrix-sdk-crypto --features=experimental-algorithms,testing" |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 342 | ).run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 343 | cmd!( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 344 | sh, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 345 | "rustup run stable cargo test --doc -p matrix-sdk-crypto --features=experimental-algorithms,testing" |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 346 | ) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 347 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 348 | cmd!(sh, "rustup run stable cargo nextest run -p matrix-sdk-crypto --features=experimental-encrypted-state-events").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 349 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 350 | cmd!(sh, "rustup run stable cargo nextest run -p matrix-sdk-crypto-ffi").run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 351 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 352 | cmd!( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 353 | sh, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 354 | "rustup run stable cargo nextest run -p matrix-sdk-sqlite --features crypto-store,testing" |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 355 | ) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 356 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 357 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 358 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 359 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 360 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 361 | fn run_wasm_checks(cmd: Option<WasmFeatureSet>) -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 362 | if let Some(WasmFeatureSet::Indexeddb) = cmd { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 363 | run_wasm_checks(Some(WasmFeatureSet::IndexeddbAllFeatures))?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 364 | run_wasm_checks(Some(WasmFeatureSet::IndexeddbCrypto))?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 365 | run_wasm_checks(Some(WasmFeatureSet::IndexeddbState))?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 366 | return Ok(()); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 367 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 368 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 369 | let args = BTreeMap::from([ |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 370 | (WasmFeatureSet::MatrixSdkQrcode, "-p matrix-sdk-qrcode --features js"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 371 | (WasmFeatureSet::MatrixSdkNoDefault, "-p matrix-sdk --no-default-features --features js"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 372 | (WasmFeatureSet::MatrixSdkBase, "-p matrix-sdk-base --features js,test-send-sync"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 373 | (WasmFeatureSet::MatrixSdkCommon, "-p matrix-sdk-common --features js"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 374 | (WasmFeatureSet::MatrixSdkUi, "-p matrix-sdk-ui --features js"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 375 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 376 | WasmFeatureSet::MatrixSdkIndexeddbStoresNoCrypto, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 377 | "-p matrix-sdk --no-default-features --features js,indexeddb", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 378 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 379 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 380 | WasmFeatureSet::MatrixSdkIndexeddbStores, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 381 | "-p matrix-sdk --no-default-features --features js,indexeddb,e2e-encryption", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 382 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 383 | (WasmFeatureSet::IndexeddbAllFeatures, "-p matrix-sdk-indexeddb"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 384 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 385 | WasmFeatureSet::IndexeddbCrypto, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 386 | "-p matrix-sdk-indexeddb --no-default-features --features e2e-encryption", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 387 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 388 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 389 | WasmFeatureSet::IndexeddbState, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 390 | "-p matrix-sdk-indexeddb --no-default-features --features state-store", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 391 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 392 | ]); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 393 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 394 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 395 | let run = |arg_set: &str| { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 396 | cmd!(sh, "rustup run stable cargo clippy --target wasm32-unknown-unknown") |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 397 | .args(arg_set.split_whitespace()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 398 | .args(["--", "-D", "warnings"]) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 399 | .env(WASM_TIMEOUT_ENV_KEY, WASM_TIMEOUT_VALUE) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 400 | .run() |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 401 | }; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 402 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 403 | match cmd { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 404 | Some(cmd) => { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 405 | run(args[&cmd])?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 406 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 407 | None => { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 408 | for &arg_set in args.values() { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 409 | run(arg_set)?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 410 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 411 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 412 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 413 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 414 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 415 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 416 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 417 | fn run_wasm_pack_tests(cmd: Option<WasmFeatureSet>, runner: WasmTestRunner) -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 418 | if let Some(WasmFeatureSet::Indexeddb) = cmd { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 419 | run_wasm_pack_tests(Some(WasmFeatureSet::IndexeddbAllFeatures), runner)?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 420 | run_wasm_pack_tests(Some(WasmFeatureSet::IndexeddbCrypto), runner)?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 421 | run_wasm_pack_tests(Some(WasmFeatureSet::IndexeddbState), runner)?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 422 | return Ok(()); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 423 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 424 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 425 | let args = BTreeMap::from([ |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 426 | (WasmFeatureSet::MatrixSdkQrcode, ("crates/matrix-sdk-qrcode", "--features js")), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 427 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 428 | WasmFeatureSet::MatrixSdkNoDefault, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 429 | ("crates/matrix-sdk", "--no-default-features --features js --lib"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 430 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 431 | (WasmFeatureSet::MatrixSdkBase, ("crates/matrix-sdk-base", "--features js")), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 432 | (WasmFeatureSet::MatrixSdkCommon, ("crates/matrix-sdk-common", "--features js")), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 433 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 434 | WasmFeatureSet::MatrixSdkIndexeddbStoresNoCrypto, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 435 | ("crates/matrix-sdk", "--no-default-features --features js,indexeddb --lib"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 436 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 437 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 438 | WasmFeatureSet::MatrixSdkIndexeddbStores, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 439 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 440 | "crates/matrix-sdk", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 441 | "--no-default-features --features js,indexeddb,e2e-encryption,testing --lib", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 442 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 443 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 444 | (WasmFeatureSet::IndexeddbAllFeatures, ("crates/matrix-sdk-indexeddb", "")), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 445 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 446 | WasmFeatureSet::IndexeddbCrypto, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 447 | ("crates/matrix-sdk-indexeddb", "--no-default-features --features e2e-encryption"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 448 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 449 | ( |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 450 | WasmFeatureSet::IndexeddbState, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 451 | ("crates/matrix-sdk-indexeddb", "--no-default-features --features state-store"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 452 | ), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 453 | ]); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 454 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 455 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 456 | let run = |runner: WasmTestRunner, (folder, arg_set): (&str, &str)| { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 457 | let _pwd = sh.push_dir(folder); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 458 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 459 | cmd!(sh, "pwd").run()?; // print dir so we know what might have failed |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 460 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 461 | if matches!(runner, WasmTestRunner::All | WasmTestRunner::Node) { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 462 | cmd!(sh, "wasm-pack test --node -- ") |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 463 | .args(arg_set.split_whitespace()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 464 | .env(WASM_TIMEOUT_ENV_KEY, WASM_TIMEOUT_VALUE) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 465 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 466 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 467 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 468 | if matches!(runner, WasmTestRunner::All | WasmTestRunner::Firefox) { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 469 | cmd!(sh, "wasm-pack test --firefox --headless --") |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 470 | .args(arg_set.split_whitespace()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 471 | .env(WASM_TIMEOUT_ENV_KEY, WASM_TIMEOUT_VALUE) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 472 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 473 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 474 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 475 | if matches!(runner, WasmTestRunner::All | WasmTestRunner::Chrome) { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 476 | cmd!(sh, "wasm-pack test --chrome --headless --") |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 477 | .args(arg_set.split_whitespace()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 478 | .env(WASM_TIMEOUT_ENV_KEY, WASM_TIMEOUT_VALUE) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 479 | .run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 480 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 481 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 482 | Ok::<_, xshell::Error>(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 483 | }; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 484 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 485 | match cmd { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 486 | Some(cmd) => { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 487 | run(runner, args[&cmd])?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 488 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 489 | None => { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 490 | for &arg_set in args.values() { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 491 | run(runner, arg_set)?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 492 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 493 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 494 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 495 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 496 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 497 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 498 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 499 | fn run_coverage(output_format: CoverageOutputFormat) -> Result<()> { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 500 | let sh = sh(); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 501 | let cmd = cmd!(sh, "rustup run stable cargo llvm-cov nextest"); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 502 | let cmd = cmd.args([ |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 503 | "--workspace", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 504 | "--exclude", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 505 | "matrix-sdk-indexeddb", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 506 | "--ignore-filename-regex", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 507 | "testing/*|bindings/*|uniffi-bindgen|labs/*", |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 508 | ]); |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 509 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 510 | let cmd = match output_format { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 511 | CoverageOutputFormat::Text => cmd, |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 512 | CoverageOutputFormat::Html => cmd.arg("--html"), |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 513 | CoverageOutputFormat::Codecov => { |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 514 | cmd.args(["--codecov", "--output-path", "coverage.xml", "--profile", "ci"]) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 515 | } |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 516 | }; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 517 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 518 | cmd.run()?; |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 519 | |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 520 | Ok(()) |
7ff8adafe9e4 | atagen | 2026-10-22 12:30 UTC | 521 | } |