|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +# Runs testkit suites in tmachine environments on CI. Each matrix row names a |
| 5 | +# tmachine environment and installer, the family (a workspace under |
| 6 | +# tests/suites/) and the package in it, and the runner label for the |
| 7 | +# environment's architecture. `openshell-test-runner` builds the tests, boots |
| 8 | +# the environment, runs them inside it and checks the results. |
| 9 | +# |
| 10 | +# Modeled on the E2E Suites workflow in NVIDIA/OpenShell#4629 by Evan Lezar. |
| 11 | + |
| 12 | +name: E2E Suites |
| 13 | + |
| 14 | +on: |
| 15 | + workflow_call: |
| 16 | + inputs: |
| 17 | + source-sha: |
| 18 | + description: Source revision of the prepared candidate artifacts |
| 19 | + required: true |
| 20 | + type: string |
| 21 | + integration-inputs-artifact-id: |
| 22 | + description: Immutable ID of the prepared integration inputs artifact |
| 23 | + required: true |
| 24 | + type: string |
| 25 | + |
| 26 | +permissions: |
| 27 | + actions: read |
| 28 | + contents: read |
| 29 | + packages: read |
| 30 | + |
| 31 | +# github.workflow is the caller's name here, so scope the group to this |
| 32 | +# workflow to avoid colliding with (and cancelling) the caller's other jobs. |
| 33 | +concurrency: |
| 34 | + group: ${{ github.workflow }}-e2e-suites-${{ github.ref }} |
| 35 | + cancel-in-progress: true |
| 36 | + |
| 37 | +jobs: |
| 38 | + suites: |
| 39 | + name: E2E suites (${{ matrix.family }}/${{ matrix.package }}, ${{ matrix.environment }}, ${{ matrix.installer }}) |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + include: |
| 44 | + # Only amd64 for now: CI has no arm64 runner with KVM for tmachine, |
| 45 | + # and the caller only builds amd64 inputs. |
| 46 | + - environment: ubuntu-docker-rootful |
| 47 | + installer: deb |
| 48 | + family: conformance |
| 49 | + package: sandbox |
| 50 | + runner: ubuntu-24.04 |
| 51 | + runs-on: ${{ matrix.runner }} |
| 52 | + timeout-minutes: 90 |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 55 | + with: |
| 56 | + ref: ${{ inputs['source-sha'] }} |
| 57 | + persist-credentials: false |
| 58 | + |
| 59 | + - name: Enable KVM access |
| 60 | + run: | |
| 61 | + set -euo pipefail |
| 62 | + if [[ ! -c /dev/kvm ]]; then |
| 63 | + echo "::error::The runner did not expose /dev/kvm" |
| 64 | + exit 1 |
| 65 | + fi |
| 66 | + sudo chmod 0666 /dev/kvm |
| 67 | + exec 3<>/dev/kvm |
| 68 | + exec 3>&- |
| 69 | +
|
| 70 | + - uses: ./.github/actions/setup-nix |
| 71 | + |
| 72 | + - name: Cache tmachine disks |
| 73 | + uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0 |
| 74 | + with: |
| 75 | + path: ~/.cache/tmachine |
| 76 | + # tmachine keys its disk layers on a hash of the Ansible tree. |
| 77 | + # actions/cache doesn't save after an exact key hit, so a fixed key |
| 78 | + # would rebuild the changed layers on every run. Key on the playbooks |
| 79 | + # and fall back to the newest entry for the same runner. |
| 80 | + key: tmachine-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('tests/tmachine/ansible/**', 'tests/tmachine/images.nix') }} |
| 81 | + restore-keys: | |
| 82 | + tmachine-${{ runner.os }}-${{ runner.arch }}- |
| 83 | +
|
| 84 | + - name: Download integration inputs |
| 85 | + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 86 | + with: |
| 87 | + artifact-ids: ${{ inputs['integration-inputs-artifact-id'] }} |
| 88 | + path: artifacts |
| 89 | + |
| 90 | + - name: Run the suites in this environment |
| 91 | + env: |
| 92 | + ENVIRONMENT: ${{ matrix.environment }} |
| 93 | + INSTALLER: ${{ matrix.installer }} |
| 94 | + FAMILY: ${{ matrix.family }} |
| 95 | + PACKAGE: ${{ matrix.package }} |
| 96 | + run: | |
| 97 | + # Retry dependency preparation, then run the suites once. The runner |
| 98 | + # builds the suites for the guest, so it needs no prepared archives. |
| 99 | + nix build --no-link .#openshell-test-runner || nix build --no-link .#openshell-test-runner |
| 100 | + nix run .#openshell-test-runner -- \ |
| 101 | + --environment "${ENVIRONMENT}" \ |
| 102 | + --installer "${INSTALLER}" \ |
| 103 | + --family "${FAMILY}" \ |
| 104 | + --package "${PACKAGE}" \ |
| 105 | + --results artifacts/test-results |
| 106 | +
|
| 107 | + # The results directory holds the JUnit report (junit.xml), the nextest |
| 108 | + # log, and the guest's diagnostics when the run failed. |
| 109 | + - name: Upload results |
| 110 | + if: always() |
| 111 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
| 112 | + with: |
| 113 | + name: e2e-results-${{ matrix.family }}-${{ matrix.package }}-${{ matrix.environment }}-${{ matrix.installer }} |
| 114 | + path: artifacts/test-results |
| 115 | + if-no-files-found: ignore |
| 116 | + retention-days: 7 |
| 117 | + |
| 118 | + result: |
| 119 | + name: E2E suites result |
| 120 | + needs: [suites] |
| 121 | + if: always() |
| 122 | + runs-on: ubuntu-24.04 |
| 123 | + steps: |
| 124 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 125 | + with: |
| 126 | + persist-credentials: false |
| 127 | + - uses: ./.github/actions/check-job-results |
| 128 | + with: |
| 129 | + results: ${{ toJSON(needs) }} |
0 commit comments