Skip to content

[test do not merge] snapshot golden tests #5

[test do not merge] snapshot golden tests

[test do not merge] snapshot golden tests #5

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Regenerate Snapshot Goldens
on:
pull_request:
types: [labeled]
permissions:
contents: read
pull-requests: read
defaults:
run:
shell: bash
jobs:
# Build guests once per config, upload as artifacts for the regen
# jobs to download. Mirrors `build-guests` in
# `ValidatePullRequest.yml`. Both debug and release simpleguest
# binaries are needed because the captured memory blob differs
# between them, so each ends up in a separate fixture cell.
build-guests:
if: github.event.label.name == 'regen-goldens'
strategy:
fail-fast: false
matrix:
config: [debug, release]
uses: ./.github/workflows/dep_build_guests.yml
secrets: inherit
with:
docs_only: "false"
config: ${{ matrix.config }}
regen:
if: github.event.label.name == 'regen-goldens'
needs: [build-guests]
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
hypervisor: ['hyperv-ws2025', mshv3, kvm]
cpu: [amd, intel]
config: [debug, release]
runs-on: ${{ fromJson(
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}", "JobId=regen-goldens-{3}-{4}-{5}-{6}-{7}"]',
matrix.hypervisor == 'hyperv-ws2025' && 'Windows' || 'Linux',
matrix.hypervisor == 'hyperv-ws2025' && 'win2025' || matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor,
matrix.cpu,
matrix.hypervisor,
matrix.config,
github.run_id,
github.run_number,
github.run_attempt)) }}
steps:
- uses: actions/checkout@v6
- uses: hyperlight-dev/ci-setup-workflow@v1.9.0
with:
rust-toolchain: "1.89"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fix cargo home permissions
if: runner.os == 'Linux'
run: |
sudo chown -R $(id -u):$(id -g) /opt/cargo || true
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "${{ runner.os }}-${{ matrix.config }}"
cache-on-failure: "true"
- name: Download Rust guests
uses: actions/download-artifact@v8
with:
name: rust-guests-${{ matrix.config }}
path: src/tests/rust_guests/bin/${{ matrix.config }}/
- name: Run regen
env:
HYPERLIGHT_REGEN_GOLDENS: "1"
run: |
cargo test --profile=${{ matrix.config == 'debug' && 'dev' || matrix.config }} \
-p hyperlight-host --lib \
sandbox::snapshot::golden_tests::golden_regen \
-- --nocapture
- name: Upload regenerated fixtures
uses: actions/upload-artifact@v4
with:
name: goldens-${{ matrix.hypervisor }}-${{ matrix.cpu }}-${{ matrix.config }}
# Restrict the glob to fixtures matching this cell's
# `{hv}_{cpu}_{config}` suffix. mshv3 maps to the `mshv`
# filename suffix, hyperv-ws2025 maps to `whp`.
path: |
src/hyperlight_host/tests/snapshot_goldens/fixtures/*_${{ matrix.hypervisor == 'mshv3' && 'mshv' || matrix.hypervisor == 'hyperv-ws2025' && 'whp' || matrix.hypervisor }}_${{ matrix.cpu }}_${{ matrix.config }}.hls
if-no-files-found: error
retention-days: 14