From c4c53bddd16308a383c9499c77107b6f87e0c7d4 Mon Sep 17 00:00:00 2001 From: Conchez-Boueytou Robin Date: Mon, 30 Mar 2026 19:43:08 +0200 Subject: [PATCH 1/3] :fire: suppression de fichier inutile --- backend/junit-report.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 backend/junit-report.xml diff --git a/backend/junit-report.xml b/backend/junit-report.xml deleted file mode 100644 index e69de29b..00000000 From 688b83b40375dc820bf68eede757e63dac67c254 Mon Sep 17 00:00:00 2001 From: Conchez-Boueytou Robin Date: Mon, 30 Mar 2026 19:44:31 +0200 Subject: [PATCH 2/3] =?UTF-8?q?:heavy=5Fminus=5Fsign:=20=20suppression=20d?= =?UTF-8?q?e=20d=C3=A9pandences=20inutile=20et=20optimisation=20de=20la=20?= =?UTF-8?q?configuration=20cargo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/Cargo.lock | 185 -------------------------------------------- backend/Cargo.toml | 16 +++- backend/src/main.rs | 1 + 3 files changed, 14 insertions(+), 188 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 5637f054..dee0423e 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -306,22 +306,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "cpufeatures" version = "0.2.17" @@ -463,16 +447,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - [[package]] name = "etcetera" version = "0.8.0" @@ -495,12 +469,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - [[package]] name = "find-msvc-tools" version = "0.1.6" @@ -540,21 +508,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.2" @@ -1107,12 +1060,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linux-raw-sys" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" - [[package]] name = "litemap" version = "0.8.1" @@ -1198,23 +1145,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nom" version = "7.1.3" @@ -1283,50 +1213,6 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" -[[package]] -name = "openssl" -version = "0.10.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-sys" -version = "0.9.111" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "parking" version = "2.2.1" @@ -1671,19 +1557,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustix" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.61.2", -] - [[package]] name = "rustls" version = "0.23.37" @@ -1724,44 +1597,12 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" -[[package]] -name = "schannel" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" -dependencies = [ - "windows-sys 0.61.2", -] - [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.27" @@ -1871,16 +1712,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - [[package]] name = "signature" version = "2.2.0" @@ -1975,7 +1806,6 @@ dependencies = [ "indexmap", "log", "memchr", - "native-tls", "once_cell", "percent-encoding", "rustls", @@ -2183,19 +2013,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tempfile" -version = "3.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" -dependencies = [ - "fastrand", - "getrandom 0.3.4", - "once_cell", - "rustix", - "windows-sys 0.61.2", -] - [[package]] name = "thiserror" version = "2.0.17" @@ -2290,9 +2107,7 @@ dependencies = [ "bytes", "libc", "mio", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "tracing", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 7ced070b..9708da68 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -3,12 +3,16 @@ name = "backend" version = "0.1.0" edition = "2024" +[features] +default = [] +tokio-console = ["dep:console-subscriber"] + [dependencies] -tokio = { version = "1", features = ["full"] } +tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "time"] } axum = "0.8.7" serde_json = "1.0" tower-sessions = "0.15.0" -sqlx = { version = "0.8.6", features = ["runtime-tokio-native-tls", "runtime-tokio-rustls", "macros", "mysql", "sqlite"] } +sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "macros", "mysql", "sqlite"] } async-trait = "0.1.89" dotenvy = "0.15.7" time = "0.3.44" @@ -16,4 +20,10 @@ bcrypt = "0.19.0" tower-http = { version = "0.6.6", features = ["cors", "trace"] } serde = { version = "1.0.228", features = ["derive"] } rand = "0.10.0" -console-subscriber = "0.5.0" \ No newline at end of file +console-subscriber = { version = "0.5.0", optional = true } + +[profile.release] +lto = "thin" +codegen-units = 1 +panic = "abort" +strip = "symbols" diff --git a/backend/src/main.rs b/backend/src/main.rs index fa8fd312..3b42baa2 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -13,6 +13,7 @@ use tower_http::trace::TraceLayer; async fn main() { dotenvy::dotenv().ok(); + #[cfg(feature = "tokio-console")] console_subscriber::init(); let backend_url = env::var("BACKEND_URL").unwrap_or("localhost:3000".to_string()); From 2365d3e418c44535387b2788353d5b8eaca881dd Mon Sep 17 00:00:00 2001 From: Conchez-Boueytou Robin Date: Mon, 30 Mar 2026 19:45:23 +0200 Subject: [PATCH 3/3] :construction_worker: optimisation du worflow de la cd --- .github/workflows/deploy.yml | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9a07dcab..08880ec3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,6 +3,13 @@ name: Deploy to AlwaysData on: workflow_dispatch: +permissions: + contents: read + +concurrency: + group: deploy-alwaysdata-${{ github.ref }} + cancel-in-progress: false + jobs: build-and-deploy: runs-on: ubuntu-latest @@ -13,8 +20,9 @@ jobs: - name: Build Rust (Release) working-directory: ./backend run: | + set -euo pipefail cargo build --release - cp target/release/backend ../backend + strip target/release/backend env: SQLX_OFFLINE: true @@ -22,21 +30,22 @@ jobs: - name: Install & Build Svelte working-directory: ./frontend run: | - npm install + set -euo pipefail + npm ci npm run build tar -czf ../frontend_deploy.tar.gz build/ package.json package-lock.json # --- DÉPLOIEMENT --- - name: Prepare artifacts for deployment run: | + set -euo pipefail mkdir -p deploy_folder/frontend mkdir -p deploy_folder/backend - cp frontend_deploy.tar.gz deploy_folder/frontend/ cp backend/target/release/backend deploy_folder/backend/backend_binary - name: Deploy to AlwaysData via SSH - uses: easingthemes/ssh-deploy@main + uses: easingthemes/ssh-deploy@v5.1.0 with: SSH_PRIVATE_KEY: ${{ secrets.ALWAYS_SSH_KEY }} REMOTE_HOST: "ssh-greenscore.alwaysdata.net" @@ -47,27 +56,27 @@ jobs: # --- REDÉMARRAGE --- - name: Restart Services - uses: appleboy/ssh-action@master + uses: appleboy/ssh-action@v1.2.2 with: host: "ssh-greenscore.alwaysdata.net" username: "greenscore" key: ${{ secrets.ALWAYS_SSH_KEY }} script: | + set -euo pipefail APP_DIR="/home/greenscore/www/app" # 1. Gestion du FRONTEND # Remove old build files - rm -rf $APP_DIR/frontend/build - rm -rf $APP_DIR/frontend/node_modules + rm -rf "$APP_DIR/frontend/build" - cd $APP_DIR/frontend/ + cd "$APP_DIR/frontend/" tar -xzf frontend_deploy.tar.gz - npm install --omit=dev + npm ci --omit=dev rm frontend_deploy.tar.gz # 2. Gestion du BACKEND - chmod +x $APP_DIR/backend/backend_binary + chmod +x "$APP_DIR/backend/backend_binary" # 3. Restart les serveurs - curl -X POST --basic --user "${{ secrets.ALWAYSDATA_TOKEN }} account=greenscore:" https://api.alwaysdata.com/v1/site/1007299/restart/ - curl -X POST --basic --user "${{ secrets.ALWAYSDATA_TOKEN }} account=greenscore:" https://api.alwaysdata.com/v1/service/19361/restart/ \ No newline at end of file + curl --fail --silent --show-error -X POST --basic --user "${{ secrets.ALWAYSDATA_TOKEN }} account=greenscore:" https://api.alwaysdata.com/v1/site/1007299/restart/ + curl --fail --silent --show-error -X POST --basic --user "${{ secrets.ALWAYSDATA_TOKEN }} account=greenscore:" https://api.alwaysdata.com/v1/service/19361/restart/