Rationalize cargo feature and platform-gate surface (#79)

Drop the `tui`, `ble`, and `gateway` cargo features and replace
them with platform cfg gates. Plain `cargo build` now produces
every subsystem appropriate for the target platform with no
feature flags required.

Motivation:
- `default = ["tui", "ble"]` broke `cargo build` on macOS and
  Windows because `ble` pulled in `bluer` (BlueZ, Linux-only).
  Every non-Linux packager needed `--no-default-features`.
- The feature flags on `ble` and `gateway` were redundant with
  their platform-gated deps (`bluer`, `rustables`). The parallel
  gating was inconsistent and error-prone.
- `tui` feature protected against a ratatui binary-size concern
  that no longer applies in 2026.

Cargo.toml:
- Remove `tui`, `ble`, `gateway` features; `default = []`.
- Promote `ratatui` to a non-optional top-level dependency.
- Move `rustables` from top-level optional into the Linux
  target block, non-optional.
- Split `bluer` into its own target block with
  `cfg(all(target_os = "linux", not(target_env = "musl")))`
  — BlueZ isn't available on musl router targets and
  `libdbus-sys` doesn't cross-compile to musl without pkg-config
  sysroot setup.
- Drop `required-features` from the `fipstop` and `fips-gateway`
  `[[bin]]` entries.

build.rs:
- Emit a `bluer_available` custom cfg when `target_os == "linux"`
  and `target_env != "musl"`, for use in place of the verbose
  full predicate in source cfg gates.

Source:
- Replace every `#[cfg(feature = "gateway")]` with
  `#[cfg(target_os = "linux")]`. Gateway code works on both
  glibc and musl Linux (rustables is fine on musl).
- Replace every `#[cfg(feature = "ble")]` with
  `#[cfg(bluer_available)]`. BLE-specific code (BluerIo module,
  bluer type conversions, BLE transport instance creation,
  resolve_ble_addr) is excluded on musl and non-Linux. Generic
  `BleAddr`, `BleIo` trait, `MockBleIo`, and `BleTransport<I>`
  still compile on all targets.
- `src/bin/fips-gateway.rs`: always compiled, but `main()` is
  gated to Linux. Non-Linux stub exits 1 with a diagnostic.
  Existing non-Linux packaging scripts don't ship it, so the
  stub binary sits unused.

Packaging and CI:
- Drop `--features` and `--no-default-features` flags from every
  packaging script and workflow. Defaults now match each
  platform's capabilities.
- AUR `fips-git` automatically aligns with stable `PKGBUILD`
  (both build with defaults).

Verified: `cargo build --release` with no flags produces all
four binaries on glibc Linux; all unit and integration tests
pass across Linux/macOS/Windows/OpenWrt (musl) in CI.
This commit is contained in:
Johnathan Corgan
2026-04-24 13:42:30 -07:00
committed by GitHub
parent be0708ac9b
commit cbc78091ab
21 changed files with 79 additions and 57 deletions

View File

@@ -82,7 +82,7 @@ jobs:
${{ runner.os }}-cargo- ${{ runner.os }}-cargo-
- name: Build - name: Build
run: cargo build --release ${{ (runner.os == 'macOS' || runner.os == 'Windows') && '--no-default-features --features tui' || '--features gateway' }} run: cargo build --release
- name: SHA-256 hashes (Linux) - name: SHA-256 hashes (Linux)
if: runner.os == 'Linux' if: runner.os == 'Linux'
@@ -147,7 +147,7 @@ jobs:
uses: taiki-e/install-action@nextest uses: taiki-e/install-action@nextest
- name: Run unit tests - name: Run unit tests
run: cargo nextest run --all --profile ci --features gateway run: cargo nextest run --all --profile ci
- name: Publish test report (Checks tab) - name: Publish test report (Checks tab)
uses: dorny/test-reporter@v2 uses: dorny/test-reporter@v2
@@ -197,7 +197,7 @@ jobs:
uses: taiki-e/install-action@nextest uses: taiki-e/install-action@nextest
- name: Run unit tests - name: Run unit tests
run: cargo nextest run --all --profile ci --no-default-features --features tui run: cargo nextest run --all --profile ci
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
# Job 2c Unit tests (Windows) # Job 2c Unit tests (Windows)
@@ -226,7 +226,7 @@ jobs:
uses: taiki-e/install-action@nextest uses: taiki-e/install-action@nextest
- name: Run unit tests - name: Run unit tests
run: cargo nextest run --all --profile ci --no-default-features --features tui run: cargo nextest run --all --profile ci
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
# Job 3 Integration tests (static mesh + chaos simulation) # Job 3 Integration tests (static mesh + chaos simulation)

View File

@@ -90,7 +90,7 @@ jobs:
run: cargo install cargo-deb --version 3.6.3 --locked run: cargo install cargo-deb --version 3.6.3 --locked
- name: Build release binaries - name: Build release binaries
run: cargo build --release --features gateway run: cargo build --release
- name: Build systemd tarball - name: Build systemd tarball
env: env:

View File

@@ -86,7 +86,7 @@ jobs:
macos-release-${{ matrix.arch }}- macos-release-${{ matrix.arch }}-
- name: Build release binaries - name: Build release binaries
run: cargo build --release --target ${{ matrix.target }} --no-default-features --features tui run: cargo build --release --target ${{ matrix.target }}
- name: Build macOS package - name: Build macOS package
run: | run: |

View File

@@ -77,7 +77,7 @@ jobs:
windows-release-x86_64- windows-release-x86_64-
- name: Build release binaries - name: Build release binaries
run: cargo build --release --no-default-features --features tui run: cargo build --release
- name: Build Windows package - name: Build Windows package
shell: pwsh shell: pwsh

View File

@@ -9,13 +9,10 @@ repository = "https://github.com/jmcorgan/fips"
readme = "README.md" readme = "README.md"
[features] [features]
default = ["tui", "ble"] default = []
tui = ["dep:ratatui"]
ble = ["dep:bluer"]
gateway = ["dep:rustables"]
[dependencies] [dependencies]
ratatui = { version = "0.30", optional = true } ratatui = "0.30"
secp256k1 = { version = "0.30", features = ["rand", "global-context"] } secp256k1 = { version = "0.30", features = ["rand", "global-context"] }
sha2 = "0.10" sha2 = "0.10"
hkdf = "0.12" hkdf = "0.12"
@@ -38,15 +35,17 @@ socket2 = { version = "0.6.2", features = ["all"] }
tokio-socks = "0.5" tokio-socks = "0.5"
portable-atomic = { version = "1", features = ["std"] } portable-atomic = { version = "1", features = ["std"] }
rustables = { version = "0.8.7", optional = true }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
tun = { version = "0.8.5", features = ["async"] } tun = { version = "0.8.5", features = ["async"] }
libc = "0.2" libc = "0.2"
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
rtnetlink = "0.20.0" rtnetlink = "0.20.0"
bluer = { version = "0.17", features = ["bluetoothd", "l2cap"], optional = true } rustables = "0.8.7"
# bluer/BlueZ needs glibc — see build.rs `bluer_available` cfg gate.
[target.'cfg(all(target_os = "linux", not(target_env = "musl")))'.dependencies]
bluer = { version = "0.17", features = ["bluetoothd", "l2cap"] }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
wintun = "0.5" wintun = "0.5"
@@ -95,9 +94,7 @@ path = "src/bin/fipsctl.rs"
[[bin]] [[bin]]
name = "fips-gateway" name = "fips-gateway"
path = "src/bin/fips-gateway.rs" path = "src/bin/fips-gateway.rs"
required-features = ["gateway"]
[[bin]] [[bin]]
name = "fipstop" name = "fipstop"
path = "src/bin/fipstop/main.rs" path = "src/bin/fipstop/main.rs"
required-features = ["tui"]

View File

@@ -36,4 +36,14 @@ fn main() {
// Support reproducible builds (Debian packaging) // Support reproducible builds (Debian packaging)
println!("cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH"); println!("cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH");
// bluer/BlueZ is glibc-linux only: musl cross-compiles (OpenWrt) can't
// satisfy libdbus-sys's pkg-config cross-compile requirement, and musl
// router targets don't run BlueZ by default anyway.
println!("cargo:rustc-check-cfg=cfg(bluer_available)");
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
let target_env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default();
if target_os == "linux" && target_env != "musl" {
println!("cargo:rustc-cfg=bluer_available");
}
} }

