Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/branch-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,26 @@ jobs:
OPENSHELL_TELEMETRY_ENABLED: "false"
run: |
cargo nextest run --profile ci --workspace --features openshell-server/test-support
cargo nextest run --config-file .config/nextest.toml --profile ci --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml

- name: Verify standalone policy prover package
if: matrix.system == 'x86_64-linux'
env:
CARGO_NET_OFFLINE: "true"
run: |
cargo test --locked -p openshell-prover-cli
cargo build --locked --release -p openshell-prover-cli --bin openshell-prover
cargo tree --locked -p openshell-prover-cli --edges normal --prefix none > /tmp/openshell-prover-dependencies.txt
if grep -Eq '^(openshell-(cli|server|sdk|bootstrap|tui|providers|core|policy)) v' /tmp/openshell-prover-dependencies.txt; then
echo "ERROR: standalone prover includes an OpenShell control-plane dependency" >&2
cat /tmp/openshell-prover-dependencies.txt >&2
exit 1
fi
target/release/openshell-prover check \
crates/openshell-prover-cli/tests/fixtures/candidate-contained.yaml \
--boundary crates/openshell-prover-cli/tests/fixtures/boundary.yaml \
--output json > /tmp/openshell-prover-result.json
grep -q '"result"[[:space:]]*:[[:space:]]*"within_boundary"' /tmp/openshell-prover-result.json

- name: Verify telemetry can be compiled out
run: |
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@ jobs:
timeout-minutes: 60
steps: *build_steps

prover:
name: openshell-prover (${{ matrix.triple }})
env:
PACKAGE: openshell-prover-cli
BINARY: openshell-prover
strategy:
matrix:
include:
- triple: x86_64-unknown-linux-musl
runner: linux-amd64-cpu8
- triple: aarch64-unknown-linux-musl
runner: linux-arm64-cpu8
- triple: aarch64-apple-darwin
runner: macos-15-xlarge
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
steps: *build_steps

gateway:
name: openshell-gateway (${{ matrix.triple }})
env:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ on:
gateway-target:
required: true
type: string
prover-target:
required: true
type: string
rpm-version:
required: false
type: string
Expand Down Expand Up @@ -81,10 +84,16 @@ jobs:
name: openshell-gateway-${{ inputs.gateway-target }}
path: package-binaries/

- name: Download prover artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-prover-${{ inputs.prover-target }}
path: package-binaries/

- name: Configure package inputs
run: |
set -euo pipefail
chmod +x package-binaries/openshell{,-gateway}
chmod +x package-binaries/openshell{,-gateway,-prover}
ls -lah package-binaries

- name: Mark workspace safe for git
Expand Down
248 changes: 92 additions & 156 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,150 +4,106 @@
name: Conformance

on:
workflow_dispatch: {}

permissions: {}
workflow_call:
inputs:
scenarios:
description: JSON array of tmachine scenarios to run
required: true
type: string
testsuites:
description: JSON array of tmachine test suites to run
required: true
type: string

permissions:
actions: read
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-conformance-${{ github.ref }}
cancel-in-progress: true

jobs:
pr_metadata:
name: Resolve PR metadata
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
should_run: ${{ steps.gate.outputs.should_run }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: gate
uses: ./.github/actions/pr-gate

version:
needs: pr_metadata
if: needs.pr_metadata.outputs.should_run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
outputs:
cargo: ${{ steps.version.outputs.cargo }}
rpm_version: ${{ steps.version.outputs.rpm_version }}
rpm_release: ${{ steps.version.outputs.rpm_release }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Compute versions
id: version
run: |
cargo="$(python3 tasks/scripts/release.py get-version --cargo)"
rpm_version="$(python3 tasks/scripts/release.py get-version --rpm-version)"
rpm_release="$(python3 tasks/scripts/release.py get-version --rpm-release)"
{
echo "cargo=$cargo"
echo "rpm_version=$rpm_version"
echo "rpm_release=$rpm_release"
} >> "$GITHUB_OUTPUT"

build-cli:
needs: version
runs-on: linux-amd64-cpu8
timeout-minutes: 60
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ github.sha }}
- uses: ./.github/actions/setup-nix
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- uses: ./.github/actions/build-rust-binary
with:
package: openshell-cli
binary: openshell
triple: x86_64-unknown-linux-musl
cargo-version: ${{ needs.version.outputs.cargo }}

build-conformance:
needs: version
runs-on: linux-amd64-cpu8
timeout-minutes: 60
permissions:
contents: read
prepare:
name: Prepare conformance inputs
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ github.sha }}

- uses: ./.github/actions/setup-nix

- name: Download CLI artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- uses: ./.github/actions/build-rust-binary
name: openshell-x86_64-unknown-linux-musl
path: artifacts/binaries/x86_64-unknown-linux-musl

- name: Download gateway artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
package: openshell-conformance-cli
binary: openshell-conformance
triple: x86_64-unknown-linux-musl
cargo-version: ${{ needs.version.outputs.cargo }}

build-gateway:
needs: version
runs-on: linux-amd64-cpu8
timeout-minutes: 60
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
name: openshell-gateway-x86_64-unknown-linux-gnu
path: artifacts/binaries/x86_64-unknown-linux-gnu

- name: Download sandbox image artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
persist-credentials: false
ref: ${{ github.sha }}
- uses: ./.github/actions/setup-nix
name: image-sandbox
path: image-input/sandbox

