Skip to content

Commit 2f99aa5

Browse files
committed
Make PR Validation job more paralleslised
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent 945fada commit 2f99aa5

16 files changed

+765
-349
lines changed

.github/workflows/Benchmarks.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
workflow_call: # This is called from CreateRelease.yml
77

88
permissions:
9-
id-token: write
109
contents: read
1110

1211
jobs:
@@ -40,20 +39,14 @@ jobs:
4039
- name: Download Rust Guest Binaries
4140
uses: actions/download-artifact@v6
4241
with:
43-
name: rust-guest-binaries-release
44-
path: ./downloaded-rust-guest-binaries-release
42+
name: rust-guests-release
43+
path: src/tests/rust_guests/bin/release/
4544

4645
- name: Download C Guest Binaries
4746
uses: actions/download-artifact@v6
4847
with:
49-
name: c-guest-binaries-release
50-
path: ./downloaded-c-guest-binaries-release
51-
52-
- name: Copy Guest Binaries
53-
run: |
54-
cp ./downloaded-rust-guest-binaries-release/simpleguest ./src/tests/rust_guests/bin/release/simpleguest
55-
cp ./downloaded-rust-guest-binaries-release/dummyguest ./src/tests/rust_guests/bin/release/dummyguest
56-
cp ./downloaded-c-guest-binaries-release/simpleguest ./src/tests/c_guests/bin/release/simpleguest
48+
name: c-guests-release
49+
path: src/tests/c_guests/bin/release/
5750

5851
### Benchmarks ###
5952
- name: Fetch tags

.github/workflows/CargoPublish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ on:
1818

1919
permissions:
2020
contents: read
21-
id-token: write
2221

2322
jobs:
2423
publish-hyperlight-packages:

.github/workflows/CreateRelease.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99

1010
permissions:
1111
contents: write
12-
id-token: write
1312
issues: read
1413

1514
jobs:
@@ -64,17 +63,18 @@ jobs:
6463
- name: Build Release
6564
run: cargo build --verbose --release
6665

67-
build-guest-binaries:
68-
uses: ./.github/workflows/dep_build_guest_binaries.yml
66+
build-guests:
67+
uses: ./.github/workflows/dep_build_guests.yml
6968
secrets: inherit
7069
needs: [release-blocker-check]
70+
with:
71+
config: release
7172

7273
benchmarks:
73-
needs: [build-guest-binaries]
74+
needs: [build-guests]
7475
uses: ./.github/workflows/Benchmarks.yml
7576
secrets: inherit
7677
permissions:
77-
id-token: write
7878
contents: read
7979

8080
cargo-publish:
@@ -84,7 +84,6 @@ jobs:
8484
dry_run: false
8585
secrets: inherit
8686
permissions:
87-
id-token: write
8887
contents: read
8988

9089
publish:
@@ -140,9 +139,11 @@ jobs:
140139

141140
- name: Archive benchmarks
142141
run: |
143-
# windows
142+
# windows (hyperv = Server 2022, hyperv-ws2025 = Server 2025)
144143
tar -zcvf benchmarks_Windows_hyperv_amd.tar.gz benchmarks_Windows_hyperv_amd
145144
tar -zcvf benchmarks_Windows_hyperv_intel.tar.gz benchmarks_Windows_hyperv_intel
145+
tar -zcvf benchmarks_Windows_hyperv-ws2025_amd.tar.gz benchmarks_Windows_hyperv-ws2025_amd
146+
tar -zcvf benchmarks_Windows_hyperv-ws2025_intel.tar.gz benchmarks_Windows_hyperv-ws2025_intel
146147
# kvm
147148
tar -zcvf benchmarks_Linux_kvm_amd.tar.gz benchmarks_Linux_kvm_amd
148149
tar -zcvf benchmarks_Linux_kvm_intel.tar.gz benchmarks_Linux_kvm_intel
@@ -168,6 +169,8 @@ jobs:
168169
gh release create v${{ env.HYPERLIGHT_VERSION }} -t "Release v${{ env.HYPERLIGHT_VERSION }}" --notes-file RELEASE_NOTES.md \
169170
benchmarks_Windows_hyperv_amd.tar.gz \
170171
benchmarks_Windows_hyperv_intel.tar.gz \
172+
benchmarks_Windows_hyperv-ws2025_amd.tar.gz \
173+
benchmarks_Windows_hyperv-ws2025_intel.tar.gz \
171174
benchmarks_Linux_kvm_amd.tar.gz \
172175
benchmarks_Linux_kvm_intel.tar.gz \
173176
benchmarks_Linux_mshv3_amd.tar.gz \
@@ -184,6 +187,8 @@ jobs:
184187
gh release create dev-latest -t "Latest prerelease from main branch" --notes-file RELEASE_NOTES.md --latest=false -p \
185188
benchmarks_Windows_hyperv_amd.tar.gz \
186189
benchmarks_Windows_hyperv_intel.tar.gz \
190+
benchmarks_Windows_hyperv-ws2025_amd.tar.gz \
191+
benchmarks_Windows_hyperv-ws2025_intel.tar.gz \
187192
benchmarks_Linux_kvm_amd.tar.gz \
188193
benchmarks_Linux_kvm_intel.tar.gz \
189194
benchmarks_Linux_mshv3_amd.tar.gz \

