mirror of
https://github.com/trailbaseio/trailbase.git
synced 2025-12-20 08:59:44 -06:00
Update Rust toolchain to latest stable: 1.89.0.
This commit is contained in:
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -44,16 +44,18 @@ jobs:
|
||||
pnpm i
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.86.0
|
||||
toolchain: 1.89.0
|
||||
target: x86_64-unknown-linux-gnu
|
||||
default: true
|
||||
- name: Rust Build
|
||||
# NOTE: static linux builds fail with toolchains >1.86 if run from workspace root?!
|
||||
run: |
|
||||
pnpm install && \
|
||||
RUSTFLAGS="-C target-feature=+crt-static" \
|
||||
CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 \
|
||||
cd crates/cli && \
|
||||
RUSTFLAGS="-C target-feature=+crt-static" CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 \
|
||||
cargo build --target x86_64-unknown-linux-gnu --release --bin trail && \
|
||||
zip -r -j trailbase_${{ github.ref_name }}_x86_64_linux.zip target/x86_64-unknown-linux-gnu/release/trail CHANGELOG.md LICENSE
|
||||
cd ../.. && \
|
||||
zip -r -j trailbase_${{ github.ref_name }}_x86_64_linux.zip target/x86_64-unknown-linux-gnu/release/trail CHANGELOG.md LICENSE
|
||||
|
||||
- name: Release binaries
|
||||
uses: softprops/action-gh-release@v2
|
||||
@@ -80,7 +82,7 @@ jobs:
|
||||
pnpm i
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.86.0
|
||||
toolchain: 1.89.0
|
||||
target: aarch64-apple-darwin
|
||||
default: true
|
||||
- name: Rust Build
|
||||
@@ -115,7 +117,7 @@ jobs:
|
||||
pnpm i
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.86.0
|
||||
toolchain: 1.89.0
|
||||
target: x86_64-apple-darwin
|
||||
default: true
|
||||
- name: Rust Build
|
||||
@@ -144,7 +146,7 @@ jobs:
|
||||
apps: nodejs pnpm protobuf zip
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.86.0
|
||||
toolchain: 1.89.0
|
||||
target: x86_64-pc-windows-msvc
|
||||
default: true
|
||||
- name: Rust Build
|
||||
|
||||
@@ -60,8 +60,8 @@ opt-level = 1
|
||||
askama = { version = "0.14.0", default-features = false, features = ["derive", "std", "config"] }
|
||||
axum = { version = "^0.8.1", features = ["multipart"] }
|
||||
env_logger = { version = "^0.11.8", default-features = false, features = ["auto-color", "humantime"] }
|
||||
libsqlite3-sys = { version = "0.35.0", features = ["bundled"] }
|
||||
rusqlite = { version = "0.37.0", default-features = false, features = ["bundled", "column_decltype", "load_extension", "modern_sqlite", "functions", "limits", "backup", "hooks", "preupdate_hook"] }
|
||||
libsqlite3-sys = { version = "0.35.0", default-features = false, features = ["bundled", "preupdate_hook"] }
|
||||
rusqlite = { version = "0.37.0", default-features = false, features = ["bundled", "column_decltype", "functions", "backup", "preupdate_hook"] }
|
||||
rust-embed = { version = "8.4.0", default-features = false, features = ["mime-guess"] }
|
||||
tokio = { version = "^1.38.0", features = ["macros", "rt-multi-thread", "fs", "signal", "time", "sync"] }
|
||||
tracing = { version = "0.1.40", default-features = false }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM lukemathwalker/cargo-chef:latest-rust-1.86-slim AS chef
|
||||
FROM lukemathwalker/cargo-chef:latest-rust-1.89-slim AS chef
|
||||
|
||||
# Install additional build dependencies. git is needed to bake version metadata.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
@@ -148,7 +148,7 @@ async fn async_main() -> Result<(), BoxError> {
|
||||
Some(SubCommands::Admin { cmd }) => {
|
||||
init_logger(false);
|
||||
|
||||
let (conn, _) = api::init_main_db(Some(&data_dir), None, None)?;
|
||||
let (conn, _) = api::init_main_db(Some(&data_dir), None)?;
|
||||
|
||||
match cmd {
|
||||
Some(AdminSubCommands::List) => {
|
||||
@@ -187,7 +187,7 @@ async fn async_main() -> Result<(), BoxError> {
|
||||
init_logger(false);
|
||||
|
||||
let data_dir = DataDir(args.data_dir);
|
||||
let (conn, _) = api::init_main_db(Some(&data_dir), None, None)?;
|
||||
let (conn, _) = api::init_main_db(Some(&data_dir), None)?;
|
||||
|
||||
match cmd {
|
||||
Some(UserSubCommands::ChangePassword { user, password }) => {
|
||||
|
||||
@@ -25,7 +25,7 @@ default = ["v8"]
|
||||
v8 = ["dep:trailbase-js"]
|
||||
|
||||
[dependencies]
|
||||
aes-gcm = { version = "0.10.3", default-features = false, features = ["aes", "rand_core"] }
|
||||
aes-gcm = { version = "0.10.3", default-features = false, features = ["aes", "alloc", "getrandom", "rand_core"] }
|
||||
argon2 = { version = "^0.5.3", default-features = false, features = ["alloc", "password-hash"] }
|
||||
askama = { workspace = true }
|
||||
async-channel = "2.3.1"
|
||||
|
||||
@@ -337,7 +337,7 @@ pub async fn test_state(options: Option<TestStateOptions>) -> anyhow::Result<App
|
||||
let temp_dir = temp_dir::TempDir::new()?;
|
||||
tokio::fs::create_dir_all(temp_dir.child("uploads")).await?;
|
||||
|
||||
let (conn, new) = crate::connection::init_main_db(None, None, None)?;
|
||||
let (conn, new) = crate::connection::init_main_db(None, None)?;
|
||||
assert!(new);
|
||||
let logs_conn = crate::connection::init_logs_db(None)?;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ pub enum ConnectionError {
|
||||
/// Returns a Connection and whether the DB was newly created..
|
||||
pub fn init_main_db(
|
||||
data_dir: Option<&DataDir>,
|
||||
extensions: Option<Vec<PathBuf>>,
|
||||
attach: Option<Vec<(String, PathBuf)>>,
|
||||
) -> Result<(Connection, bool), ConnectionError> {
|
||||
let new_db = Mutex::new(false);
|
||||
@@ -38,7 +37,7 @@ pub fn init_main_db(
|
||||
|| -> Result<_, ConnectionError> {
|
||||
trailbase_schema::registry::try_init_schemas();
|
||||
|
||||
let mut conn = trailbase_extension::connect_sqlite(main_path.clone(), extensions.clone())?;
|
||||
let mut conn = trailbase_extension::connect_sqlite(main_path.clone())?;
|
||||
|
||||
*(new_db.lock()) |= apply_main_migrations(&mut conn, migrations_path.clone())?;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ pub async fn init_app_state(args: InitArgs) -> Result<(bool, AppState), InitErro
|
||||
.collect();
|
||||
|
||||
let (conn, new_db) =
|
||||
crate::connection::init_main_db(Some(&args.data_dir), None, Some(extra_databases))?;
|
||||
crate::connection::init_main_db(Some(&args.data_dir), Some(extra_databases))?;
|
||||
|
||||
let schema_metadata = SchemaMetadataCache::new(&conn).await?;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ regex = "1.11.0"
|
||||
rusqlite = { workspace = true }
|
||||
serde = { version = "^1.0.203", features = ["derive"] }
|
||||
serde_json = "1.0.121"
|
||||
sqlite-vec = "0.1.6"
|
||||
sqlite-vec = { version = "0.1.6", default-features = false }
|
||||
thiserror = "2.0.12"
|
||||
trailbase-sqlean = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
|
||||
@@ -163,7 +163,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_explicit_jsonschema() {
|
||||
let ip = "89.160.20.112";
|
||||
let conn = crate::connect_sqlite(None, None).unwrap();
|
||||
let conn = crate::connect_sqlite(None).unwrap();
|
||||
|
||||
let cc: Option<String> = conn
|
||||
.query_row(&format!("SELECT geoip_country('{ip}')"), (), |row| {
|
||||
|
||||
@@ -178,7 +178,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_explicit_jsonschema() {
|
||||
let conn = crate::connect_sqlite(None, None).unwrap();
|
||||
let conn = crate::connect_sqlite(None).unwrap();
|
||||
|
||||
let text0_schema = r#"
|
||||
{
|
||||
@@ -226,7 +226,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_registerd_jsonschema() {
|
||||
let conn = crate::connect_sqlite(None, None).unwrap();
|
||||
let conn = crate::connect_sqlite(None).unwrap();
|
||||
|
||||
let text0_schema = r#"
|
||||
{
|
||||
|
||||
@@ -42,10 +42,7 @@ pub fn apply_default_pragmas(conn: &rusqlite::Connection) -> Result<(), rusqlite
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub fn connect_sqlite(
|
||||
path: Option<PathBuf>,
|
||||
extensions: Option<Vec<PathBuf>>,
|
||||
) -> Result<rusqlite::Connection, Error> {
|
||||
pub fn connect_sqlite(path: Option<PathBuf>) -> Result<rusqlite::Connection, Error> {
|
||||
// First load C extensions like sqlean and vector search.
|
||||
let status =
|
||||
unsafe { rusqlite::ffi::sqlite3_auto_extension(Some(init_sqlean_and_vector_search)) };
|
||||
@@ -65,13 +62,6 @@ pub fn connect_sqlite(
|
||||
rusqlite::Connection::open_in_memory()?
|
||||
})?;
|
||||
|
||||
// Load user-provided extensions.
|
||||
if let Some(extensions) = extensions {
|
||||
for path in extensions {
|
||||
unsafe { conn.load_extension::<_, &str>(path, None)? }
|
||||
}
|
||||
}
|
||||
|
||||
apply_default_pragmas(&conn)?;
|
||||
|
||||
// Initial optimize.
|
||||
@@ -247,7 +237,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_connect_and_extensions() {
|
||||
let conn = connect_sqlite(None, None).unwrap();
|
||||
let conn = connect_sqlite(None).unwrap();
|
||||
|
||||
let row = conn
|
||||
.query_row("SELECT (uuid_v7())", (), |row| -> Result<[u8; 16], Error> {
|
||||
@@ -282,7 +272,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_uuids() {
|
||||
let conn = connect_sqlite(None, None).unwrap();
|
||||
let conn = connect_sqlite(None).unwrap();
|
||||
|
||||
conn
|
||||
.execute(
|
||||
|
||||
@@ -63,7 +63,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_regexp() {
|
||||
let conn = crate::connect_sqlite(None, None).unwrap();
|
||||
let conn = crate::connect_sqlite(None).unwrap();
|
||||
let create_table = "CREATE TABLE test (text0 TEXT, text1 TEXT) STRICT";
|
||||
conn.execute(create_table, ()).unwrap();
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_uuid() {
|
||||
let conn = crate::connect_sqlite(None, None).unwrap();
|
||||
let conn = crate::connect_sqlite(None).unwrap();
|
||||
|
||||
let create_table = r#"
|
||||
CREATE TABLE test (
|
||||
|
||||
@@ -32,7 +32,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_is_email() {
|
||||
let conn = crate::connect_sqlite(None, None).unwrap();
|
||||
let conn = crate::connect_sqlite(None).unwrap();
|
||||
let create_table = r#"
|
||||
CREATE TABLE test (
|
||||
email TEXT CHECK(is_email(email))
|
||||
@@ -57,7 +57,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_is_json() {
|
||||
let conn = crate::connect_sqlite(None, None).unwrap();
|
||||
let conn = crate::connect_sqlite(None).unwrap();
|
||||
let create_table = r#"
|
||||
CREATE TABLE test (
|
||||
json TEXT CHECK(is_json(json))
|
||||
|
||||
@@ -105,6 +105,7 @@ pub fn flat_json_to_value(
|
||||
|
||||
// NOTE: It's not quite as tricial. serde_json will behave differently whether
|
||||
// its "arbitrary_precision" feature is enabled or not.
|
||||
#[cfg(debug_assertions)]
|
||||
panic!("we exhaustively checked for int, uint and float");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ mod tests {
|
||||
async fn test_parse_table_schema() {
|
||||
crate::registry::try_init_schemas();
|
||||
|
||||
let conn = trailbase_extension::connect_sqlite(None, None).unwrap();
|
||||
let conn = trailbase_extension::connect_sqlite(None).unwrap();
|
||||
|
||||
let check = indoc::indoc! {r#"
|
||||
jsonschema_matches ('{
|
||||
|
||||
@@ -1650,7 +1650,7 @@ mod tests {
|
||||
|
||||
{
|
||||
// First Make sure the query is actually valid, as opposed to "only" parsable.
|
||||
let conn = trailbase_extension::connect_sqlite(None, None).unwrap();
|
||||
let conn = trailbase_extension::connect_sqlite(None).unwrap();
|
||||
conn.execute(&statement, ()).unwrap();
|
||||
}
|
||||
|
||||
@@ -1660,7 +1660,7 @@ mod tests {
|
||||
let sql = table1.create_table_statement();
|
||||
{
|
||||
// Same as above, make sure the constructed query is valid as opposed to "only" parsable.
|
||||
let conn = trailbase_extension::connect_sqlite(None, None).unwrap();
|
||||
let conn = trailbase_extension::connect_sqlite(None).unwrap();
|
||||
conn.execute(&sql, ()).unwrap();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use trailbase_sqlite::Connection;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let conn = Connection::new(|| connect_sqlite(None, None), None).expect("in memory connection");
|
||||
let conn = Connection::new(|| connect_sqlite(None), None).expect("in memory connection");
|
||||
|
||||
let uuid: Option<String> = conn
|
||||
.read_query_value("SELECT (uuid_text(uuid_v7()))", ())
|
||||
|
||||
Reference in New Issue
Block a user