Skip to content

Commit 5124c1c

Browse files
authored
Merge branch 'main' into hips
2 parents 620a593 + 558915f commit 5124c1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+387
-98
lines changed

.devcontainer/Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## Dockerfile for devcontainer
2+
3+
FROM mcr.microsoft.com/devcontainers/base:debian AS base
4+
5+
ARG USER=vscode
6+
ARG GROUP=vscode
7+
8+
ENV HOME="/home/${USER}"
9+
ENV PATH="$HOME/.cargo/bin:$PATH"
10+
11+
# Install dependencies
12+
RUN apt-get update \
13+
&& apt-get -y install \
14+
build-essential \
15+
cmake \
16+
curl \
17+
git \
18+
gnupg \
19+
gnuplot \
20+
lsb-release \
21+
make \
22+
software-properties-common \
23+
sudo \
24+
wget
25+
26+
ARG LLVM_VERSION=17
27+
28+
# Install llvm
29+
RUN wget https://apt.llvm.org/llvm.sh \
30+
&& chmod +x ./llvm.sh \
31+
&& sudo ./llvm.sh ${LLVM_VERSION} all \
32+
&& sudo ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/clang-cl /usr/bin/clang-cl \
33+
&& sudo ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/llvm-lib /usr/bin/llvm-lib \
34+
&& sudo ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/lld-link /usr/bin/lld-link \
35+
&& sudo ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/llvm-ml /usr/bin/llvm-ml \
36+
&& sudo ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/ld.lld /usr/bin/ld.lld \
37+
&& sudo ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/clang /usr/bin/clang
38+
39+
FROM base AS dev
40+
41+
# Make sure the devcontainer user has sudo access
42+
RUN chown -R "${USER}:${GROUP}" /home/${USER} \
43+
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
44+
45+
# Persist bash hystory
46+
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
47+
&& mkdir /commandhistory \
48+
&& touch /commandhistory/.bash_history \
49+
&& chown -R "${USER}" /commandhistory \
50+
&& echo "$SNIPPET" >> "/home/${USER}/.bashrc"
51+
52+
USER $USER
53+
54+
ARG RUST_TOOLCHAIN=1.81.0
55+
56+
# Install rust
57+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
58+
&& rustup default ${RUST_TOOLCHAIN} \
59+
&& rustup target add x86_64-unknown-linux-gnu \
60+
&& rustup target add x86_64-unknown-none \
61+
&& rustup target add x86_64-pc-windows-msvc \
62+
&& cargo install just
63+

.devcontainer/devcontainer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// For more info on the configuration below, check out the link:
2+
// https://code.visualstudio.com/docs/devcontainers/create-dev-container
3+
{
4+
"name": "Hyperlight",
5+
6+
"image": "ghcr.io/hyperlight-dev/hyperlight-devcontainer:latest",
7+
8+
"containerUser": "vscode",
9+
// Environment for the container also used by the `postCreateCommand`
10+
"containerEnv": {
11+
"DEVICE": "/dev/kvm",
12+
"KVM_SHOULD_BE_PRESENT": "true",
13+
"REMOTE_USER": "vscode",
14+
"REMOTE_GROUP": "vscode"
15+
},
16+
17+
"runArgs": [
18+
"--device=/dev/kvm"
19+
],
20+
21+
// Use 'postCreateCommand' to run commands after the container is created
22+
"postCreateCommand": "bash .devcontainer/setup.sh",
23+
24+
"customizations": {
25+
"vscode": {
26+
"extensions": [
27+
"ms-vscode.cmake-tools",
28+
"rust-lang.rust-analyzer",
29+
"vadimcn.vscode-lldb"
30+
]
31+
}
32+
}
33+
}

.devcontainer/setup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
# Change device ownership
4+
sudo chown -R $REMOTE_USER:$REMOTE_GROUP $DEVICE
5+

.github/workflows/Benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757

5858
- uses: actions/checkout@v4
5959

60-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
60+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
6161
with:
6262
rust-toolchain: "1.81.0"
6363
env:

.github/workflows/CargoPublish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
fetch-depth: 0
3333
fetch-tags: true
3434

35-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
35+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
3636
with:
3737
rust-toolchain: "1.81.0"
3838

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Create and publish devcontainer Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
paths:
8+
- ".devcontainer/Dockerfile"
9+
- ".github/workflows/CreateDevcontainerImage.yml"
10+
- "rust-toolchain.toml"
11+
12+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}-devcontainer
16+
USER: vscode
17+
GROUP: vscode
18+
LLVM_VERSION: 17
19+
RUST_TOOLCHAIN_DEFAULT: 1.81.0
20+
RUST_TOOLCHAIN_FILE: rust-toolchain.toml
21+
22+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
23+
jobs:
24+
build-and-push-image:
25+
runs-on: ubuntu-latest
26+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
27+
permissions:
28+
contents: read
29+
packages: write
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v3
34+
35+
- name: Read Rust toolchain version from ${{ env.RUST_TOOLCHAIN_FILE }}
36+
id: toolchain
37+
run: |
38+
version=$(cat ${{ env.RUST_TOOLCHAIN_FILE }} | sed -n '/\[toolchain\]/,/^\[/{/^\s*channel = /s/[^"]*"\([^"]*\)".*/\1/p}')
39+
cat ${{ env.RUST_TOOLCHAIN_FILE }} | grep $version &> /dev/null \
40+
&& echo "RUST_TOOLCHAIN=${version}" >> "$GITHUB_OUTPUT" \
41+
|| echo "RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN_FILE }}" >> "$GITHUB_OUTPUT"
42+
43+
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
44+
- name: Log in to the Container registry
45+
uses: docker/login-action@v1
46+
with:
47+
registry: ${{ env.REGISTRY }}
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Extract metadata (tags, labels) for Docker
52+
id: meta
53+
uses: docker/metadata-action@v5
54+
with:
55+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
56+
57+
- name: Build and push Docker image
58+
id: push
59+
uses: docker/build-push-action@v6
60+
with:
61+
context: ./.devcontainer
62+
push: true
63+
tags: |
64+
${{ steps.meta.outputs.tags }}
65+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
66+
labels: ${{ steps.meta.outputs.labels }}
67+
build-args: |
68+
USER=${{ env.USER }}
69+
GROUP=${{ env.GROUP }}
70+
LLVM_VERSION=${{ env.LLVM_VERSION }}
71+
RUST_TOOLCHAIN=${{ steps.toolchain.outputs.RUST_TOOLCHAIN }}

