actions-rust-lang / setup-rust-toolchain

Setup a specific Rust toolchain with extra features like problem matchers
MIT License
193 stars 33 forks source link

add workspaces input field to support non-root projects #32

Closed gruebel closed 10 months ago

gruebel commented 10 months ago

Thanks for the great action 🏆 we use it in one of our projects and it raises an error with the default configuration, because of caching being enabled. This happens, if your main Cargo.toml is in a sub-folder and this can be easily mitigated by leveraging the workspaces field in the Swatinem/rust-cache action.

Error

Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 101
    at ExecState._setResult (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:7784:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:7767:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:7661:27)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  commandFailed: {
    command: 'cargo metadata --all-features --format-version 1 --no-deps',
    stderr: '\x1B[1m\x1B[31merror\x1B[0m\x1B[1m:\x1B[0m could not find `Cargo.toml` in `/home/runner/work/xyz/xyz` or any parent directory\n'
  }
}
jonasbb commented 10 months ago

Thank you for the PR. Adding some support for projects where the Rust code is not in the project root is nice to have.