From 6feacaefffb09c8b9e1420c3691b43386ad58a0b Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 09:40:05 +0300 Subject: [PATCH 01/15] Add support for configuring how to obtain TLS certificates using an ACME client. --- Cargo.toml | 2 + index.d.ts | 7 ++++ server.ts | 10 +++++ src/server/mod.rs | 93 +++++++++++++++++++++++++++++++++++++---------- 4 files changed, 93 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2f6643b..5e3a800 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,10 +31,12 @@ mime_guess = "2.0.5" napi-derive = "3.0.0" percent-encoding = "2.3.2" regex = "1.12.3" +rustls-acme = { version = "0.15.1", features = ["tokio"] } serde_json = "1.0.148" serde_qs = "1.0.0" serde_urlencoded = "0.7.1" tempfile = "3.24.0" +tokio-stream = { version = "0.1.18", features = ["net"] } urlencoding = "2.1.3" [dependencies.cookie] diff --git a/index.d.ts b/index.d.ts index a615d4a..e8c83ad 100644 --- a/index.d.ts +++ b/index.d.ts @@ -770,6 +770,7 @@ export declare class Server { post(route: string, handler: JsHandlerFn): void put(route: string, handler: JsHandlerFn): void use(route: string | undefined | null, middleware: JsHandlerFn): void + acmeConfigMeta(config: AcmeConfigMeta): void listen(addr: string): void } @@ -945,6 +946,12 @@ export declare class Version { static http3(): Version } +export interface AcmeConfigMeta { + domains: Array + contactEmail: string + cacheDir: string +} + export interface ClearCookie { } diff --git a/server.ts b/server.ts index 814d72c..2f4cf0d 100644 --- a/server.ts +++ b/server.ts @@ -23,6 +23,16 @@ const __dirname = process.cwd() // Create app with router const app = new Server() +// ============================================================================ +// LETSENCRYPT: How to configure +// ============================================================================ + +// app.acmeConfigMeta({ +// domains: ['"example.com'], +// contactEmail: 'admin@foo.com', +// cacheDir: '/home/tomn/.local..', +// }) + // ============================================================================ // ROUTE DEFINITIONS // ============================================================================ diff --git a/src/server/mod.rs b/src/server/mod.rs index 70cacde..5d64e82 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -2,6 +2,7 @@ mod get_next_id; mod handle_http_request; use env_logger::Builder as EnvLoggerBuilder; +use futures::prelude::*; use hyper::Method as LibMethod; use hyper::{server::conn::http1, service::service_fn}; use hyper_util::rt::tokio::{TokioIo, TokioTimer}; @@ -10,8 +11,11 @@ use matchit::{InsertError, Router}; use napi::bindgen_prelude::*; use napi::threadsafe_function::{ThreadsafeCallContext, ThreadsafeFunction}; use napi_derive::napi; +use rustls_acme::AcmeConfig; +use rustls_acme::caches::DirCache; use std::sync::Arc; use tokio::net::TcpListener; +use tokio_stream::wrappers::TcpListenerStream; use crate::request::Request; use crate::response::Response; @@ -59,11 +63,20 @@ pub struct MiddlewareMeta { method: Option, } +#[napi(object)] +#[derive(Debug, Clone)] +pub struct AcmeConfigMeta { + pub domains: Vec, + pub contact_email: String, + pub cache_dir: String, +} + /// HTTP Server that integrates with JavaScript handlers via Router #[napi] pub struct Server { middlewares: Vec, router: Router, + acme_config_meta: Option, } impl Server { @@ -116,6 +129,7 @@ impl Server { Ok(Self { middlewares: Vec::new(), router: Router::new(), + acme_config_meta: None, }) } @@ -144,10 +158,16 @@ impl Server { self.register_middleware(route, middleware, env) } + #[napi] + pub fn acme_config_meta(&mut self, config: AcmeConfigMeta) { + self.acme_config_meta = Some(config) + } + #[napi] pub fn listen(&self, addr: String) -> Result<()> { let router = Arc::new(self.router.clone()); let middlewares = Arc::new(self.middlewares.clone()); + let acme_config_meta = self.acme_config_meta.clone(); EnvLoggerBuilder::new() .filter_level(LevelFilter::max()) @@ -156,27 +176,62 @@ impl Server { std::thread::spawn(move || { let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async move { - let listener = TcpListener::bind(&addr).await.unwrap(); + let tcp_listener = TcpListener::bind(&addr).await.unwrap(); log::debug!("Server listening on {}", addr); - loop { - let (socket, _) = listener.accept().await.unwrap(); - let io = TokioIo::new(socket); - - let router = router.clone(); - let middlewares = middlewares.clone(); - - tokio::task::spawn(async move { - let _ = http1::Builder::new() - .timer(TokioTimer::new()) - .serve_connection( - io, - service_fn(move |req| { - handle_http_request(req, router.clone(), middlewares.clone()) - }), - ) - .await; - }); + match acme_config_meta { + Some(acme) => { + let tcp_stream = TcpListenerStream::new(tcp_listener); + + let mut tls_incoming = AcmeConfig::new(acme.domains) + .contact_push(format!("mailto:{}", acme.contact_email)) + .cache(DirCache::new(acme.cache_dir)) + .tokio_incoming(tcp_stream, Vec::new()); + + while let Some(tls) = tls_incoming.next().await { + let tls = match tls { + Ok(t) => t, + Err(e) => { + log::error!("TLS accept error: {}", e); + continue; + } + }; + + let io = TokioIo::new(tls); + let router = router.clone(); + let middlewares = middlewares.clone(); + + tokio::task::spawn(async move { + let _ = http1::Builder::new() + .timer(TokioTimer::new()) + .serve_connection( + io, + service_fn(move |req| { + handle_http_request(req, router.clone(), middlewares.clone()) + }), + ) + .await; + }); + } + } + None => loop { + let (socket, _) = tcp_listener.accept().await.unwrap(); + let io = TokioIo::new(socket); + let router = router.clone(); + let middlewares = middlewares.clone(); + + tokio::task::spawn(async move { + let _ = http1::Builder::new() + .timer(TokioTimer::new()) + .serve_connection( + io, + service_fn(move |req| { + handle_http_request(req, router.clone(), middlewares.clone()) + }), + ) + .await; + }); + }, } }); }); From 00173951f849a2f78dcd91a7df57165a11385104 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 09:55:13 +0300 Subject: [PATCH 02/15] CI fix: Add 'ring' feature to 'rustls-acme' to prevent 'aws-lc-sys' cross-compilation issues. --- Cargo.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5e3a800..d22d9d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,37 +31,37 @@ mime_guess = "2.0.5" napi-derive = "3.0.0" percent-encoding = "2.3.2" regex = "1.12.3" -rustls-acme = { version = "0.15.1", features = ["tokio"] } +rustls-acme = {version = "0.15.1", features = ["tokio", "ring"]} serde_json = "1.0.148" serde_qs = "1.0.0" serde_urlencoded = "0.7.1" tempfile = "3.24.0" -tokio-stream = { version = "0.1.18", features = ["net"] } +tokio-stream = {version = "0.1.18", features = ["net"]} urlencoding = "2.1.3" [dependencies.cookie] +features = ["percent-encode", "secure"] version = "0.18.1" -features = ["percent-encode","secure"] [dependencies.etag] -version = "4.0.0" features = ["std"] +version = "4.0.0" [dependencies.hyper] -version = "1.8.1" features = ["full"] +version = "1.8.1" [dependencies.hyper-util] -version = "0.1.19" features = ["tokio"] +version = "0.1.19" [dependencies.napi] +features = ["napi6", "async", "serde", "serde-json"] version = "3.0.0" -features = ["napi6","async","serde","serde-json"] [dependencies.tokio] +features = ["rt", "net", "rt-multi-thread", "macros"] version = "1.48.0" -features = ["rt","net","rt-multi-thread","macros"] [build-dependencies] napi-build = "2" From 5b3e1d303cf6d1196e9236d4abb07ba78396c6c2 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 12:46:48 +0300 Subject: [PATCH 03/15] CI fix: Force 'aws-lc-sys' to use pre-generated bindings to prevent cross-compilation issues. --- .github/workflows/CI.yml | 3 +++ Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7ca8185..c491667 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -127,6 +127,9 @@ jobs: - name: Install dependencies run: yarn install - name: Build + env: + AWS_LC_SYS_PREBUILT_NASM: '1' + AWS_LC_FIPS: '0' run: ${{ matrix.settings.build }} shell: bash - name: Upload artifact diff --git a/Cargo.toml b/Cargo.toml index d22d9d9..01f6b78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ mime_guess = "2.0.5" napi-derive = "3.0.0" percent-encoding = "2.3.2" regex = "1.12.3" -rustls-acme = {version = "0.15.1", features = ["tokio", "ring"]} +rustls-acme = {version = "0.15.1", features = ["tokio"]} serde_json = "1.0.148" serde_qs = "1.0.0" serde_urlencoded = "0.7.1" From 14842fa57d8a6c7db39694aafc61dbf13a550119 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 12:51:55 +0300 Subject: [PATCH 04/15] CI fix: Turn of default features for 'aws-lc-sys' to fix cross-compilation issues. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 01f6b78..7fef218 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ mime_guess = "2.0.5" napi-derive = "3.0.0" percent-encoding = "2.3.2" regex = "1.12.3" -rustls-acme = {version = "0.15.1", features = ["tokio"]} +rustls-acme = {version = "0.15.1", default-features = false, features = ["tokio"]} serde_json = "1.0.148" serde_qs = "1.0.0" serde_urlencoded = "0.7.1" From b0cdac161554b271db45d6bca5d487c0529e3045 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 13:00:46 +0300 Subject: [PATCH 05/15] CI fix: Attempt to switch to a pure-Rust TLS implementation to prevent 'aws-lc-sys' cross-compilation issues. --- .github/workflows/CI.yml | 3 --- Cargo.toml | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c491667..7ca8185 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -127,9 +127,6 @@ jobs: - name: Install dependencies run: yarn install - name: Build - env: - AWS_LC_SYS_PREBUILT_NASM: '1' - AWS_LC_FIPS: '0' run: ${{ matrix.settings.build }} shell: bash - name: Upload artifact diff --git a/Cargo.toml b/Cargo.toml index 7fef218..3830ff8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ mime_guess = "2.0.5" napi-derive = "3.0.0" percent-encoding = "2.3.2" regex = "1.12.3" -rustls-acme = {version = "0.15.1", default-features = false, features = ["tokio"]} +rustls-acme = {version = "0.15.1", features = ["tokio"]} serde_json = "1.0.148" serde_qs = "1.0.0" serde_urlencoded = "0.7.1" @@ -66,6 +66,9 @@ version = "1.48.0" [build-dependencies] napi-build = "2" +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "linker=x86_64-unknown-linux-gnu-gcc"] + [profile.release] lto = true strip = "symbols" From c61143c315f3ad84ef9d3d0c264a24179f85cef9 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 13:08:06 +0300 Subject: [PATCH 06/15] CI fix: Install cross-compilation headers to enable cross-compiling of 'aws-lc-sys' in gnu systems. --- .github/workflows/CI.yml | 6 ++++++ Cargo.toml | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7ca8185..9d11471 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -124,6 +124,12 @@ jobs: run: ${{ matrix.settings.setup }} if: ${{ matrix.settings.setup }} shell: bash + - name: Install cross-compilation headers + run: | + if [[ "${{ matrix.settings.target }}" == *"gnu"* ]]; then + sudo apt-get update + sudo apt-get install -y gcc-x86_64-linux-gnu libc6-dev-amd64-cross + fi - name: Install dependencies run: yarn install - name: Build diff --git a/Cargo.toml b/Cargo.toml index 3830ff8..01f6b78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,9 +66,6 @@ version = "1.48.0" [build-dependencies] napi-build = "2" -[target.x86_64-unknown-linux-gnu] -rustflags = ["-C", "linker=x86_64-unknown-linux-gnu-gcc"] - [profile.release] lto = true strip = "symbols" From fd1e1f945d2bca23206e0ad83c27f96b40545179 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 13:16:09 +0300 Subject: [PATCH 07/15] CI fix: Fix linux system assumption in CI step. --- .github/workflows/CI.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9d11471..4150722 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -125,11 +125,10 @@ jobs: if: ${{ matrix.settings.setup }} shell: bash - name: Install cross-compilation headers + if: ${{ contains(matrix.settings.target, 'gnu') }} run: | - if [[ "${{ matrix.settings.target }}" == *"gnu"* ]]; then - sudo apt-get update - sudo apt-get install -y gcc-x86_64-linux-gnu libc6-dev-amd64-cross - fi + sudo apt-get update + sudo apt-get install -y gcc-x86_64-linux-gnu libc6-dev-amd64-cross - name: Install dependencies run: yarn install - name: Build From 84adb58511ff910aeca159a38709d488a0943586 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 13:19:34 +0300 Subject: [PATCH 08/15] CI fix: Correct package name in GNU build step. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4150722..88b8877 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -128,7 +128,7 @@ jobs: if: ${{ contains(matrix.settings.target, 'gnu') }} run: | sudo apt-get update - sudo apt-get install -y gcc-x86_64-linux-gnu libc6-dev-amd64-cross + sudo apt install build-essential - name: Install dependencies run: yarn install - name: Build From 0b2e23d54bb871fd21d8891bfc42ca4f7f674c3f Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 13:30:40 +0300 Subject: [PATCH 09/15] CI fix: Force use of system GCC. --- .github/workflows/CI.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 88b8877..02a739e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -132,6 +132,9 @@ jobs: - name: Install dependencies run: yarn install - name: Build + env: + CC_x86_64_unknown_linux_gnu: gcc + CXX_x86_64_unknown_linux_gnu: g++ run: ${{ matrix.settings.build }} shell: bash - name: Upload artifact From ca6628253270facb5be510548f8688bc6073d185 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 13:37:12 +0300 Subject: [PATCH 10/15] CI fix: Force use of system GCC. --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 02a739e..8d60870 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -133,8 +133,8 @@ jobs: run: yarn install - name: Build env: - CC_x86_64_unknown_linux_gnu: gcc - CXX_x86_64_unknown_linux_gnu: g++ + CC: gcc + CXX: g++ run: ${{ matrix.settings.build }} shell: bash - name: Upload artifact From 7f98f83cf8a698d64d22f8e6e716ca0eaf212e36 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 13:44:10 +0300 Subject: [PATCH 11/15] CI fix: Add debugging steps. --- .github/workflows/CI.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8d60870..da1bd18 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -124,6 +124,14 @@ jobs: run: ${{ matrix.settings.setup }} if: ${{ matrix.settings.setup }} shell: bash + - name: Debug compiler + run: | + echo "CC=$CC" + echo "CC_x86_64_unknown_linux_gnu=$CC_x86_64_unknown_linux_gnu" + which gcc + gcc --version + - name: Verify compiler used by Cargo + run: cargo build -vv - name: Install cross-compilation headers if: ${{ contains(matrix.settings.target, 'gnu') }} run: | @@ -135,6 +143,8 @@ jobs: env: CC: gcc CXX: g++ + CC_x86_64_unknown_linux_gnu: gcc + CXX_x86_64_unknown_linux_gnu: g++ run: ${{ matrix.settings.build }} shell: bash - name: Upload artifact From b4a3819cc65c120dab8e5b4b1d7d443748313de3 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 14:01:24 +0300 Subject: [PATCH 12/15] Disable napi-rs cross toolchain --- .github/workflows/CI.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index da1bd18..cd24a07 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -124,6 +124,13 @@ jobs: run: ${{ matrix.settings.setup }} if: ${{ matrix.settings.setup }} shell: bash + - name: Disable napi cross toolchain + run: rm -rf ~/.napi-rs/cross-toolchain + - name: Set system compiler + run: | + echo "CC_x86_64_unknown_linux_gnu=gcc" >> $GITHUB_ENV + echo "CXX_x86_64_unknown_linux_gnu=g++" >> $GITHUB_ENV + echo "AR_x86_64_unknown_linux_gnu=ar" >> $GITHUB_ENV - name: Debug compiler run: | echo "CC=$CC" @@ -132,7 +139,7 @@ jobs: gcc --version - name: Verify compiler used by Cargo run: cargo build -vv - - name: Install cross-compilation headers + - name: Install build essentials if: ${{ contains(matrix.settings.target, 'gnu') }} run: | sudo apt-get update From 798cdbcabfc68428e83183250254ad0ae5d9088f Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 14:07:47 +0300 Subject: [PATCH 13/15] Revert to default configuration with '--use-napi-cross' removed for gnu systems. --- .github/workflows/CI.yml | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cd24a07..8331de1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -59,7 +59,7 @@ jobs: target: i686-pc-windows-msvc - host: ubuntu-latest target: x86_64-unknown-linux-gnu - build: yarn build --target x86_64-unknown-linux-gnu --use-napi-cross + build: yarn build --target x86_64-unknown-linux-gnu - host: ubuntu-latest target: x86_64-unknown-linux-musl build: yarn build --target x86_64-unknown-linux-musl -x @@ -68,7 +68,7 @@ jobs: build: yarn build --target aarch64-apple-darwin - host: ubuntu-latest target: aarch64-unknown-linux-gnu - build: yarn build --target aarch64-unknown-linux-gnu --use-napi-cross + build: yarn build --target aarch64-unknown-linux-gnu - host: ubuntu-latest target: armv7-unknown-linux-gnueabihf build: yarn build --target armv7-unknown-linux-gnueabihf --use-napi-cross @@ -124,34 +124,17 @@ jobs: run: ${{ matrix.settings.setup }} if: ${{ matrix.settings.setup }} shell: bash - - name: Disable napi cross toolchain - run: rm -rf ~/.napi-rs/cross-toolchain - - name: Set system compiler - run: | - echo "CC_x86_64_unknown_linux_gnu=gcc" >> $GITHUB_ENV - echo "CXX_x86_64_unknown_linux_gnu=g++" >> $GITHUB_ENV - echo "AR_x86_64_unknown_linux_gnu=ar" >> $GITHUB_ENV - - name: Debug compiler - run: | - echo "CC=$CC" - echo "CC_x86_64_unknown_linux_gnu=$CC_x86_64_unknown_linux_gnu" - which gcc - gcc --version - - name: Verify compiler used by Cargo - run: cargo build -vv - name: Install build essentials if: ${{ contains(matrix.settings.target, 'gnu') }} run: | sudo apt-get update sudo apt install build-essential + echo "CC_x86_64_unknown_linux_gnu=gcc" >> $GITHUB_ENV + echo "CXX_x86_64_unknown_linux_gnu=g++" >> $GITHUB_ENV + echo "AR_x86_64_unknown_linux_gnu=ar" >> $GITHUB_ENV - name: Install dependencies run: yarn install - name: Build - env: - CC: gcc - CXX: g++ - CC_x86_64_unknown_linux_gnu: gcc - CXX_x86_64_unknown_linux_gnu: g++ run: ${{ matrix.settings.build }} shell: bash - name: Upload artifact From c92cd4d30e1edb8096d138c49240cd6c15725434 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 14:16:32 +0300 Subject: [PATCH 14/15] CI fix: Install and configure required additional packages for GNU systems. --- .github/workflows/CI.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8331de1..4001655 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -124,14 +124,24 @@ jobs: run: ${{ matrix.settings.setup }} if: ${{ matrix.settings.setup }} shell: bash - - name: Install build essentials - if: ${{ contains(matrix.settings.target, 'gnu') }} + - name: Install build essentials (x86_64 Linux) + if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} run: | sudo apt-get update sudo apt install build-essential echo "CC_x86_64_unknown_linux_gnu=gcc" >> $GITHUB_ENV echo "CXX_x86_64_unknown_linux_gnu=g++" >> $GITHUB_ENV echo "AR_x86_64_unknown_linux_gnu=ar" >> $GITHUB_ENV + + - name: Install build essentials (aarch64 Linux) + if: ${{ matrix.settings.target == 'aarch64-unknown-linux-gnu' }} + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu + echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV + echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV + echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar" >> $GITHUB_ENV + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV - name: Install dependencies run: yarn install - name: Build From d562ab3224300b8123b779e78425ccc2dba050d0 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Tue, 17 Mar 2026 15:06:29 +0300 Subject: [PATCH 15/15] CI fix: Pin GNU image Ubuntu version to 22.04 as opposed to ubuntu-latest to prevent test issues. --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4001655..436b455 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -57,7 +57,7 @@ jobs: - host: windows-latest build: yarn build --target i686-pc-windows-msvc target: i686-pc-windows-msvc - - host: ubuntu-latest + - host: ubuntu-22.04 target: x86_64-unknown-linux-gnu build: yarn build --target x86_64-unknown-linux-gnu - host: ubuntu-latest @@ -66,7 +66,7 @@ jobs: - host: macos-latest target: aarch64-apple-darwin build: yarn build --target aarch64-apple-darwin - - host: ubuntu-latest + - host: ubuntu-22.04 target: aarch64-unknown-linux-gnu build: yarn build --target aarch64-unknown-linux-gnu - host: ubuntu-latest