diff --git a/README.md b/README.md index 8a4a18d..d4614a6 100644 --- a/README.md +++ b/README.md @@ -9,32 +9,48 @@ jobs: setup: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 - - uses: hyperlight-dev/ci-setup-workflow@v1.0.0 - with: - rust-toolchain: "1.74.0" + - uses: hyperlight-dev/ci-setup-workflow@v2.0.0 + with: + additional-toolchain-directory: guests ``` +Check out the consumer repository before invoking the action. + ## Inputs ### Parameters | Name | Description | | ---- | ----------- | -| `rust-toolchain` | The rust toolchain version to use. | +| `additional-toolchain-directory` | Optional directory containing another `rust-toolchain.toml` or `rust-toolchain` file. | +| `just-version` | Version of Just to install; defaults to `1.41`. | + +The action reads `rust-toolchain.toml` or `rust-toolchain` from the repository +root, falling back to stable when neither file exists. Set +`additional-toolchain-directory` when another directory, such as a guest +project, uses a different toolchain. + +Rustup reads the version, profile, components, and targets from each toolchain +file. Put required extras such as `clippy`, `rustfmt`, `x86_64-unknown-none`, +or cross-compilation targets in those files. ## Overview This action performs the following steps: -- Installs the Rust tool chain at the specified version. -- Installs additional rust components like clippy, rustfmt, ect -- Installs Just -- Sets up the clang toolchain on Linux machines (this should probably get moved into the hosted runner image setup...) -- Installs the `x86_64-pc-windows-msvc` rust target for cross-compilation on Linux machines +- Installs rustup if needed and the root toolchain (or stable by default). +- Installs an additional toolchain when requested. +- Installs the requested components and targets. +- Installs Just. +- Sets up the clang toolchain on Linux. +- Enables the Windows Hypervisor Platform on Windows. - Sets up environment variables needed to build / run tests based on the machine's configuration. +Runners need Bash 5 and rustup or curl. The setup action installs rustup when +missing and installs Bash through Homebrew on macOS. + ## Code of Conduct See the [Code of Conduct](./CODE_OF_CONDUCT.md). diff --git a/action.yml b/action.yml index 71dd0ad..05e54ae 100644 --- a/action.yml +++ b/action.yml @@ -4,10 +4,9 @@ name: "Hyperlight Workflow Setup" description: "Common setup steps for GitHub workflows in the Hyperlight project" inputs: - rust-toolchain: - description: "(Default: 1.94.0) Rust toolchain specification to install - see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification" + additional-toolchain-directory: + description: "Optional directory containing another Rust toolchain file." required: false - default: "1.94.0" just-version: description: '(Default: 1.41) Version of just to install.' required: false @@ -16,12 +15,23 @@ runs: using: composite steps: - - uses: dtolnay/rust-toolchain@master + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2 with: - toolchain: ${{ inputs.rust-toolchain }} - components: clippy, rustfmt - - - uses: extractions/setup-just@v4 + cache: 'false' + matcher: 'false' + build-warnings: '' + + - name: Install additional Rust toolchain + if: ${{ inputs.additional-toolchain-directory != '' }} + uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2 + with: + rust-src-dir: ${{ inputs.additional-toolchain-directory }} + cache: 'false' + matcher: 'false' + build-warnings: '' + + - uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4 with: just-version: ${{ inputs.just-version }} @@ -87,21 +97,6 @@ runs: fi shell: bash - # This is needed to build the rust guests - - name: Install x86_64-unknown-none target - if: ${{ (runner.os == 'Linux') }} - run: | - rustup target add x86_64-unknown-none - shell: bash - - # We do this in case there is toolchain skew between repos - - name: Install older rust toolchain(s) - if: ${{ (runner.os == 'Linux') }} - run: | - rustup toolchain install 1.85.0 - rustup toolchain install 1.86.0 - shell: bash - - name: Set up env vars (Linux) if: ${{ (runner.os == 'Linux') }} run: | @@ -125,25 +120,6 @@ runs: run: Enable-WindowsOptionalFeature -Online -FeatureName HyperVisorPlatform shell: pwsh - - name: Install x86_64-pc-windows-msvc target (Windows) - if: ${{ (runner.os == 'Windows') }} - run: | - rustup target add x86_64-pc-windows-msvc - shell: pwsh - - - name: Install x86_64-unknown-none target (Windows) - if: ${{ (runner.os == 'Windows') }} - run: | - rustup target add x86_64-unknown-none - shell: pwsh - - - name: Install older rust toolchain(s) (Windows) - if: ${{ (runner.os == 'Windows') }} - run: | - rustup toolchain install 1.85.0 - rustup toolchain install 1.86.0 - shell: pwsh - - name: Set up env vars (Windows) if: ${{ (runner.os == 'Windows') }} run: |