Files
OpenShell/.github/workflows/conformance.yml

138 lines
4.3 KiB
YAML

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Conformance
on:
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 }}-conformance-${{ github.ref }}
cancel-in-progress: true
jobs:
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:
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:
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:
name: image-sandbox
path: image-input/sandbox
- name: Download supervisor image artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
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:
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: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: ${{ github.sha }}
- name: Enable KVM access
run: |
set -euo pipefail
if [[ ! -c /dev/kvm ]]; then
echo "::error::The runner did not expose /dev/kvm"
exit 1
fi
sudo chmod 0666 /dev/kvm
exec 3<>/dev/kvm
exec 3>&-
- uses: ./.github/actions/setup-nix
- name: Cache tmachine disks
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/tmachine
key: tmachine-${{ runner.os }}-${{ runner.arch }}
- name: Download conformance inputs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-conformance-inputs
path: artifacts
- name: Run conformance
env:
SCENARIO: ${{ matrix.scenario }}
TESTSUITE: ${{ matrix.testsuite }}
run: nix run .#tmachine -- test "${SCENARIO}" "${TESTSUITE}"