Skip to content
Draft
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ jobs:
- name: Test
run: cargo test --workspace

# The driver suites are workspaces of their own, so the commands above skip them. Their
# tests need a gateway; Driver Build and Test runs them on tmachine.
- name: Format and lint the driver suites
run: |
set -euo pipefail
for suite in tests/suites/drivers/*/; do
cargo fmt --manifest-path "${suite}Cargo.toml" --all --check
cargo clippy --locked --manifest-path "${suite}Cargo.toml" --workspace --all-targets -- -D warnings
done

workflow-lint:
name: Workflow lint
runs-on: ubuntu-latest
Expand Down
81 changes: 75 additions & 6 deletions .github/workflows/driver-build-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

# Builds the drivers as OpenShell builds its release binaries and runs OpenShell's conformance
# suite against them on its tmachine: the Docker and Podman drivers built here replace the ones
# in OpenShell's packaged gateway. Format, lint, tests and the license headers are in ci.yml.
# suite and this repository's driver suites (tests/suites/drivers) against them on its tmachine:
# the Docker and Podman drivers built here replace the ones in OpenShell's packaged gateway. Format, lint, tests and the license headers are in ci.yml.

name: Driver Build and Test

Expand Down Expand Up @@ -32,12 +32,12 @@ env:
CARGO_TERM_COLOR: always
# The OpenShell commit the conformance lane tests against: a commit with the driver launch
# protocol, which packages the drivers next to the gateway. Move it with the openshell-* git rev in Cargo.toml.
OPENSHELL_REV: ${{ inputs.openshell-rev || '9972314fa89320860e734f533e08d6994407d5fe' }}
OPENSHELL_REV: ${{ inputs.openshell-rev || '6686f2ce2110fce293399302ca90acf6f220dc39' }}
# The commit whose test-inputs bundle (ghcr.io/ai-openshell/openshell/test-inputs:<sha>) the
# lane reuses: tmachine inputs, the gateway packages and the prebuilt openshell-conformance. It is
# published for OpenShell's Release Dev runs on main and for Branch E2E runs, and does not expire.
# Keep it at OPENSHELL_REV, which must be a commit with a published bundle.
OPENSHELL_TEST_INPUTS: ${{ inputs.openshell-test-inputs || '9972314fa89320860e734f533e08d6994407d5fe' }}
OPENSHELL_TEST_INPUTS: ${{ inputs.openshell-test-inputs || '6686f2ce2110fce293399302ca90acf6f220dc39' }}

jobs:
# The binaries of this repository, built as OpenShell builds its release binaries
Expand Down Expand Up @@ -176,6 +176,64 @@ jobs:
retention-days: 2
if-no-files-found: error

# The test bundles of the driver suites in tests/suites/drivers, built once per run for the
# guest (x86_64 musl) with OpenShell's openshell-test-runner, as OpenShell's build-e2e-bundles
# job builds its own. The runner comes from OpenShell at OPENSHELL_REV and builds the suites of
# the repository it runs in, this one; tests/testkit here gives it testkit-ready.
build-suite-bundles:
name: Driver suite bundles (x86_64-unknown-linux-musl)
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ai-openshell/openshell
ref: ${{ env.OPENSHELL_REV }}
path: .openshell
persist-credentials: false

- uses: ./.github/actions/setup-nix
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Build the bundles
env:
# Every row downloads its bundle. Line tables keep backtraces readable at a third of
# the size of full debuginfo.
CARGO_PROFILE_DEV_DEBUG: line-tables-only
run: |
set -euo pipefail
# Retry dependency preparation, then build once.
nix build --no-link ./.openshell#openshell-test-runner || nix build --no-link ./.openshell#openshell-test-runner
for suite in tests/suites/drivers/*/; do
family="${suite#tests/suites/}"
family="${family%/}"
nix run ./.openshell#openshell-test-runner -- build \
--family "$family" --out "artifacts/suite-bundles/${family//\//-}"
done

- name: Upload the Docker driver suite bundle
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: driver-suite-bundle-drivers-docker-x86_64-unknown-linux-musl
path: artifacts/suite-bundles/drivers-docker
retention-days: 2
if-no-files-found: error

- name: Upload the Podman driver suite bundle
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: driver-suite-bundle-drivers-podman-x86_64-unknown-linux-musl
path: artifacts/suite-bundles/drivers-podman
retention-days: 2
if-no-files-found: error

# The suites, by family, as in OpenShell's branch-e2e.yml. Adding a family is a row in
# e2e-suites.yml and a call here. The env context is not available in `with`, so the
# revision default is repeated from OPENSHELL_REV above; keep them together.
Expand All @@ -187,12 +245,23 @@ jobs:
uses: ./.github/workflows/e2e-suites.yml
with:
family: conformance
openshell-rev: ${{ inputs.openshell-rev || '9972314fa89320860e734f533e08d6994407d5fe' }}
openshell-rev: ${{ inputs.openshell-rev || '6686f2ce2110fce293399302ca90acf6f220dc39' }}