View File

@@ -29,13 +29,13 @@ build() {
cd "$pkgname-$pkgver" cd "$pkgname-$pkgver"
export CARGO_TARGET_DIR=target export CARGO_TARGET_DIR=target
export SOURCE_DATE_EPOCH=$(stat -c %Y Cargo.toml) export SOURCE_DATE_EPOCH=$(stat -c %Y Cargo.toml)
cargo build --frozen --release --features gateway cargo build --frozen --release
} }
check() { check() {
cd "$pkgname-$pkgver" cd "$pkgname-$pkgver"
export CARGO_TARGET_DIR=target export CARGO_TARGET_DIR=target
cargo test --frozen --lib --features gateway cargo test --frozen --lib
} }
package() { package() {

View File

@@ -71,7 +71,7 @@ echo "Building .deb package..."
OUTPUT_DIR="$(mktemp -d)" OUTPUT_DIR="$(mktemp -d)"
trap 'rm -rf "${OUTPUT_DIR}"' EXIT trap 'rm -rf "${OUTPUT_DIR}"' EXIT
cargo_args=(deb --output "${OUTPUT_DIR}" --features gateway) cargo_args=(deb --output "${OUTPUT_DIR}")
if [[ -n "${TARGET_TRIPLE}" ]]; then if [[ -n "${TARGET_TRIPLE}" ]]; then
cargo_args+=(--target "${TARGET_TRIPLE}") cargo_args+=(--target "${TARGET_TRIPLE}")
fi fi

View File

@@ -72,7 +72,7 @@ echo "Building FIPS v${VERSION} for macOS ${ARCH}..."
# Build release binaries # Build release binaries
if [[ "${NO_BUILD}" -eq 0 ]]; then if [[ "${NO_BUILD}" -eq 0 ]]; then
cargo_args=(build --release --manifest-path="${PROJECT_ROOT}/Cargo.toml" --no-default-features --features tui) cargo_args=(build --release --manifest-path="${PROJECT_ROOT}/Cargo.toml")
[[ -n "${TARGET_TRIPLE}" ]] && cargo_args+=(--target "${TARGET_TRIPLE}") [[ -n "${TARGET_TRIPLE}" ]] && cargo_args+=(--target "${TARGET_TRIPLE}")
cargo "${cargo_args[@]}" cargo "${cargo_args[@]}"
fi fi

View File

@@ -109,8 +109,6 @@ cd "$PROJECT_ROOT"
cargo zigbuild \ cargo zigbuild \
--release \ --release \
--target "$RUST_TARGET" \ --target "$RUST_TARGET" \
--no-default-features \
--features tui,gateway \
--bin fips \ --bin fips \
--bin fipsctl \ --bin fipsctl \
--bin fipstop \ --bin fipstop \

View File

@@ -84,9 +84,9 @@ fi
echo "Building FIPS v${VERSION} for ${ARCH}..." echo "Building FIPS v${VERSION} for ${ARCH}..."
# Build release binaries (tui is a default feature, includes fipstop) # Build release binaries
if [[ "${NO_BUILD}" -eq 0 ]]; then if [[ "${NO_BUILD}" -eq 0 ]]; then
cargo_args=(build --release --manifest-path="${PROJECT_ROOT}/Cargo.toml" --features gateway) cargo_args=(build --release --manifest-path="${PROJECT_ROOT}/Cargo.toml")
if [[ -n "${TARGET_TRIPLE}" ]]; then if [[ -n "${TARGET_TRIPLE}" ]]; then
cargo_args+=(--target "${TARGET_TRIPLE}") cargo_args+=(--target "${TARGET_TRIPLE}")
fi fi

View File

@@ -38,7 +38,7 @@ Write-Host "Building FIPS v$Version for Windows $Arch..."
# Build release binaries # Build release binaries
if (-not $NoBuild) { if (-not $NoBuild) {
Push-Location $ProjectRoot Push-Location $ProjectRoot
cargo build --release --no-default-features --features tui cargo build --release
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Error "cargo build failed" Write-Error "cargo build failed"
exit 1 exit 1

View File

@@ -3,21 +3,33 @@
//! Allows unmodified LAN hosts to reach FIPS mesh destinations via //! Allows unmodified LAN hosts to reach FIPS mesh destinations via
//! DNS-allocated virtual IPs and kernel nftables NAT. //! DNS-allocated virtual IPs and kernel nftables NAT.
#[cfg(target_os = "linux")]
use clap::Parser; use clap::Parser;
#[cfg(target_os = "linux")]
use fips::Config; use fips::Config;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
use fips::gateway::{control, dns, nat, net, pool}; use fips::gateway::{control, dns, nat, net, pool};
#[cfg(target_os = "linux")]
use fips::version; use fips::version;
#[cfg(target_os = "linux")]
use std::path::PathBuf; use std::path::PathBuf;
#[cfg(target_os = "linux")]
use std::sync::Arc; use std::sync::Arc;
#[cfg(target_os = "linux")]
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::atomic::{AtomicUsize, Ordering};
#[cfg(target_os = "linux")]
use std::time::Instant; use std::time::Instant;
#[cfg(target_os = "linux")]
use tokio::signal::unix::{SignalKind, signal}; use tokio::signal::unix::{SignalKind, signal};
#[cfg(target_os = "linux")]
use tokio::sync::{Mutex, mpsc, watch}; use tokio::sync::{Mutex, mpsc, watch};
#[cfg(target_os = "linux")]
use tracing::{error, info, warn}; use tracing::{error, info, warn};
#[cfg(target_os = "linux")]
use tracing_subscriber::{EnvFilter, fmt}; use tracing_subscriber::{EnvFilter, fmt};
/// FIPS outbound LAN gateway /// FIPS outbound LAN gateway
#[cfg(target_os = "linux")]
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command( #[command(
name = "fips-gateway", name = "fips-gateway",
@@ -35,6 +47,13 @@ struct Args {
log_level: String, log_level: String,
} }
#[cfg(not(target_os = "linux"))]
fn main() {
eprintln!("fips-gateway requires Linux (nftables unavailable on this platform)");
std::process::exit(1);
}
#[cfg(target_os = "linux")]
#[tokio::main(flavor = "current_thread")] #[tokio::main(flavor = "current_thread")]
async fn main() { async fn main() {
let args = Args::parse(); let args = Args::parse();

View File

@@ -18,7 +18,7 @@
//! nsec: "nsec1..." //! nsec: "nsec1..."
//! ``` //! ```
#[cfg(feature = "gateway")] #[cfg(target_os = "linux")]
mod gateway; mod gateway;
mod node; mod node;
mod peer; mod peer;
@@ -30,7 +30,7 @@ use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use thiserror::Error; use thiserror::Error;
#[cfg(feature = "gateway")] #[cfg(target_os = "linux")]
pub use gateway::{ConntrackConfig, GatewayConfig, GatewayDnsConfig, PortForward, Proto}; pub use gateway::{ConntrackConfig, GatewayConfig, GatewayDnsConfig, PortForward, Proto};
pub use node::{ pub use node::{
BloomConfig, BuffersConfig, CacheConfig, ControlConfig, DiscoveryConfig, LimitsConfig, BloomConfig, BuffersConfig, CacheConfig, ControlConfig, DiscoveryConfig, LimitsConfig,
@@ -378,7 +378,7 @@ pub struct Config {
pub peers: Vec<PeerConfig>, pub peers: Vec<PeerConfig>,
/// Gateway configuration (`gateway`). /// Gateway configuration (`gateway`).
#[cfg(feature = "gateway")] #[cfg(target_os = "linux")]
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
pub gateway: Option<GatewayConfig>, pub gateway: Option<GatewayConfig>,
} }
@@ -500,7 +500,7 @@ impl Config {
self.peers = other.peers; self.peers = other.peers;
} }
// Merge gateway section — higher-priority config replaces entirely // Merge gateway section — higher-priority config replaces entirely
#[cfg(feature = "gateway")] #[cfg(target_os = "linux")]
if other.gateway.is_some() { if other.gateway.is_some() {
self.gateway = other.gateway; self.gateway = other.gateway;
} }

View File

@@ -7,7 +7,7 @@ pub mod bloom;
pub mod cache; pub mod cache;
pub mod config; pub mod config;
pub mod control; pub mod control;
#[cfg(feature = "gateway")] #[cfg(target_os = "linux")]
pub mod gateway; pub mod gateway;
pub mod identity; pub mod identity;
pub mod mmp; pub mod mmp;

View File

@@ -125,7 +125,7 @@ impl Node {
} }
} }
} else if addr.transport == "ble" { } else if addr.transport == "ble" {
#[cfg(target_os = "linux")] #[cfg(bluer_available)]
{ {
match self.resolve_ble_addr(&addr.addr) { match self.resolve_ble_addr(&addr.addr) {
Ok(result) => result, Ok(result) => result,
@@ -140,11 +140,11 @@ impl Node {
} }
} }
} }
#[cfg(not(target_os = "linux"))] #[cfg(not(bluer_available))]
{ {
debug!( debug!(
transport = %addr.transport, transport = %addr.transport,
"BLE transport not available on this platform" "BLE transport not available on this build"
); );
continue; continue;
} }

View File

@@ -800,7 +800,7 @@ impl Node {
} }
// Create BLE transport instances // Create BLE transport instances
#[cfg(target_os = "linux")] #[cfg(bluer_available)]
{ {
let ble_instances: Vec<_> = self let ble_instances: Vec<_> = self
.config .config
@@ -810,7 +810,7 @@ impl Node {
.map(|(name, config)| (name.map(|s| s.to_string()), config.clone())) .map(|(name, config)| (name.map(|s| s.to_string()), config.clone()))
.collect(); .collect();
#[cfg(all(feature = "ble", not(test)))] #[cfg(all(bluer_available, not(test)))]
for (name, ble_config) in ble_instances { for (name, ble_config) in ble_instances {
let transport_id = self.allocate_transport_id(); let transport_id = self.allocate_transport_id();
let adapter = ble_config.adapter().to_string(); let adapter = ble_config.adapter().to_string();
@@ -833,12 +833,10 @@ impl Node {
} }
} }
#[cfg(any(not(feature = "ble"), test))] #[cfg(any(not(bluer_available), test))]
if !ble_instances.is_empty() { if !ble_instances.is_empty() {
#[cfg(not(test))] #[cfg(not(test))]
tracing::warn!( tracing::warn!("BLE transport configured but this build lacks BlueZ support");
"BLE transport configured but 'ble' feature not enabled at compile time"
);
} }
} }
@@ -908,7 +906,7 @@ impl Node {
/// Resolve a BLE address string (`"adapter/AA:BB:CC:DD:EE:FF"`) to a /// Resolve a BLE address string (`"adapter/AA:BB:CC:DD:EE:FF"`) to a
/// (TransportId, TransportAddr) pair by finding the BLE transport /// (TransportId, TransportAddr) pair by finding the BLE transport
/// instance matching the adapter name. /// instance matching the adapter name.
#[cfg(target_os = "linux")] #[cfg(bluer_available)]
fn resolve_ble_addr(&self, addr_str: &str) -> Result<(TransportId, TransportAddr), NodeError> { fn resolve_ble_addr(&self, addr_str: &str) -> Result<(TransportId, TransportAddr), NodeError> {
let ta = TransportAddr::from_string(addr_str); let ta = TransportAddr::from_string(addr_str);
let adapter = crate::transport::ble::addr::adapter_from_addr(&ta).ok_or_else(|| { let adapter = crate::transport::ble::addr::adapter_from_addr(&ta).ok_or_else(|| {

View File

@@ -55,10 +55,10 @@ impl BleAddr {
} }
// ============================================================================ // ============================================================================
// bluer type conversions (behind ble feature) // bluer type conversions (glibc-linux only; see build.rs bluer_available)
// ============================================================================ // ============================================================================
#[cfg(feature = "ble")] #[cfg(bluer_available)]
impl BleAddr { impl BleAddr {
/// Construct from a bluer `Address` and adapter name. /// Construct from a bluer `Address` and adapter name.
pub fn from_bluer(addr: bluer::Address, adapter: &str) -> Self { pub fn from_bluer(addr: bluer::Address, adapter: &str) -> Self {

View File

@@ -1,7 +1,7 @@
//! BLE I/O abstraction layer. //! BLE I/O abstraction layer.
//! //!
//! Defines the `BleIo` trait that separates transport logic from the //! Defines the `BleIo` trait that separates transport logic from the
//! BlueZ/bluer stack. `BluerIo` (behind `cfg(feature = "ble")`) provides //! BlueZ/bluer stack. `BluerIo` (behind `cfg(bluer_available)`) provides
//! the real implementation; `MockBleIo` provides an in-memory test double. //! the real implementation; `MockBleIo` provides an in-memory test double.
use crate::transport::TransportError; use crate::transport::TransportError;
@@ -109,7 +109,7 @@ pub trait BleIo: Send + Sync + 'static {
// BluerIo — Production BLE I/O via BlueZ D-Bus // BluerIo — Production BLE I/O via BlueZ D-Bus
// ============================================================================ // ============================================================================
#[cfg(feature = "ble")] #[cfg(bluer_available)]
mod bluer_impl { mod bluer_impl {
use super::*; use super::*;
use crate::transport::TransportError; use crate::transport::TransportError;
@@ -486,7 +486,7 @@ mod bluer_impl {
} }
} }
#[cfg(feature = "ble")] #[cfg(bluer_available)]
pub use bluer_impl::{BluerAcceptor, BluerIo, BluerScanner, BluerStream, FIPS_SERVICE_UUID}; pub use bluer_impl::{BluerAcceptor, BluerIo, BluerScanner, BluerStream, FIPS_SERVICE_UUID};
// ============================================================================ // ============================================================================

View File

@@ -9,7 +9,7 @@
//! //!
//! Transport logic (pool, discovery, lifecycle) is separated from the //! Transport logic (pool, discovery, lifecycle) is separated from the
//! BlueZ/bluer stack via the `BleIo` trait. `BluerIo` provides the real //! BlueZ/bluer stack via the `BleIo` trait. `BluerIo` provides the real
//! implementation (behind `cfg(feature = "ble")`); `MockBleIo` provides //! implementation (behind `cfg(bluer_available)`); `MockBleIo` provides
//! an in-memory test double for CI without hardware. //! an in-memory test double for CI without hardware.
//! //!
//! ## Connection Pool //! ## Connection Pool
@@ -50,12 +50,12 @@ pub const DEFAULT_PSM: u16 = 0x0085;
/// Concrete BLE transport type for use in TransportHandle. /// Concrete BLE transport type for use in TransportHandle.
/// ///
/// Production builds with the `ble` feature use `BluerIo` (real BlueZ stack). /// Production builds on glibc-linux use `BluerIo` (real BlueZ stack).
/// Test builds and builds without `ble` use `MockBleIo`. /// Test builds, musl-linux, and non-Linux platforms use `MockBleIo`.
#[cfg(all(feature = "ble", not(test)))] #[cfg(all(bluer_available, not(test)))]
pub type DefaultBleTransport = BleTransport<io::BluerIo>; pub type DefaultBleTransport = BleTransport<io::BluerIo>;
#[cfg(any(not(feature = "ble"), test))] #[cfg(any(not(bluer_available), test))]
pub type DefaultBleTransport = BleTransport<io::MockBleIo>; pub type DefaultBleTransport = BleTransport<io::MockBleIo>;
// ============================================================================ // ============================================================================

View File

@@ -149,8 +149,8 @@ record() {
run_build() { run_build() {
stage "Stage 1: Build" stage "Stage 1: Build"
info "cargo build --release --features gateway" info "cargo build --release"
if cargo build --release --features gateway 2>&1; then if cargo build --release 2>&1; then
record "build" 0 record "build" 0
else else
record "build" 1 record "build" 1
@@ -165,8 +165,8 @@ run_build() {
return 1 return 1
fi fi
info "cargo clippy --all --features gateway -- -D warnings" info "cargo clippy --all -- -D warnings"
if cargo clippy --all --features gateway -- -D warnings 2>&1; then if cargo clippy --all -- -D warnings 2>&1; then
record "clippy" 0 record "clippy" 0
else else
record "clippy" 1 record "clippy" 1
@@ -181,7 +181,7 @@ run_tests() {
local cmd local cmd
if command -v cargo-nextest &>/dev/null; then if command -v cargo-nextest &>/dev/null; then
cmd="cargo nextest run --all --features gateway" cmd="cargo nextest run --all"
info "$cmd" info "$cmd"
if $cmd 2>&1; then if $cmd 2>&1; then
record "unit-tests" 0 record "unit-tests" 0
@@ -189,7 +189,7 @@ run_tests() {
record "unit-tests" 1 record "unit-tests" 1
fi fi
else else
cmd="cargo test --all --features gateway" cmd="cargo test --all"
info "$cmd (nextest not found, using cargo test)" info "$cmd (nextest not found, using cargo test)"
if $cmd 2>&1; then if $cmd 2>&1; then
record "unit-tests" 0 record "unit-tests" 0