- name: Download supervisor image artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- uses: ./.github/actions/build-rust-binary
name: image-supervisor
path: image-input/supervisor

- name: Convert runtime images
shell: nix develop .#testing -c bash -euo pipefail {0}
run: |
mkdir -p artifacts/images

skopeo copy \
--override-os linux \
--override-arch amd64 \
oci-archive:image-input/sandbox/images/sandbox.tar \
docker-archive:artifacts/images/openshell-sandbox-tmachine.tar:openshell/sandbox:tmachine

skopeo copy \
--override-os linux \
--override-arch amd64 \
oci-archive:image-input/supervisor/images/supervisor.tar \
docker-archive:artifacts/images/openshell-supervisor-tmachine.tar:openshell/supervisor:tmachine

- name: Build conformance test archive
run: nix run .#build-artifacts-test-archives

- name: Upload conformance inputs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
package: openshell-gateway
binary: openshell-gateway
triple: x86_64-unknown-linux-gnu
cargo-version: ${{ needs.version.outputs.cargo }}
supervisor-image-tag: dev

build-rpm:
needs: [version, build-cli, build-gateway]
permissions:
contents: read
uses: ./.github/workflows/build-rpm.yml
with:
checkout-ref: ${{ github.sha }}
arch: x86_64
runner: linux-amd64-cpu8
cli-target: x86_64-unknown-linux-musl
gateway-target: x86_64-unknown-linux-gnu
cargo-version: ${{ needs.version.outputs.cargo }}
rpm-version: ${{ needs.version.outputs.rpm_version }}
rpm-release: ${{ needs.version.outputs.rpm_release }}

fedora:
name: Fedora with Rootless Podman
needs: [build-conformance, build-rpm]
name: openshell-conformance-inputs
path: artifacts
compression-level: 0
retention-days: 5
if-no-files-found: error

conformance:
name: Conformance (${{ matrix.scenario }}, ${{ matrix.testsuite }})
needs: prepare
strategy:
fail-fast: false
matrix:
scenario: ${{ fromJSON(inputs.scenarios) }}
testsuite: ${{ fromJSON(inputs.testsuites) }}
runs-on: ubuntu-24.04
timeout-minutes: 45
permissions:
actions: read
contents: read
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ github.sha }}

- name: Enable KVM access
run: |
Expand All @@ -162,40 +118,20 @@ jobs:

- uses: ./.github/actions/setup-nix

- name: Download RPM artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- name: Cache tmachine disks
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
name: rpm-linux-x86_64
path: rpm-input
path: ~/.cache/tmachine
key: tmachine-${{ runner.os }}-${{ runner.arch }}

- name: Download conformance CLI
- name: Download conformance inputs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-conformance-x86_64-unknown-linux-musl
path: conformance-input

- name: Run RPM smoke conformance
shell: bash
run: |
set -euo pipefail
chmod +x conformance-input/openshell-conformance
shopt -s nullglob
candidate_cli_package=(rpm-input/openshell-[0-9]*.rpm)
candidate_gateway_package=(rpm-input/openshell-gateway-[0-9]*.rpm)
if [[ ${#candidate_cli_package[@]} -ne 1 || ${#candidate_gateway_package[@]} -ne 1 ]]; then
echo "expected one candidate CLI and gateway RPM" >&2
printf 'RPM artifacts:\n' >&2
printf ' %s\n' rpm-input/* >&2
exit 1
fi

OPENSHELL_TEST_GUEST_CACHE_DISABLE=1 nix run .#test-guest -- \
--distro fedora \
--with podman-rootless \
--with selinux \
--install "${candidate_cli_package[0]}" \
--install "${candidate_gateway_package[0]}" \
--copy conformance-input/openshell-conformance:/tmp/openshell-conformance \
--provision openshell-rpm \
--provision gateway-podman \
-- /tmp/openshell-conformance run smoke
name: openshell-conformance-inputs
path: artifacts

- name: Run conformance
env:
SCENARIO: ${{ matrix.scenario }}
TESTSUITE: ${{ matrix.testsuite }}
run: nix run .#tmachine -- test "${SCENARIO}" "${TESTSUITE}"
9 changes: 8 additions & 1 deletion .github/workflows/deb-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ jobs:
name: openshell-gateway-${{ matrix.gnu_target }}
path: package-binaries/

- name: Download prover artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-prover-${{ matrix.cli_target }}
path: package-binaries/

- name: Download VM driver artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
Expand All @@ -67,14 +73,15 @@ jobs:
- name: Configure package inputs
run: |
set -euo pipefail
chmod +x package-binaries/openshell{,-gateway,-driver-vm}
chmod +x package-binaries/openshell{,-gateway,-prover,-driver-vm}
ls -lah package-binaries

- name: Build Debian package
run: |
set -euo pipefail
OPENSHELL_CLI_BINARY="${PWD}/package-binaries/openshell" \
OPENSHELL_GATEWAY_BINARY="${PWD}/package-binaries/openshell-gateway" \
OPENSHELL_PROVER_BINARY="${PWD}/package-binaries/openshell-prover" \
OPENSHELL_DRIVER_VM_BINARY="${PWD}/package-binaries/openshell-driver-vm" \
OPENSHELL_DEB_VERSION="${INPUTS_DEB_VERSION}" \
OPENSHELL_DEB_ARCH="${{ matrix.deb_arch }}" \
Expand Down
Loading
Loading