# This repository's driver suites (tests/suites/drivers), from the bundles built above.
driver-specific-integration:
name: Driver suites
needs: [prepare-inputs, build-suite-bundles]
permissions:
contents: read
uses: ./.github/workflows/e2e-suites.yml
with:
family: drivers
openshell-rev: ${{ inputs.openshell-rev || '6686f2ce2110fce293399302ca90acf6f220dc39' }}

required:
name: Required checks
if: always()
needs: [build-binaries-linux, build-binaries-macos, conformance-integration]
needs: [build-binaries-linux, build-binaries-macos, conformance-integration, driver-specific-integration]
runs-on: ubuntu-24.04
steps:
- name: Fail unless every job succeeded
Expand Down
44 changes: 38 additions & 6 deletions .github/workflows/e2e-suites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
# gateway name the installer registers. The `family` input selects the rows of one family.
# The caller prepares the inputs once (see prepare-inputs in driver-build-test.yml) and uploads
# them as the tmachine-inputs artifact; nothing from OpenShell is built here except the
# tmachine runner.
# tmachine runner. Conformance rows run OpenShell's prebuilt openshell-conformance; the
# drivers/<driver> rows run this repository's suites from the bundles the caller built (see
# build-suite-bundles in driver-build-test.yml).

name: E2E Suites

Expand Down Expand Up @@ -53,16 +55,28 @@ jobs:
# build of it from this repository, which the packaged gateway launches. The gateway
# is the name the installer registers with the CLI (`openshell` for the packaged
# installers). Docker runs on Ubuntu with the deb, Podman on Fedora with the rpm.
# A drivers/<driver> row runs every package of its suite; the Podman suite runs once
# per user-namespace mode the environment configures (OPENSHELL_TEST_PODMAN_USERNS).
rows='[
{"driver":"docker","environment":"ubuntu-docker-rootful","installer":"deb","family":"conformance","package":"conformance","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootful","installer":"rpm","family":"conformance","package":"conformance","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootless","installer":"rpm","family":"conformance","package":"conformance","gateway":"openshell","runner":"ubuntu-24.04"}
{"driver":"podman","environment":"fedora-podman-rootless","installer":"rpm","family":"conformance","package":"conformance","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"docker","environment":"ubuntu-docker-rootful","installer":"deb","family":"drivers/docker","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootful-userns-default","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootful-userns-auto","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootful-userns-keep-id","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootful-userns-private","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootless-userns-default","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootless-userns-auto","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootless-userns-keep-id","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"},
{"driver":"podman","environment":"fedora-podman-rootless-userns-private","installer":"rpm","family":"drivers/podman","gateway":"openshell","runner":"ubuntu-24.04"}
]'
matrix=$(jq -c --arg family "${FAMILY}" '{include: map(
select($family == "" or .family == $family or (.family | startswith($family + "/")))
| .package //= ""
| .suite = (if .package == "" then .family else "\(.family)/\(.package)" end)
| .artifact = ([.driver, .suite, .environment, .installer] | join("-") | gsub("/"; "-"))
| .bundle = "driver-suite-bundle-\(.family | gsub("/"; "-"))-x86_64-unknown-linux-musl"
)}' <<< "$rows")
if [ "$(jq '.include | length' <<< "$matrix")" -eq 0 ]; then
echo "::error::No E2E suites match family '${FAMILY}'"
Expand Down Expand Up @@ -123,6 +137,13 @@ jobs:
name: tmachine-inputs
path: artifacts

- name: Download the suite bundle
if: matrix.family != 'conformance'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ matrix.bundle }}
path: artifacts/prebuilt-bundle

- name: Host diagnostics
run: |
df -h / /home/runner "$HOME/.cache" 2>/dev/null || df -h
Expand All @@ -136,6 +157,7 @@ jobs:
ENVIRONMENT: ${{ matrix.environment }}
INSTALLER: ${{ matrix.installer }}
FAMILY: ${{ matrix.family }}
PACKAGE: ${{ matrix.package }}
GATEWAY: ${{ matrix.gateway }}
run: |
# Sample the host while the suite runs, so a slow or stuck step can be explained
Expand All @@ -159,14 +181,24 @@ jobs:
trap 'kill "$sampler" 2>/dev/null || true' EXIT
# Retry dependency preparation, then run the suites once.
nix build --no-link .#openshell-test-runner || nix build --no-link .#openshell-test-runner
program=artifacts/prebuilt-conformance/openshell-conformance
chmod +x "$program"
"$program" list > /dev/null
# Conformance runs the prebuilt program; any other family its bundle, which holds the
# whole suite, narrowed to the row's package if it names one.
if [ "${FAMILY}" = "conformance" ]; then
program=artifacts/prebuilt-conformance/openshell-conformance
chmod +x "$program"
"$program" list > /dev/null
selection=(--program "$program")
else
selection=(--bundle artifacts/prebuilt-bundle)
if [ -n "${PACKAGE}" ]; then
selection+=(--package "${PACKAGE}")
fi
fi
nix run .#openshell-test-runner -- run \
--environment "${ENVIRONMENT}" \
--installer "${INSTALLER}" \
--family "${FAMILY}" \
--program "$program" \
"${selection[@]}" \
--gateway "${GATEWAY}" \
--results artifacts/test-results

Expand Down
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading