Add a periodic job for building and test musl #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
| name: Rust Tests and Lints | ||
| # See README.md in this directory for more information about workflow_call | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| docs_only: | ||
| description: Skip building if docs only | ||
| required: false | ||
| type: string | ||
| default: "false" | ||
| target_triple: | ||
| description: Target triple for cross-compilation | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| hypervisor: | ||
| description: Hypervisor for this run (passed from caller matrix) | ||
| required: false | ||
| type: string | ||
| default: "kvm" | ||
| config: | ||
| description: Build configuration for this run (passed from caller matrix) | ||
| required: false | ||
| type: string | ||
| default: "debug" | ||
| cpu: | ||
| description: CPU architecture for the build (passed from caller matrix) | ||
| required: false | ||
| type: string | ||
| default: "amd" | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_BACKTRACE: full | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| # The reason for default shell bash is because on our self-hosted windows runners, | ||
| # the default shell is powershell, which doesn't work correctly together with `just` commands. | ||
| # Even if a command inside a just-recipe fails, github reports the step as successful. | ||
| # The problem may or may not be related to our custom windows runner not applying the | ||
| # powershell steps outlined here | ||
| # https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| jobs: | ||
| code-checks: | ||
| if: ${{ inputs.docs_only == 'false' && (inputs.hypervisor == 'hyperv-ws2025' || inputs.hypervisor == 'kvm') }} | ||
| timeout-minutes: 60 | ||
| runs-on: ${{ fromJson( | ||
| format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd"]', | ||
| (inputs.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux', | ||
| inputs.hypervisor == 'hyperv-ws2025' && 'win2025' || 'kvm')) }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: hyperlight-dev/[email protected] | ||
| with: | ||
| rust-toolchain: "1.86" | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| # Does not check for updated Cargo.lock files for test rust guests as this causes an issue with this checkwhen deoendabot updates dependencies in common crates | ||
| - name: Ensure up-to-date Cargo.lock | ||
| run: | | ||
| cargo fetch --locked | ||
| - name: fmt | ||
| run: just fmt-check | ||
| - name: clippy | ||
| if: ${{ (runner.os == 'Windows' )}} | ||
| run: | | ||
| just clippy ${{ inputs.config }} | ||
| just clippy-guests ${{ inputs.config }} | ||
| env: | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| - name: clippy exhaustive check | ||
| if: ${{ (runner.os == 'Linux' )}} | ||
| run: | | ||
| just clippy-exhaustive ${{ inputs.config }} | ||
| env: | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| - name: Verify MSRV | ||
| run: ./dev/verify-msrv.sh hyperlight-host hyperlight-guest hyperlight-guest-bin hyperlight-common | ||
| build: | ||
| if: ${{ inputs.docs_only == 'false' }} | ||
| timeout-minutes: 60 | ||
| runs-on: ${{ fromJson( | ||
| format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}"]', | ||
| (inputs.hypervisor == 'hyperv' || inputs.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux', | ||
| inputs.hypervisor == 'hyperv' && 'win2022' || inputs.hypervisor == 'hyperv-ws2025' && 'win2025' || inputs.hypervisor == 'mshv3' && 'azlinux3-mshv' || inputs.hypervisor, | ||
| inputs.cpu)) }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| # For rust-fmt | ||
| - name: Set up nightly rust | ||
| uses: dtolnay/rust-toolchain@nightly | ||
| with: | ||
| components: rustfmt | ||
| - uses: hyperlight-dev/[email protected] | ||
| with: | ||
| rust-toolchain: "1.86" | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Get gh action service name | ||
| if: ${{ (runner.os == 'Windows' )}} | ||
| run: (Get-Service actions.runner.*) | Foreach { $_.Name, $_.UserName, $_.ServiceType } | ||
| shell: pwsh | ||
| - name: Build and move Rust guests | ||
| run: | | ||
| # use these commands in favor of build-and-move-rust-guests to avoid building both configs | ||
| just build-rust-guests ${{ inputs.config }} | ||
| just move-rust-guests ${{ inputs.config }} | ||
| - name: Build c guests | ||
| run: | | ||
| # use these commands in favor of build-and-move-c-guests to avoid building both configs | ||
| just build-c-guests ${{ inputs.config }} | ||
| just move-c-guests ${{ inputs.config }} | ||
| - name: Build | ||
| run: just build ${{ inputs.config }} | ||
| env: | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| - name: Run Rust tests | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| run: | | ||
| # with default features | ||
| just test ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} | ||
| # with only one driver enabled (driver mshv/kvm feature is ignored on windows) + seccomp | ||
| just test ${{ inputs.config }} seccomp,${{ inputs.hypervisor == 'mshv' && 'mshv2' || inputs.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }} | ||
| # make sure certain cargo features compile | ||
| just check | ||
| # without any features | ||
| just test-compilation-no-default-features ${{ inputs.config }} | ||
| env: | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| # One of the examples is flaky on Windows GH runners, so this allows us to disable it for now | ||
| - name: Run Rust examples - windows | ||
| if: ${{ (runner.os == 'Windows') }} | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_LOG: debug | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| run: just run-rust-examples ${{ inputs.config }} | ||
| - name: Run Rust examples - linux | ||
| if: false | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_LOG: debug | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| run: just run-rust-examples-linux ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} | ||
| - name: Run Rust Gdb tests - linux | ||
| if: runner.os == 'Linux' | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_LOG: debug | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| run: just test-rust-gdb-debugging ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} | ||
| - name: Run Rust Crashdump tests | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_LOG: debug | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| run: just test-rust-crashdump ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} | ||
| - name: Run Rust Tracing tests - linux | ||
| if: runner.os == 'Linux' | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_LOG: debug | ||
| TARGET_TRIPLE: ${{ inputs.target_triple }} | ||
| run: just test-rust-tracing ${{ inputs.config }} ${{ inputs.hypervisor == 'mshv' && 'mshv2' || '""'}} | ||
| - name: Download benchmarks from "latest" | ||
| run: just bench-download ${{ runner.os }} ${{ inputs.hypervisor }} ${{ inputs.cpu}} dev-latest # compare to prerelease | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| continue-on-error: true | ||
| if: ${{ inputs.config == 'release' && inputs.target_triple == '' }} | ||
| - name: Run benchmarks | ||
| run: | | ||
| just bench-ci main ${{ inputs.hypervisor == 'mshv' && 'mshv2' || ''}} | ||
| if: ${{ inputs.config == 'release' && inputs.target_triple == '' }} | ||