Skip to content

Commit 164961f

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

11 files changed

Lines changed: 597 additions & 312 deletions

.github/workflows/Benchmarks.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,14 @@ jobs:
4040
- name: Download Rust Guest Binaries
4141
uses: actions/download-artifact@v6
4242
with:
43-
name: rust-guest-binaries-release
44-
path: ./downloaded-rust-guest-binaries-release
43+
name: rust-guests-release
44+
path: src/tests/rust_guests/bin/release/
4545

4646
- name: Download C Guest Binaries
4747
uses: actions/download-artifact@v6
4848
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
49+
name: c-guests-release
50+
path: src/tests/c_guests/bin/release/
5751

5852
### Benchmarks ###
5953
- name: Fetch tags

.github/workflows/CreateRelease.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ jobs:
6464
- name: Build Release
6565
run: cargo build --verbose --release
6666

67-
build-guest-binaries:
68-
uses: ./.github/workflows/dep_build_guest_binaries.yml
67+
build-guests:
68+
uses: ./.github/workflows/dep_build_guests.yml
6969
secrets: inherit
7070
needs: [release-blocker-check]
7171

7272
benchmarks:
73-
needs: [build-guest-binaries]
73+
needs: [build-guests]
7474
uses: ./.github/workflows/Benchmarks.yml
7575
secrets: inherit
7676
permissions:

.github/workflows/RustNightly.yml

Lines changed: 81 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,95 @@ permissions:
1212
id-token: write
1313
contents: read
1414

15+
env:
16+
CARGO_TERM_COLOR: always
17+
RUST_BACKTRACE: full
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
1523
jobs:
24+
# Nightly musl cross-compilation builds
25+
# This is a self-contained job since musl builds are a special case
26+
# that require TARGET_TRIPLE for cross-compilation
1627
musl:
28+
timeout-minutes: 60
1729
strategy:
1830
fail-fast: true
1931
matrix:
2032
hypervisor: [kvm, mshv3]
2133
cpu: [amd, intel]
2234
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
35+
runs-on: ${{ fromJson(
36+
format('["self-hosted", "Linux", "X64", "1ES.Pool=hld-{0}-{1}"]',
37+
matrix.hypervisor == 'mshv3' && 'azlinux3-mshv' || matrix.hypervisor,
38+
matrix.cpu)) }}
39+
env:
40+
TARGET_TRIPLE: x86_64-unknown-linux-musl
41+
steps:
42+
- uses: actions/checkout@v6
43+
44+
- name: Set up nightly rust
45+
uses: dtolnay/rust-toolchain@nightly
46+
with:
47+
components: rustfmt
48+
49+
- uses: hyperlight-dev/ci-setup-workflow@v1.8.0
50+
with:
51+
rust-toolchain: "1.89"
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Build and move Rust guests
56+
run: |
57+
just build-rust-guests ${{ matrix.config }}
58+
just move-rust-guests ${{ matrix.config }}
59+
60+
- name: Build C guests
61+
run: |
62+
just build-c-guests ${{ matrix.config }}
63+
just move-c-guests ${{ matrix.config }}
64+
65+
- name: Build
66+
run: just build ${{ matrix.config }}
67+
68+
- name: Run Miri tests
69+
run: just miri-tests
70+
71+
- name: Run Rust tests
72+
run: |
73+
# with default features
74+
just test ${{ matrix.config }}
75+
76+
# with only one driver enabled
77+
just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || 'kvm' }}
78+
79+
# make sure certain cargo features compile
80+
just check
81+
82+
# without any features
83+
just test-compilation-no-default-features ${{ matrix.config }}
84+
85+
- name: Run Rust examples
86+
env:
87+
RUST_LOG: debug
88+
run: just run-rust-examples-linux ${{ matrix.config }}
89+
90+
- name: Run Rust Gdb tests
91+
env:
92+
RUST_LOG: debug
93+
run: just test-rust-gdb-debugging ${{ matrix.config }}
94+
95+
- name: Run Rust Crashdump tests
96+
env:
97+
RUST_LOG: debug
98+
run: just test-rust-crashdump ${{ matrix.config }}
99+
100+
- name: Run Rust Tracing tests
101+
env:
102+
RUST_LOG: debug
103+
run: just test-rust-tracing ${{ matrix.config }}
30104

31105
notify-failure:
32106
runs-on: ubuntu-latest

.github/workflows/ValidatePullRequest.yml

Lines changed: 66 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,85 @@ jobs:
4141
return all_file_count === docs_file_count;
4242
result-encoding: string
4343