.github/workflows/Fuzzing.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
workflow_dispatch: # Allow manual triggering
77

88
permissions:
9-
id-token: write
109
contents: read
1110

1211
jobs:

.github/workflows/RustNightly.yml

Lines changed: 102 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,118 @@ on:
99
- cron: '0 0 */2 * *'
1010

1111
permissions:
12-
id-token: write
1312
contents: read
1413

14+
env:
15+
CARGO_TERM_COLOR: always
16+
RUST_BACKTRACE: full
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
1522
jobs:
23+
# Nightly musl cross-compilation builds
24+
# This is a self-contained job since musl builds are a special case
25+
# that require TARGET_TRIPLE for cross-compilation
1626
musl:
27+
timeout-minutes: 60
1728
strategy:
1829
fail-fast: true
1930
matrix:
2031
hypervisor: [kvm, mshv3]
2132
cpu: [amd, intel]
2233
config: [debug, release]
23-
uses: ./.github/workflows/dep_rust.yml
24-
secrets: inherit
25-
with:
26-
hypervisor: ${{ matrix.hypervisor }}
27-
cpu: ${{ matrix.cpu }}
28-
config: ${{ matrix.config }}
29-
target_triple: x86_64-unknown-linux-musl
34+
runs-on: ${{ fromJson(
35+
format('["self-hosted", "Linux", "X64", "1ES.Pool=hld-{0}-{1}"]',
36+
matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor,
37+
matrix.cpu)) }}
38+
env:
39+
TARGET_TRIPLE: x86_64-unknown-linux-musl
40+
steps:
41+
- uses: actions/checkout@v6
42+
43+
- uses: hyperlight-dev/ci-setup-workflow@v1.8.0
44+
with:
45+
rust-toolchain: "1.89"
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Fix cargo home permissions
50+
run: |
51+
sudo chown -R $(id -u):$(id -g) /opt/cargo || true
52+
53+
# cargo-hyperlight builds a custom sysroot for x86_64-hyperlight-none target.
54+
# rust-cache cleans "anything not a dependency" from target dirs, removing the sysroot.
55+
# We cache sysroot separately to avoid rebuilding it (~10s) on every run.
56+
- name: Sysroot cache
57+
uses: actions/cache@v4
58+
with:
59+
path: |
60+
src/tests/rust_guests/simpleguest/target/sysroot
61+
src/tests/rust_guests/witguest/target/sysroot
62+
key: sysroot-linux-${{ matrix.config }}-${{ hashFiles('rust-toolchain.toml') }}
63+
64+
- name: Rust cache
65+
uses: Swatinem/rust-cache@v2
66+
with:
67+
shared-key: "nightly-${{ matrix.config }}"
68+
cache-on-failure: "true"
69+
workspaces: |
70+
. -> target
71+
src/tests/rust_guests/simpleguest -> target
72+
src/tests/rust_guests/dummyguest -> target
73+
src/tests/rust_guests/witguest -> target
74+
75+
- name: Build and move Rust guests
76+
run: |
77+
just build-rust-guests ${{ matrix.config }}
78+
just move-rust-guests ${{ matrix.config }}
79+
80+
- name: Build C guests
81+
run: |
82+
just build-c-guests ${{ matrix.config }}
83+
just move-c-guests ${{ matrix.config }}
84+
85+
- name: Build
86+
run: just build ${{ matrix.config }}
87+
88+
- name: Run Miri tests
89+
run: just miri-tests
90+
91+
- name: Run Rust tests
92+
run: |
93+
# with default features
94+
just test ${{ matrix.config }}
95+
96+
# with only one driver enabled
97+
just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
98+
99+
# make sure certain cargo features compile
100+
just check
101+
102+
# without any features
103+
just test-compilation-no-default-features ${{ matrix.config }}
104+
105+
- name: Run Rust examples
106+
env:
107+
RUST_LOG: debug
108+
run: just run-rust-examples-linux ${{ matrix.config }}
109+
110+
- name: Run Rust Gdb tests
111+
env:
112+
RUST_LOG: debug
113+
run: just test-rust-gdb-debugging ${{ matrix.config }}
114+
115+
- name: Run Rust Crashdump tests
116+
env:
117+
RUST_LOG: debug
118+
run: just test-rust-crashdump ${{ matrix.config }}
119+
120+
- name: Run Rust Tracing tests
121+
env:
122+
RUST_LOG: debug
123+
run: just test-rust-tracing ${{ matrix.config }}
30124

