diff --git a/.github/workflows/branch-checks.yml b/.github/workflows/branch-checks.yml index 5a80331ba1..3bc6944537 100644 --- a/.github/workflows/branch-checks.yml +++ b/.github/workflows/branch-checks.yml @@ -106,7 +106,7 @@ jobs: run: mise install --locked - name: Cache Rust target and registry - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2 + uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 with: # Keep branch-check caches partitioned by runner architecture; lint # and test intentionally share the same job-local target directory. @@ -139,6 +139,47 @@ jobs: fi exit 0 + rust-macos: + name: Rust lint (macOS) + needs: pr_metadata + if: needs.pr_metadata.outputs.should_run == 'true' + runs-on: macos-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Install mise + run: | + curl --proto '=https' --tlsv1.2 -sSf https://mise.run | MISE_VERSION=v2026.4.25 sh + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH" + + - name: Configure GHA sccache backend + uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 + + - name: Install Rust and Clippy + run: | + mise install --locked rust + rustup component add clippy + + - name: Cache Rust target and registry + uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 + with: + shared-key: rust-clippy-macos + cache-on-failure: "true" + + - name: Lint macOS-sensitive crates + # Formatting is target-independent and already checked by the Linux jobs. + # The full mise lint covers every workspace/E2E target and requires extra + # native dependencies such as Z3; keep this guard focused on macOS cfgs. + run: | + cargo clippy \ + -p openshell-sandbox \ + -p openshell-core \ + -p openshell-cli \ + --all-targets \ + -- -D warnings + python: name: Python (${{ matrix.runner }}) needs: pr_metadata diff --git a/crates/openshell-sandbox/src/lib.rs b/crates/openshell-sandbox/src/lib.rs index 1a49f7cd05..e696403f39 100644 --- a/crates/openshell-sandbox/src/lib.rs +++ b/crates/openshell-sandbox/src/lib.rs @@ -17,7 +17,9 @@ mod sidecar_control; use miette::{IntoDiagnostic, Result, WrapErr}; use std::future::Future; use std::sync::Arc; -use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; +#[cfg(target_os = "linux")] +use std::sync::atomic::Ordering; +use std::sync::atomic::{AtomicBool, AtomicU32}; use std::time::Duration; use tracing::{debug, info, warn}; diff --git a/crates/openshell-server/src/grpc/sandbox.rs b/crates/openshell-server/src/grpc/sandbox.rs index 57bf421b88..c87fc01436 100644 --- a/crates/openshell-server/src/grpc/sandbox.rs +++ b/crates/openshell-server/src/grpc/sandbox.rs @@ -2477,9 +2477,9 @@ mod tests { ) .await }); - tokio::time::timeout(std::time::Duration::from_secs(1), async { + tokio::time::timeout(std::time::Duration::from_secs(5), async { while state.compute.delete_gate_entry_count() == 0 { - tokio::task::yield_now().await; + tokio::time::sleep(std::time::Duration::from_millis(10)).await; } }) .await diff --git a/e2e/with-podman-gateway.sh b/e2e/with-podman-gateway.sh index ba9179a841..e9e9fb2be2 100755 --- a/e2e/with-podman-gateway.sh +++ b/e2e/with-podman-gateway.sh @@ -13,6 +13,10 @@ # # HTTPS endpoint-only mode is intentionally unsupported here. Use a named # gateway config when mTLS materials are needed. +# +# Set OPENSHELL_E2E_PODMAN_STOP_TIMEOUT_SECS to override the managed gateway's +# Podman sandbox stop timeout. The harness default is intentionally shorter +# than the production driver default to keep CI teardown bounded. set -euo pipefail @@ -359,6 +363,11 @@ echo "Using Podman supervisor image: ${SUPERVISOR_IMAGE}" DEFAULT_SANDBOX_IMAGE="ghcr.io/nvidia/openshell-community/sandboxes/base:latest" SANDBOX_IMAGE="${OPENSHELL_E2E_PODMAN_SANDBOX_IMAGE:-${OPENSHELL_SANDBOX_IMAGE:-${DEFAULT_SANDBOX_IMAGE}}}" +PODMAN_STOP_TIMEOUT_SECS="${OPENSHELL_E2E_PODMAN_STOP_TIMEOUT_SECS:-15}" +if ! [[ "${PODMAN_STOP_TIMEOUT_SECS}" =~ ^[0-9]+$ ]]; then + echo "ERROR: OPENSHELL_E2E_PODMAN_STOP_TIMEOUT_SECS must be a non-negative integer." >&2 + exit 2 +fi if ! podman_cmd image exists "${SANDBOX_IMAGE}" 2>/dev/null; then echo "Pulling ${SANDBOX_IMAGE}..." podman_cmd pull "${SANDBOX_IMAGE}" @@ -416,6 +425,9 @@ cp "${ROOT}/deploy/rpm/gateway.toml.default" "${GATEWAY_CONFIG}" printf 'gateway_port = %s\n' "${HOST_PORT}" printf 'default_image = %s\n' "$(toml_string "${SANDBOX_IMAGE}")" printf 'image_pull_policy = "missing"\n' + # Keep CI teardown bounded while the production Podman driver default stays + # conservative for real user workloads. + printf 'stop_timeout_secs = %s\n' "${PODMAN_STOP_TIMEOUT_SECS}" printf 'supervisor_image = %s\n' "$(toml_string "${SUPERVISOR_IMAGE}")" printf 'guest_tls_ca = %s\n' "$(toml_string "${PKI_DIR}/ca.crt")" printf 'guest_tls_cert = %s\n' "$(toml_string "${PKI_DIR}/client/tls.crt")"