Skip to content
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

Make it easy to install / cache Rust in Github CI & locally #178

Open
lcswillems opened this issue Jul 14, 2024 · 0 comments
Open

Make it easy to install / cache Rust in Github CI & locally #178

lcswillems opened this issue Jul 14, 2024 · 0 comments

Comments

@lcswillems
Copy link
Contributor

lcswillems commented Jul 14, 2024

So far, this is the best way known to install and cache Rust in a Github CI:

- name: Cache Rust
  uses: actions/cache@v4
  with:
    path: |
      ~/.rustup/toolchains
      ~/.cargo
      **/target
    key: xsuite-rust-${{ runner.os }}-${{ hashFiles('rust-toolchain{,.toml}') }}-${{ hashFiles('**/Cargo.lock') }}
    restore-keys: xsuite-rust-${{ runner.os }}-

- name: Install Rust
  run: npx xsuite install-rust --toolchain none && rustc --version

But it doesn't feel to be the simplest thing possible. Several issues:

  1. Not easy to remember. A Github action could be created for this. However, if the project doesn't use rust-toolchain, nothing about the Rust version will be included in the cache key, which is not good. Possible options here:

    • An option could be added for the project to provide the Rust channel to be added in the cache key. But now the project will have to provide twice the Rust channel: one to the action for the cache key and one for the step where they will install Rust.
    • Another option could be for the action to handle the Rust install. However, doing the installation with xSuite might add significant time as xSuite might not be already installed. A solution could be to directly install rustup without xSuite.
  2. Not easy to create a rust-toolchain file. Especially because a toolchain needs to be provided but also a target in order to build MultiversX smart contracts

  3. In case rust-toolchain exists in the repository, not easy to install the version specified in the rust-toolchain, or even better, no way not having to care: if there is a version specified in the rust-toolchain it installs it otherwise it installs a version by default.

The command xsuite install-rust-key is also not useful and should be deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant