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

Feature request: add possibility to only cache the ~/.cargo dir #195

Open
ttonelli-via opened this issue Apr 2, 2024 · 0 comments
Open

Comments

@ttonelli-via
Copy link

ttonelli-via commented Apr 2, 2024

My use case is I have a template repo that uses cargo-generate to scaffold out a project. The test workflow for this project installs cargo-generate and uses it on itself to create an instance of the template and tests against the output. The project itself is not particularly cacheable between builds, but I would like to be able to cache the ~/.cargo directory so that installing cargo-generate and other cargo subcommands is cached between builds.

I have tried setting the workspaces key to "", assuming that this would tell the action not to try to cache any workspaces, but I get the following error output:

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:7780:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:7763:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:7657: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: 'error: failed to load manifest for workspace member `/home/runner/work/stark-risc0-template/stark-risc0-template/lib`\n' +
      '\n' +
      'Caused by:\n' +
      '  failed to parse manifest at `/home/runner/work/stark-risc0-template/stark-risc0-template/lib/Cargo.toml`\n' +
      '\n' +
      'Caused by:\n' +
      '  no targets specified in the manifest\n' +
      '  either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n'
  }
}

If this is just user error, that would be great to know. However, assuming this is feature is not available currently, would you be open to a PR that adds this feature?

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