Compare commits
9 Commits
release-20
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e39cbb0c5 | ||
|
|
40be58f2fc | ||
|
|
3f08b5b54a | ||
|
|
bfec99ae35 | ||
|
|
d9afd3aa81 | ||
|
|
e72113d91d | ||
|
|
7c4ff619c1 | ||
|
|
9c4217f450 | ||
|
|
cc09002171 |
@@ -29,16 +29,27 @@ jobs:
|
|||||||
# Run Tailwind manually first
|
# Run Tailwind manually first
|
||||||
npx @tailwindcss/cli -i input.css -o public/tailwind.css
|
npx @tailwindcss/cli -i input.css -o public/tailwind.css
|
||||||
trunk build --release
|
trunk build --release
|
||||||
|
|
||||||
|
# Manuel WASM Optimizasyonu
|
||||||
|
WASM_FILE=$(ls dist/*.wasm | head -n 1)
|
||||||
|
BEFORE=$(du -h "$WASM_FILE" | cut -f1)
|
||||||
|
echo "Before optimization: $BEFORE"
|
||||||
|
|
||||||
|
wasm-opt --all-features -Oz "$WASM_FILE" -o "$WASM_FILE"
|
||||||
|
|
||||||
|
AFTER=$(du -h "$WASM_FILE" | cut -f1)
|
||||||
|
echo "After optimization: $AFTER"
|
||||||
|
echo "Optimization complete!"
|
||||||
|
|
||||||
- name: Build Backend (MIPS)
|
- name: Build Backend (MIPS)
|
||||||
env:
|
env:
|
||||||
# Ensure we are building a fully static binary
|
# -s: Sembolleri siler, -w: DWARF debug bilgilerini siler (Binary boyutunu devasa düşürür)
|
||||||
# -C link-self-contained=no: Let Zig (the linker) handle CRT objects (crt1.o, etc.)
|
RUSTFLAGS: "-C target-feature=+crt-static -C link-self-contained=no -C link-arg=-msoft-float -C link-arg=-s -C link-arg=-w"
|
||||||
RUSTFLAGS: "-C target-feature=+crt-static -C link-self-contained=no -C link-arg=-msoft-float"
|
|
||||||
CFLAGS_mips_unknown_linux_musl: "-msoft-float"
|
CFLAGS_mips_unknown_linux_musl: "-msoft-float"
|
||||||
run: |
|
run: |
|
||||||
cd backend
|
# Kök dizinden derleyerek workspace profil ayarlarının (LTO, z, strip) uygulanmasını sağlıyoruz
|
||||||
cargo zigbuild --target mips-unknown-linux-musl --release -Z build-std=std,panic_abort
|
# Sadece push-notifications özelliğini aktif ediyoruz (swagger UI kapanır, boyut düşer)
|
||||||
|
cargo zigbuild -p backend --target mips-unknown-linux-musl --release -Z build-std=std,panic_abort --no-default-features --features push-notifications
|
||||||
file target/mips-unknown-linux-musl/release/backend
|
file target/mips-unknown-linux-musl/release/backend
|
||||||
|
|
||||||
- name: Rename Binary
|
- name: Rename Binary
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ resolver = "2"
|
|||||||
# Optimize for size (aggressive)
|
# Optimize for size (aggressive)
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
lto = true
|
lto = "fat" # Full LTO (En iyisi)
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
strip = true
|
strip = "symbols" # Sembolleri temizle
|
||||||
|
incremental = false # Incremental build'i kapat (Boyut için daha iyi)
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
coarsetime = { path = "third_party/coarsetime" }
|
coarsetime = { path = "third_party/coarsetime" }
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[features]
|
[features]
|
||||||
default = ["push-notifications"]
|
default = ["push-notifications"]
|
||||||
push-notifications = ["web-push", "openssl"]
|
push-notifications = ["web-push", "openssl"]
|
||||||
|
swagger = ["utoipa-swagger-ui"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = { version = "0.8", features = ["macros", "ws"] }
|
axum = { version = "0.8", features = ["macros", "ws"] }
|
||||||
@@ -29,7 +30,7 @@ shared = { path = "../shared" }
|
|||||||
thiserror = "2.0.18"
|
thiserror = "2.0.18"
|
||||||
dotenvy = "0.15.7"
|
dotenvy = "0.15.7"
|
||||||
utoipa = { version = "5.4.0", features = ["axum_extras"] }
|
utoipa = { version = "5.4.0", features = ["axum_extras"] }
|
||||||
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"], optional = true }
|
||||||
web-push = { version = "0.10", default-features = false, features = ["hyper-client"], optional = true }
|
web-push = { version = "0.10", default-features = false, features = ["hyper-client"], optional = true }
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
openssl = { version = "0.10", features = ["vendored"], optional = true }
|
openssl = { version = "0.10", features = ["vendored"], optional = true }
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ use tower_http::{
|
|||||||
trace::TraceLayer,
|
trace::TraceLayer,
|
||||||
};
|
};
|
||||||
use utoipa::OpenApi;
|
use utoipa::OpenApi;
|
||||||
|
#[cfg(feature = "swagger")]
|
||||||
use utoipa_swagger_ui::SwaggerUi;
|
use utoipa_swagger_ui::SwaggerUi;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@@ -98,6 +99,7 @@ struct Args {
|
|||||||
reset_password: Option<String>,
|
reset_password: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "swagger")]
|
||||||
#[cfg(feature = "push-notifications")]
|
#[cfg(feature = "push-notifications")]
|
||||||
#[derive(OpenApi)]
|
#[derive(OpenApi)]
|
||||||
#[openapi(
|
#[openapi(
|
||||||
@@ -146,6 +148,7 @@ struct Args {
|
|||||||
)]
|
)]
|
||||||
struct ApiDoc;
|
struct ApiDoc;
|
||||||
|
|
||||||
|
#[cfg(feature = "swagger")]
|
||||||
#[cfg(not(feature = "push-notifications"))]
|
#[cfg(not(feature = "push-notifications"))]
|
||||||
#[derive(OpenApi)]
|
#[derive(OpenApi)]
|
||||||
#[openapi(
|
#[openapi(
|
||||||
@@ -462,9 +465,13 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let app = Router::new()
|
let app = Router::new();
|
||||||
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi()))
|
|
||||||
// Setup & Auth Routes
|
#[cfg(feature = "swagger")]
|
||||||
|
let app = app.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi()));
|
||||||
|
|
||||||
|
// Setup & Auth Routes
|
||||||
|
let app = app
|
||||||
.route("/api/setup/status", get(handlers::setup::get_setup_status_handler))
|
.route("/api/setup/status", get(handlers::setup::get_setup_status_handler))
|
||||||
.route("/api/setup", post(handlers::setup::setup_handler))
|
.route("/api/setup", post(handlers::setup::setup_handler))
|
||||||
.route(
|
.route(
|
||||||
@@ -516,9 +523,9 @@ async fn main() {
|
|||||||
.layer(TraceLayer::new_for_http())
|
.layer(TraceLayer::new_for_http())
|
||||||
.layer(
|
.layer(
|
||||||
CompressionLayer::new()
|
CompressionLayer::new()
|
||||||
.br(true)
|
.br(false)
|
||||||
.gzip(true)
|
.gzip(true)
|
||||||
.quality(CompressionLevel::Best),
|
.quality(CompressionLevel::Fastest),
|
||||||
)
|
)
|
||||||
.layer(
|
.layer(
|
||||||
ServiceBuilder::new()
|
ServiceBuilder::new()
|
||||||
|
|||||||
@@ -51,16 +51,4 @@ web-sys = { version = "0.3", features = [
|
|||||||
] }
|
] }
|
||||||
shared = { path = "../shared" }
|
shared = { path = "../shared" }
|
||||||
tailwind_fuse = "0.3.2"
|
tailwind_fuse = "0.3.2"
|
||||||
js-sys = "0.3.85"
|
js-sys = "0.3.85"
|
||||||
|
|
||||||
[profile.release]
|
|
||||||
# En yüksek seviyede boyut optimizasyonu
|
|
||||||
opt-level = "z"
|
|
||||||
# Tüm kütüphaneler arasında link-time optimizasyonu yapar (Çok etkilidir)
|
|
||||||
lto = true
|
|
||||||
# Kod üretim birimini 1'e düşürerek daha iyi optimizasyon sağlar
|
|
||||||
codegen-units = 1
|
|
||||||
# Hata durumunda stack unwinding yerine doğrudan durur (Kod boyutunu düşürür)
|
|
||||||
panic = "abort"
|
|
||||||
# Sembolleri ve debug bilgilerini siler
|
|
||||||
strip = true
|
|
||||||
Reference in New Issue
Block a user