.github/workflows/CreateRelease.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323

24-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
24+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
2525
with:
2626
rust-toolchain: "1.81.0"
2727
env:
@@ -41,7 +41,7 @@ jobs:
4141
steps:
4242
- uses: actions/checkout@v4
4343

44-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
44+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
4545
with:
4646
rust-toolchain: "1.81.0"
4747
env:
@@ -109,7 +109,7 @@ jobs:
109109
fetch-depth: 0
110110
fetch-tags: true
111111

112-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
112+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
113113
with:
114114
rust-toolchain: "1.81.0"
115115
env:

.github/workflows/ValidatePullRequest.yml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,66 @@ name: Validate Pull Request
55
on:
66
pull_request:
77
branches: [main, "release/**"]
8-
paths-ignore:
9-
- '**.md'
10-
- '**.txt'
118
merge_group:
129

1310
permissions:
1411
id-token: write
1512
contents: read
1613

1714
jobs:
15+
docs-pr:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
docs-only: ${{ steps.docs-only.outputs.result }}
19+
steps:
20+
- uses: dorny/paths-filter@v3
21+
id: changes
22+
with:
23+
filters: |
24+
docs:
25+
- '**/*.md'
26+
- '**/*.txt'
27+
all:
28+
- '**/*'
29+
- uses: actions/github-script@v7
30+
id: docs-only
31+
with:
32+
script: |
33+
let docs_file_count = ${{steps.changes.outputs.docs_count}};
34+
let all_file_count = ${{steps.changes.outputs.all_count}};
35+
return all_file_count === docs_file_count;
36+
result-encoding: string
1837

1938
rust:
39+
needs:
40+
- docs-pr
2041
uses: ./.github/workflows/dep_rust.yml
2142
secrets: inherit
43+
with:
44+
docs_only: ${{needs.docs-pr.outputs.docs-only}}
2245
fuzzing:
46+
needs:
47+
- docs-pr
2348
uses: ./.github/workflows/dep_fuzzing.yml
2449
with:
2550
max_total_time: 300 # 5 minutes in seconds
51+
docs_only: ${{needs.docs-pr.outputs.docs-only}}
2652
secrets: inherit
53+
spelling:
54+
name: spell check with typos
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- name: Spell Check Repo
59+
uses: crate-ci/typos@master
2760

2861
#####
2962
# start build-on-windows
3063
#####
3164
build-on-windows:
65+
needs:
66+
- docs-pr
67+
if: ${{needs.docs-pr.outputs.docs-only != 'true'}}
3268
runs-on: ${{ matrix.os }}
3369
strategy:
3470
fail-fast: true
@@ -57,7 +93,7 @@ jobs:
5793
systeminfo
5894
5995
# Run this so we can use just targets in this workflow
60-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
96+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
6197
with:
6298
rust-toolchain: "1.81.0"
6399
env:
@@ -72,6 +108,9 @@ jobs:
72108
# start build-on-linux
73109
#####
74110
build-on-linux:
111+
needs:
112+
- docs-pr
113+
if: ${{needs.docs-pr.outputs.docs-only != 'true'}}
75114
runs-on: ${{ matrix.os }}
76115
strategy:
77116
fail-fast: true
@@ -117,7 +156,7 @@ jobs:
117156
echo "cat /etc/os-release"
118157
cat /etc/os-release
119158
120-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
159+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
121160
with:
122161
rust-toolchain: "1.81.0"
123162
env:
@@ -129,4 +168,4 @@ jobs:
129168
130169
#####
131170
# end build-on-linux
132-
#####
171+
#####

.github/workflows/dep_build_guest_binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
steps:
3232
- uses: actions/checkout@v4
3333

34-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
34+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
3535
with:
3636
rust-toolchain: "1.81.0"
3737
env:

.github/workflows/dep_fuzzing.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@ on:
77
description: Maximum total time for the fuzz run in seconds
88
required: true
99
type: number
10+
docs_only:
11+
description: Skip fuzzing if docs only
12+
required: false
13+
type: string
14+
default: "false"
1015

1116
permissions:
1217
id-token: write
1318
contents: read
1419

1520
jobs:
1621
fuzz:
22+
if: ${{ inputs.docs_only == 'false' }}
1723
runs-on: [ self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd" ]
1824
steps:
1925
- name: Checkout code
2026
uses: actions/checkout@v4
2127

22-
- uses: hyperlight-dev/ci-setup-workflow@v1.0.0
28+
- uses: hyperlight-dev/ci-setup-workflow@v1.1.0
2329
with:
2430
rust-toolchain: "1.81.0"
2531
env:

0 commit comments

Comments
 (0)