-
Notifications
You must be signed in to change notification settings - Fork 36
155 lines (133 loc) · 5.8 KB
/
dep_rust.yml
File metadata and controls
155 lines (133 loc) · 5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# 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"
permissions:
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
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
# this job requires the build-guest-binaries job be complete prior to
# its execution. this dependency should be expressed in the dependent
# workflow
build:
if: ${{ inputs.docs_only == 'false' }}
strategy:
fail-fast: true
matrix:
hypervisor: [hyperv, mshv3, kvm] # hyperv is windows, mshv and kvm are linux
cpu: [amd, intel]
config: [debug, release]
wasmtime: [latest, lts]
exclude:
# Latest testing: skip Windows, Intel, and debug builds to reduce CI load
- wasmtime: latest
hypervisor: hyperv
- wasmtime: latest
cpu: intel
- wasmtime: latest
config: debug
runs-on: ${{ fromJson(
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}"]',
matrix.hypervisor == 'hyperv' && 'Windows' || 'Linux',
matrix.hypervisor == 'hyperv' && 'win2025' || matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor,
matrix.cpu)) }}
env:
# Features to pass to cargo.
# On windows hyperv do not pass any features.
# On Windows LTS builds, only add wasmtime_lts.
# On Linux, always pass the hypervisor feature (kvm/mshv3).
# On Linux LTS builds, also add wasmtime_lts.
FEATURES: ${{ matrix.hypervisor != 'hyperv' && format('{0}{1}', matrix.hypervisor, matrix.wasmtime == 'lts' && ',wasmtime_lts' || '') || (matrix.wasmtime == 'lts' && 'wasmtime_lts' || '') }}
steps:
- uses: actions/checkout@v5
- name: Hyperlight setup
uses: hyperlight-dev/ci-setup-workflow@v1.8.0
with:
rust-toolchain: "1.90"
- name: Add Nightly Rust
run: |
rustup toolchain install nightly
for target in $(rustup target list --installed); do
rustup target add $target --toolchain nightly
done
rustup target add wasm32-unknown-unknown
shell: bash
- name: Add Nightly Rust Windows
if: runner.os == 'Windows'
run: rustup component add --toolchain nightly-x86_64-pc-windows-msvc rustfmt
- name: Download Wasm Modules
uses: actions/download-artifact@v5
with:
name: guest-modules-${{ matrix.wasmtime }}
path: ./x64/${{ matrix.config }}
- name: Build Rust component model examples
run: |
# this must be build before the formatting and other jobs run
# because the component model example depends on the wasm component built here
just ensure-tools
just compile-wit
just build-rust-component-examples ${{ matrix.config }} ${{ matrix.wasmtime == 'lts' && 'wasmtime_lts' || '' }}
- name: Fmt
run: just fmt-check
- name: Clippy
run: just clippy ${{ matrix.config }}
- name: Build
run: just build ${{ matrix.config }} ${{ env.FEATURES }}
working-directory: ./src/hyperlight_wasm
- name: Build Rust Wasm examples
run: just build-rust-wasm-examples ${{ matrix.config }} ${{ matrix.wasmtime == 'lts' && 'wasmtime_lts' || '' }}
working-directory: ./src/hyperlight_wasm
- name: Test
run: just test ${{ matrix.config }} ${{ env.FEATURES }}
working-directory: ./src/hyperlight_wasm
- name: Install github-cli (Windows)
if: runner.os == 'Windows'
run: |
$ProgressPreference = 'SilentlyContinue'
# check if gh cli is installed
$installed = [bool](Get-Command -ErrorAction Ignore -Type Application gh)
if ($installed) { Write-Host "gh cli already installed"; exit 0 }
# download and install gh cli
Invoke-WebRequest https://github.com/cli/cli/releases/download/v2.68.1/gh_2.68.1_windows_amd64.msi -OutFile gh.msi
msiexec.exe /i gh.msi /quiet /l log.txt | Out-Null
Write-Host "msiexec exited with code $LASTEXITCCODE"
if ($LASTEXITCODE -ne 0) { cat log.txt; exit 1 }
shell: pwsh
- name: Test Examples
run: just examples-ci ${{ matrix.config }} ${{ env.FEATURES }}
working-directory: ./src/hyperlight_wasm
env:
# required for gh cli when downloading
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
### Benchmarks ###
- name: Download benchmarks from "latest"
run: |
just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} ${{ matrix.cpu }} dev-latest ${{ matrix.wasmtime }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
working-directory: ./src/hyperlight_wasm
if: ${{ matrix.config == 'release' }}
- name: Run benchmarks
run: |
just bench-ci dev ${{ matrix.config }} ${{ env.FEATURES }}
working-directory: ./src/hyperlight_wasm
if: ${{ matrix.config == 'release' }}