44-
rust:
44+
# Build guests once, upload as artifacts for other jobs to download
45+
build-guests:
46+
needs: docs-pr
47+
uses: ./.github/workflows/dep_build_guests.yml
48+
secrets: inherit
49+
with:
50+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
51+
52+
# Code checks (fmt, clippy, MSRV) - runs in parallel with build-guests
53+
code-checks:
54+
needs: docs-pr
55+
uses: ./.github/workflows/dep_code_checks.yml
56+
secrets: inherit
57+
with:
58+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
59+
60+
# Build and test - needs guest artifacts
61+
build-test:
62+
needs:
63+
- docs-pr
64+
- build-guests
65+
strategy:
66+
fail-fast: true
67+
matrix:
68+
hypervisor: [hyperv, 'hyperv-ws2025', mshv3, kvm]
69+
cpu: [amd, intel]
70+
config: [debug, release]
71+
uses: ./.github/workflows/dep_build_test.yml
72+
secrets: inherit
73+
with:
74+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
75+
hypervisor: ${{ matrix.hypervisor }}
76+
cpu: ${{ matrix.cpu }}
77+
config: ${{ matrix.config }}
78+
79+
# Run examples - needs guest artifacts, runs in parallel with build-test
80+
run-examples:
4581
needs:
4682
- docs-pr
83+
- build-guests
4784
strategy:
4885
fail-fast: true
4986
matrix:
5087
hypervisor: [hyperv, 'hyperv-ws2025', mshv3, kvm]
5188
cpu: [amd, intel]
5289
config: [debug, release]
53-
uses: ./.github/workflows/dep_rust.yml
90+
uses: ./.github/workflows/dep_run_examples.yml
5491
secrets: inherit
5592
with:
56-
docs_only: ${{needs.docs-pr.outputs.docs-only}}
93+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
5794
hypervisor: ${{ matrix.hypervisor }}
5895
cpu: ${{ matrix.cpu }}
5996
config: ${{ matrix.config }}
6097

98+
# Run benchmarks - release only, needs guest artifacts, runs in parallel with build-test
99+
benchmarks:
100+
needs:
101+
- docs-pr
102+
- build-guests
103+
strategy:
104+
fail-fast: true
105+
matrix:
106+
hypervisor: [hyperv, 'hyperv-ws2025', mshv3, kvm]
107+
cpu: [amd, intel]
108+
uses: ./.github/workflows/dep_benchmarks.yml
109+
secrets: inherit
110+
with:
111+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
112+
hypervisor: ${{ matrix.hypervisor }}
113+
cpu: ${{ matrix.cpu }}
114+
61115
fuzzing:
62116
needs:
63117
- docs-pr
64118
uses: ./.github/workflows/dep_fuzzing.yml
65119
with:
66-
targets: '["fuzz_host_print", "fuzz_guest_call", "fuzz_host_call", "fuzz_guest_estimate_trace_event", "fuzz_guest_trace"]' # Pass as a JSON array
67-
max_total_time: 300 # 5 minutes in seconds
68-
docs_only: ${{needs.docs-pr.outputs.docs-only}}
120+
targets: '["fuzz_host_print", "fuzz_guest_call", "fuzz_host_call", "fuzz_guest_estimate_trace_event", "fuzz_guest_trace"]'
121+
max_total_time: 300
122+
docs_only: ${{ needs.docs-pr.outputs.docs-only }}
69123
secrets: inherit
70124

71125
spelling:
@@ -85,21 +139,20 @@ jobs:
85139
run: ./dev/check-license-headers.sh
86140

87141
# 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.
142+
# jobs to run first.
91143
report-ci-status:
92144
needs:
93145
- docs-pr
94-
- rust
146+
- build-guests
147+
- code-checks
148+
- build-test
149+
- run-examples
150+
- benchmarks
95151
- fuzzing
96152
- spelling
97153
- license-headers
98154
if: always()
99155
runs-on: ubuntu-latest
100156
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.
104157
- name: calculate the correct exit status
105158
run: jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: Run Benchmarks
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
docs_only:
9+
description: Skip building if docs only
10+
required: false
11+
type: string
12+
default: "false"
13+
hypervisor:
14+
description: Hypervisor for this run (passed from caller matrix)
15+
required: false
16+
type: string
17+
default: "kvm"
18+
cpu:
19+
description: CPU architecture for the build (passed from caller matrix)
20+
required: false
21+
type: string
22+
default: "amd"
23+
24+
env:
25+
CARGO_TERM_COLOR: always
26+
RUST_BACKTRACE: full
27+
28+
permissions:
29+
id-token: write
30+
contents: read
31+
32+
defaults:
33+
run:
34+
shell: bash
35+
36+
jobs:
37+
run-benchmarks:
38+
if: ${{ inputs.docs_only == 'false' }}
39+
timeout-minutes: 30
40+
runs-on: ${{ fromJson(
41+
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}"]',
42+
(inputs.hypervisor == 'hyperv' || inputs.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux',
43+
inputs.hypervisor == 'hyperv' && 'win2022' || inputs.hypervisor == 'hyperv-ws2025' && 'win2025' || inputs.hypervisor == 'mshv3' && 'azlinux3-mshv' || inputs.hypervisor,
44+
inputs.cpu)) }}
45+
steps:
46+
- uses: actions/checkout@v6
47+
48+
- name: Set up nightly rust
49+
uses: dtolnay/rust-toolchain@nightly
50+
with:
51+
components: rustfmt
52+
53+
- uses: hyperlight-dev/ci-setup-workflow@v1.8.0
54+
with:
55+
rust-toolchain: "1.89"
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Download Rust guests
60+
uses: actions/download-artifact@v6
61+
with:
62+
name: rust-guests-release
63+
path: src/tests/rust_guests/bin/release/
64+
65+
- name: Download C guests
66+
uses: actions/download-artifact@v6
67+
with:
68+
name: c-guests-release
69+
path: src/tests/c_guests/bin/release/
70+
71+
- name: Build
72+
run: just build release
73+
74+
- name: Download benchmarks from "latest"
75+
run: just bench-download ${{ runner.os }} ${{ inputs.hypervisor }} ${{ inputs.cpu }} dev-latest
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
continue-on-error: true
79+
80+
- name: Run benchmarks
81+
run: just bench-ci main

0 commit comments

Comments
 (0)