31125
notify-failure:
32126
runs-on: ubuntu-latest

.github/workflows/ValidatePullRequest.yml

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
permissions:
17-
id-token: write
1817
contents: write
1918

2019
jobs:
@@ -41,31 +40,91 @@ jobs:
4140
return all_file_count === docs_file_count;
4241
result-encoding: string
4342

44-
rust:
43+
# Build guests once, upload as artifacts for other jobs to download
44+
build-guests:
45+
needs: docs-pr
46+
strategy:
47+
fail-fast: true
48+
matrix:
49+
config: [debug, release]
50+
uses: ./.github/workflows/dep_build_guests.yml
51+
secrets: inherit
52+
with:
53+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
54+
config: ${{ matrix.config }}
55+
56+
# Code checks (fmt, clippy, MSRV) - runs in parallel with build-guests
57+
code-checks:
58+
needs: docs-pr
59+
uses: ./.github/workflows/dep_code_checks.yml
60+
secrets: inherit
61+
with:
62+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
63+
64+
# Build and test - needs guest artifacts
65+
build-test:
4566
needs:
4667
- docs-pr
68+
- build-guests
4769
strategy:
4870
fail-fast: true
4971
matrix:
5072
hypervisor: [hyperv, 'hyperv-ws2025', mshv3, kvm]
5173
cpu: [amd, intel]
5274
config: [debug, release]
53-
uses: ./.github/workflows/dep_rust.yml
75+
uses: ./.github/workflows/dep_build_test.yml
5476
secrets: inherit
5577
with:
56-
docs_only: ${{needs.docs-pr.outputs.docs-only}}
78+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
5779
hypervisor: ${{ matrix.hypervisor }}
5880
cpu: ${{ matrix.cpu }}
5981
config: ${{ matrix.config }}
6082

83+
# Run examples - needs guest artifacts, runs in parallel with build-test
84+
run-examples:
85+
needs:
86+
- docs-pr
87+
- build-guests
88+
strategy:
89+
fail-fast: true
90+
matrix:
91+
hypervisor: [hyperv, 'hyperv-ws2025', mshv3, kvm]
92+
cpu: [amd, intel]
93+
config: [debug, release]
94+
uses: ./.github/workflows/dep_run_examples.yml
95+
secrets: inherit
96+
with:
97+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
98+
hypervisor: ${{ matrix.hypervisor }}
99+
cpu: ${{ matrix.cpu }}
100+
config: ${{ matrix.config }}
101+
102+
# Run benchmarks - release only, needs guest artifacts, runs in parallel with build-test
103+
benchmarks:
104+
needs:
105+
- docs-pr
106+
- build-guests
107+
strategy:
108+
fail-fast: true
109+
matrix:
110+
hypervisor: [hyperv, 'hyperv-ws2025', mshv3, kvm]
111+
cpu: [amd, intel]
112+
uses: ./.github/workflows/dep_benchmarks.yml
113+
secrets: inherit
114+
with:
115+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
116+
hypervisor: ${{ matrix.hypervisor }}
117+
cpu: ${{ matrix.cpu }}
118+
61119
fuzzing:
62120
needs:
63121
- docs-pr
122+
- build-guests
64123
uses: ./.github/workflows/dep_fuzzing.yml
65124
with:
66125
targets: '["fuzz_host_print", "fuzz_guest_call", "fuzz_host_call", "fuzz_guest_estimate_trace_event", "fuzz_guest_trace"]' # Pass as a JSON array
67126
max_total_time: 300 # 5 minutes in seconds
68-
docs_only: ${{needs.docs-pr.outputs.docs-only}}
127+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
69128
secrets: inherit
70129

71130
spelling:
@@ -85,21 +144,20 @@ jobs:
85144
run: ./dev/check-license-headers.sh
86145

87146
# Gate PR merges on this specific "join-job" which requires all other
88-
# jobs to run first. We need this job since we cannot gate on particular jobs
89-
# in the workflow, since they can sometimes be skipped (e.g. if the PR only touches docs).
90-
# This step fixes this issue by always running.
147+
# jobs to run first.
91148
report-ci-status:
92149
needs:
93150
- docs-pr
94-
- rust
151+
- build-guests
152+
- code-checks
153+
- build-test
154+
- run-examples
155+
- benchmarks
95156
- fuzzing
96157
- spelling
97158
- license-headers
98159
if: always()
99160
runs-on: ubuntu-latest
100161
steps:
101-
# Calculate the exit status of the whole CI workflow.
102-
# If all dependent jobs were successful, this exits with 0 (and the outcome job continues successfully).
103-
# If a some dependent job has failed, this exits with 1.
104162
- name: calculate the correct exit status
105163
run: jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'

0 commit comments

Comments
 (0)