diff --git a/.agents/skills/watch-github-actions/SKILL.md b/.agents/skills/watch-github-actions/SKILL.md index 4b03fb5b32..a6a2a1d029 100644 --- a/.agents/skills/watch-github-actions/SKILL.md +++ b/.agents/skills/watch-github-actions/SKILL.md @@ -131,6 +131,40 @@ gh run list --json databaseId,status,headBranch,url --jq '.[] | {id: .databaseId `Release Dev` finishes its active run and replaces pending runs when new commits arrive. Other callers retain E2E cancellation. Inspect job annotations for cancellation reasons. +## GKE runner trial + +Branch Checks Linux amd64 jobs from ai-openshell/openshell branches run on the +`openshell-ci-amd64` ARC scale set during the GKE trial. ARM Linux lint/tests +use `openshell-ci-arm64-pd-*` on native ARM Ubuntu nodes with ARM64 images. +Fork PRs, other ARM jobs, and macOS retain hosted runners. Confirm the runner name in the job details before +attributing a result to GKE. For a job-container or PostgreSQL startup failure, +check the runner pod's Docker sidecar first. A missing `gh` executable or +Cachix's `$USER must be set` error indicates incomplete runner bootstrap. +For a preloaded image, `setup-nix` verifies its global Cachix substituter and +skips adding it again. A cache-configuration permission failure indicates the +image/setup contract is out of sync. Rust jobs report shared memcached +sccache statistics; distinguish backend connectivity errors from compiler/test +failures. The x86 and ARM GKE lint/test jobs use single-worker +`openshell-ci-amd64-pd-*` and `openshell-ci-arm64-pd-*` scale sets with separate exclusive persistent disks. Setup reports the target +size before building and skips GitHub Cargo cache restore/save. Compare empty +and warm runs on different runner pods; a PVC surviving pod replacement is the +persistence check. `Pending` pods can be waiting for exclusive disk attachment; +inspect PVC/PV events before treating this as a runner registration failure. +On native ARM the crypto backend/OpenSSL verification steps run in the lint +job, in parallel with workspace tests; inspect that job for crypto failures. +Hosted/fork and x86 test jobs keep their existing crypto steps. +Gateway core features use parallel `base-kubernetes` and `docker-podman` matrix +jobs on `openshell-ci-amd64-pd-gateway-a/b`, with separate exclusive caches and +eight reserved runner CPUs. Inspect both jobs and all four named feature steps; +measure the later completion rather than summing durations. Fork jobs retain +hosted Ubuntu. A failed lane must fail the Branch Checks workflow gate. +The opt-in `compare_linux_combined` manual input adds Linux combined lint, +crypto, and test jobs beside the regular controls. Compare each architecture's +later control completion against its combined job, and runner minutes against +the control sum. Confirm cold versus warm target sizes; no Clippy architecture +coverage is dropped in this experiment. Ordinary PR runs skip the comparison. +See `CI.md` for trial scope and cache setup. + ## View Job Logs For Branch Checks `Reviewer Roster` failures, the log lists non-collaborators in diff --git a/.github/actionlint.yml b/.github/actionlint.yml index 31c5f55713..1f252bc640 100644 --- a/.github/actionlint.yml +++ b/.github/actionlint.yml @@ -3,6 +3,15 @@ self-hosted-runner: labels: + - openshell-ci-amd64 + - openshell-ci-amd64-pd-lint + - openshell-ci-amd64-pd-test + - openshell-ci-amd64-pd-combined + - openshell-ci-amd64-pd-gateway-a + - openshell-ci-amd64-pd-gateway-b + - openshell-ci-arm64-pd-lint + - openshell-ci-arm64-pd-test + - openshell-ci-arm64-pd-combined - ubuntu-26.04 - windows-arm64 diff --git a/.github/actions/setup-nix/action.yml b/.github/actions/setup-nix/action.yml index 0ae11edfe9..431ef22037 100644 --- a/.github/actions/setup-nix/action.yml +++ b/.github/actions/setup-nix/action.yml @@ -32,9 +32,17 @@ runs: extra-conf: | http2 = false + - name: Verify GKE image cache configuration + if: ${{ (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + shell: bash + run: | + nix config show --json | jq -e '.substituters.value | index("https://openshell.cachix.org") != null' > /dev/null + - uses: cachix/cachix-action@5f2d7c5294214f71b873db4b969586b980625e71 # v17 with: name: openshell + # The image configures the substituter globally before dropping to runner. + skipAddingSubstituter: ${{ (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} authToken: ${{ inputs.cachix-auth-token }} skipPush: ${{ inputs.cachix-auth-token == '' }} diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index 10e76ed63c..b8fa7f856a 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -12,6 +12,10 @@ inputs: description: Whether this job writes the Rust target cache required: false default: "false" + cache-workspace-crates: + description: Retain workspace build artifacts as well as dependencies + required: false + default: "false" outputs: cache-hit: @@ -21,6 +25,19 @@ outputs: runs: using: composite steps: + - name: Configure shared sccache on GKE runners + if: ${{ runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + shell: nix develop -c bash -euo pipefail {0} + run: | + mise install --locked github:mozilla/sccache + sccache_bin=$(mise which sccache) + dirname "$sccache_bin" >> "$GITHUB_PATH" + { + echo "RUSTC_WRAPPER=$sccache_bin" + echo "SCCACHE_MEMCACHED_ENDPOINT=tcp://memcached.sccache:11211" + echo "SCCACHE_BASEDIRS=$GITHUB_WORKSPACE" + } >> "$GITHUB_ENV" + - name: Hash Nix development shell id: dev-shell shell: bash @@ -28,7 +45,32 @@ runs: shell_drv=$(nix eval --raw --impure .#devShells --apply 'shells: shells.${builtins.currentSystem}.default.drvPath') echo "hash=$(nix hash file --type sha256 --base16 "$shell_drv")" >> "$GITHUB_OUTPUT" + - name: Configure persistent Cargo target directory + id: persistent-cache + shell: bash + env: + NIX_SHELL_HASH: ${{ steps.dev-shell.outputs.hash }} + run: | + set -euo pipefail + # Pod environment is visible to the shell, not the workflow env context. + if [[ -z "${OPENSHELL_PERSISTENT_CACHE:-}" ]]; then + exit 0 + fi + echo "enabled=true" >> "$GITHUB_OUTPUT" + test "$GITHUB_REPOSITORY" = ai-openshell/openshell + test "$OPENSHELL_PERSISTENT_CACHE" = /mnt/ci-cache + mountpoint -q "$OPENSHELL_PERSISTENT_CACHE" + cache_root="$OPENSHELL_PERSISTENT_CACHE/ai-openshell-openshell/$NIX_SHELL_HASH" + mkdir -p "$cache_root/target" + echo "CARGO_TARGET_DIR=$cache_root/target" >> "$GITHUB_ENV" + echo "Persistent cache lane: $OPENSHELL_CACHE_LANE" + echo "Runner pod: $RUNNER_NAME" + echo "Target directory: $cache_root/target" + du -sh "$cache_root/target" + df -h "$cache_root/target" + - name: Cache Rust target and registry + if: ${{ steps.persistent-cache.outputs.enabled != 'true' }} id: cache uses: Swatinem/rust-cache@6a7bc3ebce750e0a16a430dd57485acfdb38b05f with: @@ -36,4 +78,5 @@ runs: save-if: ${{ inputs.save-cache }} cache-on-failure: ${{ inputs.save-cache }} cache-bin: "false" + cache-workspace-crates: ${{ inputs.cache-workspace-crates }} cmd-format: nix develop -c {0} diff --git a/.github/workflows/branch-checks.yml b/.github/workflows/branch-checks.yml index 5505a1fa1b..a4a4561319 100644 --- a/.github/workflows/branch-checks.yml +++ b/.github/workflows/branch-checks.yml @@ -5,6 +5,12 @@ on: types: [checks_requested] pull_request: workflow_dispatch: + inputs: + compare_linux_combined: + description: Run Linux combined lint/test jobs alongside the parallel controls + type: boolean + required: false + default: false env: CARGO_TERM_COLOR: always @@ -22,7 +28,7 @@ concurrency: jobs: reviewer-roster: name: Reviewer Roster - runs-on: ubuntu-latest + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-latest' }} timeout-minutes: 5 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -59,7 +65,7 @@ jobs: ${{ !cancelled() && github.event_name == 'pull_request' && needs.compatibility-review.outputs.has_findings == 'true' && needs.compatibility-review.outputs.report_artifact != '' }} - runs-on: ubuntu-latest + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-latest' }} timeout-minutes: 5 continue-on-error: true permissions: @@ -98,7 +104,7 @@ jobs: protobuf-compatibility: name: Protobuf Compatibility - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 15 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -116,7 +122,7 @@ jobs: monitoring-changes: name: Detect monitoring mixin changes - runs-on: ubuntu-latest + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-latest' }} timeout-minutes: 5 outputs: changed: ${{ steps.changes.outputs.changed }} @@ -153,7 +159,7 @@ jobs: name: Monitoring Mixin needs: monitoring-changes if: needs.monitoring-changes.outputs.changed == 'true' - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 15 container: image: ghcr.io/ai-openshell/openshell/ci:82e753ba3ffdfb40c118e7cb416ced7f350381d5@sha256:d816f3b4b2de675928e2ecfd26ec6b937be35fe9986542c87d440bc3de5a29de @@ -174,7 +180,7 @@ jobs: mise-lockfile: name: mise Lockfile - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 30 container: image: ghcr.io/ai-openshell/openshell/ci:82e753ba3ffdfb40c118e7cb416ced7f350381d5@sha256:d816f3b4b2de675928e2ecfd26ec6b937be35fe9986542c87d440bc3de5a29de @@ -197,7 +203,7 @@ jobs: license-headers: name: License Headers - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 30 container: image: ghcr.io/ai-openshell/openshell/ci:82e753ba3ffdfb40c118e7cb416ced7f350381d5@sha256:d816f3b4b2de675928e2ecfd26ec6b937be35fe9986542c87d440bc3de5a29de @@ -215,7 +221,7 @@ jobs: cargo-deny: name: Cargo Deny - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 30 defaults: run: @@ -243,7 +249,7 @@ jobs: rust-format: name: Rust format - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 15 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -272,7 +278,7 @@ jobs: cargo-lockfiles: name: Cargo lockfiles - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 15 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -294,9 +300,9 @@ jobs: fail-fast: false matrix: include: - - runner: ubuntu-24.04 + - runner: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64-pd-lint' || 'ubuntu-24.04' }} system: x86_64-linux - - runner: ubuntu-24.04-arm + - runner: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-arm64-pd-lint' || 'ubuntu-24.04-arm' }} system: aarch64-linux - runner: macos-15-xlarge system: aarch64-darwin @@ -332,15 +338,71 @@ jobs: cargo clippy --locked --manifest-path tests/suites/features/Cargo.toml --workspace --all-targets -- -D warnings cargo clippy --locked --manifest-path tests/support/Cargo.toml --all-targets -- -D warnings + # Balance ARM crypto checks against the parallel workspace test job. + - name: Verify crypto backend independence + if: matrix.runner == 'openshell-ci-arm64-pd-lint' + shell: nix develop -c bash -euo pipefail {0} + run: | + cargo tree --locked -p openshell-crypto --no-default-features --edges normal,build,dev --target all --prefix none > /tmp/openshell-crypto-dependencies.txt + if grep -Eq '^(ring|aws-lc-rs|aws-lc-sys|aws-lc-fips-sys) v' /tmp/openshell-crypto-dependencies.txt; then + echo "ERROR: backend-free crypto build includes Ring or AWS-LC" >&2 + cat /tmp/openshell-crypto-dependencies.txt >&2 + exit 1 + fi + cargo test --locked -p openshell-crypto --no-default-features --test independent_backend + + - name: Verify OpenSSL backend + if: matrix.runner == 'openshell-ci-arm64-pd-lint' + shell: nix develop .#crypto -c bash -euo pipefail {0} + env: + OPENSSL_NO_VENDOR: "1" + OPENSSL_STATIC: "0" + run: | + cargo tree --locked -p openshell-crypto --no-default-features --features openssl --edges normal,build,dev --target all --prefix none > /tmp/openshell-openssl-dependencies.txt + if grep -Eq '^(ring|aws-lc-rs|aws-lc-sys|aws-lc-fips-sys|openssl-src) v' /tmp/openshell-openssl-dependencies.txt; then + echo "ERROR: OpenSSL-only crypto build includes another backend or vendored OpenSSL" >&2 + cat /tmp/openshell-openssl-dependencies.txt >&2 + exit 1 + fi + cargo clippy --locked -p openshell-crypto --no-default-features --features openssl --all-targets -- -D warnings + cargo test --locked -p openshell-crypto --no-default-features --features openssl + for feature in tls-tonic tls-kube tls-sqlx; do + cargo check --locked -p openshell-crypto --no-default-features --features "openssl,$feature" + done + cargo clippy --locked -p openshell-crypto --features openssl --all-targets -- -D warnings + cargo test --locked -p openshell-crypto --features openssl + + - name: Verify dynamic OpenSSL linkage on Linux + if: runner.os == 'Linux' && matrix.runner == 'openshell-ci-arm64-pd-lint' + shell: nix develop .#crypto -c bash -euo pipefail {0} + env: + OPENSSL_NO_VENDOR: "1" + OPENSSL_STATIC: "0" + run: | + cargo test --locked -p openshell-crypto --no-default-features --features openssl --test openssl_tls --no-run --message-format=json > "$RUNNER_TEMP/openssl-artifacts.jsonl" + executable=$(uv run --no-project python -c 'import json, sys; artifacts = [json.loads(line) for line in sys.stdin]; paths = [a["executable"] for a in artifacts if a.get("reason") == "compiler-artifact" and a.get("target", {}).get("name") == "openssl_tls" and a.get("executable")]; assert len(paths) == 1, paths; print(paths[0])' < "$RUNNER_TEMP/openssl-artifacts.jsonl") + ldd "$executable" > "$RUNNER_TEMP/openssl-linkage.txt" + cat "$RUNNER_TEMP/openssl-linkage.txt" + for library in libssl libcrypto; do + if ! grep -Eq "^[[:space:]]*$library\\.so[^[:space:]]* => /" "$RUNNER_TEMP/openssl-linkage.txt"; then + echo "ERROR: $library did not resolve to a dynamic library" >&2 + exit 1 + fi + done + + - name: Shared sccache statistics + if: ${{ always() && env.RUSTC_WRAPPER != '' && runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + run: sccache --show-stats + rust-test: name: Rust test (${{ matrix.system }}) strategy: fail-fast: false matrix: include: - - runner: ubuntu-24.04 + - runner: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64-pd-test' || 'ubuntu-24.04' }} system: x86_64-linux - - runner: ubuntu-24.04-arm + - runner: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-arm64-pd-test' || 'ubuntu-24.04-arm' }} system: aarch64-linux - runner: macos-15-xlarge system: aarch64-darwin @@ -359,6 +421,117 @@ jobs: cache-key: rust-checks-v2 save-cache: "true" + - name: Verify crypto backend independence + if: matrix.runner != 'openshell-ci-arm64-pd-test' + shell: nix develop -c bash -euo pipefail {0} + run: | + cargo tree --locked -p openshell-crypto --no-default-features --edges normal,build,dev --target all --prefix none > /tmp/openshell-crypto-dependencies.txt + if grep -Eq '^(ring|aws-lc-rs|aws-lc-sys|aws-lc-fips-sys) v' /tmp/openshell-crypto-dependencies.txt; then + echo "ERROR: backend-free crypto build includes Ring or AWS-LC" >&2 + cat /tmp/openshell-crypto-dependencies.txt >&2 + exit 1 + fi + cargo test --locked -p openshell-crypto --no-default-features --test independent_backend + + - name: Verify OpenSSL backend + if: matrix.runner != 'openshell-ci-arm64-pd-test' + shell: nix develop .#crypto -c bash -euo pipefail {0} + env: + OPENSSL_NO_VENDOR: "1" + OPENSSL_STATIC: "0" + run: | + cargo tree --locked -p openshell-crypto --no-default-features --features openssl --edges normal,build,dev --target all --prefix none > /tmp/openshell-openssl-dependencies.txt + if grep -Eq '^(ring|aws-lc-rs|aws-lc-sys|aws-lc-fips-sys|openssl-src) v' /tmp/openshell-openssl-dependencies.txt; then + echo "ERROR: OpenSSL-only crypto build includes another backend or vendored OpenSSL" >&2 + cat /tmp/openshell-openssl-dependencies.txt >&2 + exit 1 + fi + cargo clippy --locked -p openshell-crypto --no-default-features --features openssl --all-targets -- -D warnings + cargo test --locked -p openshell-crypto --no-default-features --features openssl + for feature in tls-tonic tls-kube tls-sqlx; do + cargo check --locked -p openshell-crypto --no-default-features --features "openssl,$feature" + done + cargo clippy --locked -p openshell-crypto --features openssl --all-targets -- -D warnings + cargo test --locked -p openshell-crypto --features openssl + + - name: Verify dynamic OpenSSL linkage on Linux + if: runner.os == 'Linux' && matrix.runner != 'openshell-ci-arm64-pd-test' + shell: nix develop .#crypto -c bash -euo pipefail {0} + env: + OPENSSL_NO_VENDOR: "1" + OPENSSL_STATIC: "0" + run: | + cargo test --locked -p openshell-crypto --no-default-features --features openssl --test openssl_tls --no-run --message-format=json > "$RUNNER_TEMP/openssl-artifacts.jsonl" + executable=$(uv run --no-project python -c 'import json, sys; artifacts = [json.loads(line) for line in sys.stdin]; paths = [a["executable"] for a in artifacts if a.get("reason") == "compiler-artifact" and a.get("target", {}).get("name") == "openssl_tls" and a.get("executable")]; assert len(paths) == 1, paths; print(paths[0])' < "$RUNNER_TEMP/openssl-artifacts.jsonl") + ldd "$executable" > "$RUNNER_TEMP/openssl-linkage.txt" + cat "$RUNNER_TEMP/openssl-linkage.txt" + for library in libssl libcrypto; do + if ! grep -Eq "^[[:space:]]*$library\\.so[^[:space:]]* => /" "$RUNNER_TEMP/openssl-linkage.txt"; then + echo "ERROR: $library did not resolve to a dynamic library" >&2 + exit 1 + fi + done + + - name: Test + shell: nix develop -c bash -euo pipefail {0} + env: + OPENSHELL_TELEMETRY_ENABLED: "false" + run: | + cargo nextest run --locked --profile ci --workspace --features openshell-server/test-support + cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml + cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/testkit/Cargo.toml + cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/tmachine/Cargo.toml + cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/runner/Cargo.toml + cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/support/Cargo.toml + tasks/scripts/check-conformance-program.sh + + - name: Shared sccache statistics + if: ${{ always() && env.RUSTC_WRAPPER != '' && runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + run: sccache --show-stats + + rust-linux-combined-trial: + name: Linux combined lint and tests (${{ matrix.system }}) + if: github.event_name == 'workflow_dispatch' && inputs.compare_linux_combined && github.repository == 'ai-openshell/openshell' + strategy: + fail-fast: false + matrix: + include: + - system: x86_64-linux + runner: openshell-ci-amd64-pd-combined + - system: aarch64-linux + runner: openshell-ci-arm64-pd-combined + runs-on: ${{ matrix.runner }} + timeout-minutes: 45 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: ./.github/actions/setup-nix + with: + prepare-shell: "true" + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} + + - uses: ./.github/actions/setup-rust + with: + cache-key: rust-checks-v2 + save-cache: "false" + + - name: Lint + shell: nix develop -c bash -euo pipefail {0} + run: | + cargo clippy --locked --workspace --all-targets -- -D warnings + cargo clippy --locked --manifest-path e2e/rust/Cargo.toml --all-targets -- -D warnings + cargo clippy --locked --manifest-path examples/governance-interceptor/Cargo.toml --all-targets -- -D warnings + cargo clippy --locked --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --all-targets -- -D warnings + cargo clippy --locked --manifest-path examples/isolation-backend-v8/Cargo.toml --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/testkit/Cargo.toml --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/tmachine/Cargo.toml --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/runner/Cargo.toml --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/suites/conformance/Cargo.toml --workspace --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/suites/continuity/Cargo.toml --workspace --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/suites/drivers/podman/Cargo.toml --workspace --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/suites/features/Cargo.toml --workspace --all-targets -- -D warnings + cargo clippy --locked --manifest-path tests/support/Cargo.toml --all-targets -- -D warnings + - name: Verify crypto backend independence shell: nix develop -c bash -euo pipefail {0} run: | @@ -391,7 +564,6 @@ jobs: cargo test --locked -p openshell-crypto --features openssl - name: Verify dynamic OpenSSL linkage on Linux - if: runner.os == 'Linux' shell: nix develop .#crypto -c bash -euo pipefail {0} env: OPENSSL_NO_VENDOR: "1" @@ -421,11 +593,15 @@ jobs: cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/support/Cargo.toml tasks/scripts/check-conformance-program.sh + - name: Shared sccache statistics + if: ${{ always() && env.RUSTC_WRAPPER != '' && runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + run: sccache --show-stats + rust-postgres-test: name: Rust PostgreSQL tests # Bare runner: the test script starts a disposable PostgreSQL container # with the host's Docker. - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -449,13 +625,17 @@ jobs: OPENSHELL_TELEMETRY_ENABLED: "false" run: tasks/scripts/run-postgres-tests.sh --locked --profile ci + - name: Shared sccache statistics + if: ${{ always() && env.RUSTC_WRAPPER != '' && runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + run: sccache --show-stats + rust-build-modes: name: Rust build modes (${{ matrix.system }}) strategy: fail-fast: false matrix: include: - - runner: ubuntu-24.04 + - runner: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} system: x86_64-linux - runner: ubuntu-24.04-arm system: aarch64-linux @@ -507,9 +687,13 @@ jobs: exit 1 fi + - name: Shared sccache statistics + if: ${{ always() && env.RUSTC_WRAPPER != '' && runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + run: sccache --show-stats + rust-feature-alias: name: Rust feature alias - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -530,9 +714,21 @@ jobs: tasks/scripts/verify-defaults-without-telemetry.sh git diff --exit-code HEAD -- ':(glob)**/Cargo.lock' + - name: Shared sccache statistics + if: ${{ always() && env.RUSTC_WRAPPER != '' && runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + run: sccache --show-stats + rust-gateway-core-features: - name: Rust gateway core features - runs-on: ubuntu-24.04 + name: Rust gateway core features (${{ matrix.lane }}) + strategy: + fail-fast: false + matrix: + include: + - lane: base-kubernetes + runner: openshell-ci-amd64-pd-gateway-a + - lane: docker-podman + runner: openshell-ci-amd64-pd-gateway-b + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.runner || 'ubuntu-24.04' }} timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -547,17 +743,33 @@ jobs: cache-key: rust-checks-v2 save-cache: "false" - - name: Verify core gateway compute-driver feature sets + - name: Test gateway without optional drivers + if: matrix.lane == 'base-kubernetes' shell: nix develop -c bash -euo pipefail {0} - run: | - cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features - cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features --features compute-driver-docker - cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features --features compute-driver-kubernetes - cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features --features compute-driver-podman + run: cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features + + - name: Test Kubernetes-only gateway + if: matrix.lane == 'base-kubernetes' + shell: nix develop -c bash -euo pipefail {0} + run: cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features --features compute-driver-kubernetes + + - name: Test Docker-only gateway + if: matrix.lane == 'docker-podman' + shell: nix develop -c bash -euo pipefail {0} + run: cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features --features compute-driver-docker + + - name: Test Podman-only gateway + if: matrix.lane == 'docker-podman' + shell: nix develop -c bash -euo pipefail {0} + run: cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features --features compute-driver-podman + + - name: Shared sccache statistics + if: ${{ always() && env.RUSTC_WRAPPER != '' && runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + run: sccache --show-stats rust-gateway-extended-features: name: Rust gateway extended features - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -579,12 +791,18 @@ jobs: cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features --features compute-driver-mxc cargo nextest run --locked --profile ci -p openshell-gateway --all-targets --no-default-features --features compute-driver-docker,compute-driver-vm + - name: Shared sccache statistics + if: ${{ always() && env.RUSTC_WRAPPER != '' && runner.environment == 'self-hosted' && (startsWith(runner.name, 'openshell-ci-amd64-') || startsWith(runner.name, 'openshell-ci-arm64-')) }} + run: sccache --show-stats + python: name: Python (${{ matrix.runner }}) strategy: fail-fast: false matrix: - runner: [ubuntu-24.04, ubuntu-24.04-arm] + runner: + - ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} + - ubuntu-24.04-arm runs-on: ${{ matrix.runner }} timeout-minutes: 30 container: @@ -635,7 +853,7 @@ jobs: # Merge queue runs skip this job; the PR already passed it. name: Python SDK Freeze if: github.event_name == 'pull_request' - runs-on: ubuntu-latest + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-latest' }} timeout-minutes: 5 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -662,7 +880,7 @@ jobs: markdown: name: Markdown - runs-on: ubuntu-24.04 + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-24.04' }} timeout-minutes: 30 container: image: ghcr.io/ai-openshell/openshell/ci:82e753ba3ffdfb40c118e7cb416ced7f350381d5@sha256:d816f3b4b2de675928e2ecfd26ec6b937be35fe9986542c87d440bc3de5a29de @@ -681,7 +899,7 @@ jobs: typescript-sdk-freeze: name: TypeScript SDK Freeze if: github.event_name == 'pull_request' - runs-on: ubuntu-latest + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-latest' }} timeout-minutes: 5 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -714,7 +932,7 @@ jobs: install-script: name: install.sh - runs-on: ubuntu-latest + runs-on: ${{ github.repository == 'ai-openshell/openshell' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'openshell-ci-amd64' || 'ubuntu-latest' }} timeout-minutes: 10 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/CI.md b/CI.md index cab896eefd..3fcb6a9275 100644 --- a/CI.md +++ b/CI.md @@ -6,7 +6,70 @@ For local test commands see [TESTING.md](TESTING.md). For PR conventions see [CO ## Overview -PR CI runs on standard GitHub-hosted runners. `Branch Checks` and `Helm Lint` trigger on `pull_request` and `merge_group`. Workflow runs from outside contributors wait for a maintainer to approve them in the Actions tab. +`Branch Checks` uses the `openshell-ci-amd64` GKE ARC scale set for Linux amd64 +jobs from branches in `ai-openshell/openshell`, manual runs, and merge groups. +Fork PRs use GitHub-hosted runners. ARM Linux lint/tests use the dedicated +`openshell-ci-arm64-pd-lint` and `openshell-ci-arm64-pd-test` trial scale sets; +other ARM jobs and macOS keep their hosted labels. This is a branch trial and does not change main until merged. +`Branch Checks` and `Helm Lint` trigger on `pull_request` and `merge_group`. +Workflow runs from outside contributors wait for a maintainer to approve them +in the Actions tab. + +The GKE scale set maintains five idle runners and permits twenty total. Each +runner has an isolated Docker daemon for job containers and Docker-backed tests. +Runner bootstrap provides GitHub CLI, compression utilities, and the `USER` +environment variable expected by the existing checks and Cachix. The custom +image preloads Nix shells and configures the signed Cachix substituter globally; +setup verifies that cache and skips duplicate user-level cache configuration. +Rust jobs use the shared memcached sccache backend and report cache statistics; +the standard runner jobs retain the existing GitHub Rust target/registry cache. +The x86 lint/test jobs instead use `openshell-ci-amd64-pd-lint` and +`openshell-ci-amd64-pd-test`. Each trial scale set has one worker and an exclusive +200 GiB SSD persistent disk, mounted at `/mnt/ci-cache`. Setup verifies the mount +and selects a repository/Nix-shell-specific target directory shared by that +job's Cargo commands. It skips GitHub Cargo cache restore/save entirely. +Check the initial target size and runner pod name to distinguish an empty-disk +run from a warm run on a replacement pod. Checkout and credentials remain +ephemeral; only Cargo build outputs persist. Cargo still validates artifacts, +and fresh checkout timestamps can trigger workspace rebuilds. These two lanes +serialize concurrent jobs during the trial; the ordinary scale set stays 5–20. +Inspect the job's +runner name to confirm whether it ran on GKE. Hosted ARM, macOS, and fork jobs +do not use the cluster-local cache endpoint. + +The ARM trial uses native `t2a-standard-16` Ubuntu nodes (minimum two, maximum +four), an ARM64 runner image with baked Nix shells, and separate 200 GiB SSDs +for lint/tests. Each ARM lane has one ready worker, reserves 12 CPUs for the +runner plus one for Docker, and uses the same exclusive persistent-cache setup +as x86. BuildKit is native ARM too. Compare an empty-disk run with a same-commit +warm run on replacement pods; report queue/startup separately. Full ARM test +coverage is retained, and hosted ARM labels remain the fork fallback. On native +ARM, crypto backend independence, OpenSSL backend, and dynamic-linkage checks run +after lint while workspace tests run in parallel on the test lane. Other runner +configurations retain those checks in the test job. + +Gateway core-feature checks run in two parallel matrix lanes: no-driver plus +Kubernetes in `base-kubernetes`, and Docker plus Podman in `docker-podman`. +Trusted jobs use `openshell-ci-amd64-pd-gateway-a` and +`openshell-ci-amd64-pd-gateway-b`, each with an exclusive 200 GiB SSD, eight +reserved runner CPUs, and shared memcached sccache. Fork jobs use hosted Ubuntu. +All four commands keep `--all-targets --no-default-features`; each driver is +checked independently. The matrix keeps running both lanes after a failure, +and the existing Branch Checks workflow gate requires both to succeed. +Compare the later lane completion, including queue time, against the old +sequential job; adding lane durations measures CPU cost rather than latency. + +Manual Branch Checks runs can enable `compare_linux_combined` to add one +combined lint/crypto/test job on each Linux architecture alongside the normal +parallel controls. No macOS combined job is added. All Clippy, crypto, workspace, +and independent-workspace commands are retained. Combined jobs use their own +exclusive SSDs and the same image, CPU limits, and memory settings as their +architecture's controls. During this infra trial AMD64 lint/test/combined +workers each reserve eight runner CPUs; ARM64 workers each reserve twelve. +Compare warmed runs on the same commit: parallel completion is the later +lint/test completion; combined completion is one job. Report total runner +minutes separately. The input defaults to false so ordinary PR checks do not +run duplicate suites. `pull_request` runs from forks get a read-only token and no secrets, so they cannot post statuses. `Required CI Gates` runs from the base repository (`pull_request_target` and `workflow_run`), never checks out PR code, and posts the required `OpenShell / ...` statuses on the PR head SHA. E2E suites are opt-in because they are more expensive.