Repository navigation
Changes to allow different toolchains for host and guest #1962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ on: | |
| - ".devcontainer/Dockerfile" | ||
| - ".github/workflows/CreateDevcontainerImage.yml" | ||
| - "rust-toolchain.toml" | ||
| - "src/tests/rust_guests/rust-toolchain.toml" | ||
| - "src/hyperlight_guest_capi/rust-toolchain.toml" | ||
|
|
||
| # 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. | ||
| env: | ||
|
|
@@ -16,8 +18,6 @@ env: | |
| USER: vscode | ||
| GROUP: vscode | ||
| LLVM_VERSION: 18 | ||
| RUST_TOOLCHAIN_DEFAULT: 1.94 | ||
| RUST_TOOLCHAIN_FILE: rust-toolchain.toml | ||
|
|
||
| # There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | ||
| jobs: | ||
|
|
@@ -32,13 +32,24 @@ jobs: | |
| - name: Checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - name: Read Rust toolchain version from ${{ env.RUST_TOOLCHAIN_FILE }} | ||
| - name: Read Rust toolchain versions | ||
| id: toolchain | ||
| run: | | ||
| version=$(cat ${{ env.RUST_TOOLCHAIN_FILE }} | sed -n '/\[toolchain\]/,/^\[/{/^\s*channel = /s/[^"]*"\([^"]*\)".*/\1/p}') | ||
| cat ${{ env.RUST_TOOLCHAIN_FILE }} | grep $version &> /dev/null \ | ||
| && echo "RUST_TOOLCHAIN=${version}" >> "$GITHUB_OUTPUT" \ | ||
| || echo "RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN_FILE }}" >> "$GITHUB_OUTPUT" | ||
| python3 - <<'PY' | ||
| import os | ||
| import tomllib | ||
| def channel(path): | ||
| with open(path, "rb") as source: | ||
| return tomllib.load(source)["toolchain"]["channel"] | ||
| guest = channel("src/tests/rust_guests/rust-toolchain.toml") | ||
| if guest != channel("src/hyperlight_guest_capi/rust-toolchain.toml"): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check runs only on pushes to |
||
| raise ValueError("Guest Rust toolchains must match") | ||
| with open(os.environ["GITHUB_OUTPUT"], "a") as output: | ||
| print(f"RUST_TOOLCHAIN={channel('rust-toolchain.toml')}", file=output) | ||
| print(f"GUEST_RUST_TOOLCHAIN={guest}", file=output) | ||
| PY | ||
| # 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. | ||
| - name: Log in to the Container registry | ||
|
|
@@ -69,3 +80,4 @@ jobs: | |
| GROUP=${{ env.GROUP }} | ||
| LLVM_VERSION=${{ env.LLVM_VERSION }} | ||
| RUST_TOOLCHAIN=${{ steps.toolchain.outputs.RUST_TOOLCHAIN }} | ||
| GUEST_RUST_TOOLCHAIN=${{ steps.toolchain.outputs.GUEST_RUST_TOOLCHAIN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,9 +35,9 @@ jobs: | |
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - uses: hyperlight-dev/ci-setup-workflow@2f4142ba17cf573af44fc1e1f1ffc743daded5b3 # v1.10.0 | ||
| - uses: hyperlight-dev/ci-setup-workflow@4b7107a0f24c523f503c861ddeb8180d3a23e7f7 # v2.1.0 | ||
| with: | ||
| rust-toolchain: "1.94" | ||
| additional-toolchain-directory: src/tests/rust_guests | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This job only runs root |
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
|
|
@@ -56,9 +56,9 @@ jobs: | |
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - uses: hyperlight-dev/ci-setup-workflow@2f4142ba17cf573af44fc1e1f1ffc743daded5b3 # v1.10.0 | ||
| - uses: hyperlight-dev/ci-setup-workflow@4b7107a0f24c523f503c861ddeb8180d3a23e7f7 # v2.1.0 | ||
| with: | ||
| rust-toolchain: "1.94" | ||
| additional-toolchain-directory: src/tests/rust_guests | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
|
|
@@ -134,9 +134,9 @@ jobs: | |
| fetch-tags: true | ||
| submodules: true | ||
|
|
||
| - uses: hyperlight-dev/ci-setup-workflow@2f4142ba17cf573af44fc1e1f1ffc743daded5b3 # v1.10.0 | ||
| - uses: hyperlight-dev/ci-setup-workflow@4b7107a0f24c523f503c861ddeb8180d3a23e7f7 # v2.1.0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The v2 setup action calls if [[ ! -v CARGO_PROFILE_DEV_DEBUG ]]; then
echo "CARGO_PROFILE_DEV_DEBUG=0" >> $GITHUB_ENV
fiThis job has no override. |
||
| with: | ||
| rust-toolchain: "1.94" | ||
| additional-toolchain-directory: src/tests/rust_guests | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
rustup defaultinstalls clippy and rustfmt with the default profile, so this line looks redundant.rustfmtin the toolchain files also seems unused since fmt runs on nightly.