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

support cargo-binstall #1280

Open
ahaoboy opened this issue Oct 12, 2024 · 10 comments
Open

support cargo-binstall #1280

ahaoboy opened this issue Oct 12, 2024 · 10 comments

Comments

@ahaoboy
Copy link
Contributor

ahaoboy commented Oct 12, 2024

https://github.com/cargo-bins/cargo-binstall

cargo-binstall can skip the compilation process. fnm has released executable programs for different platforms, but it does not support cargo-binstall.

cargo binstall fnm
@ahaoboy
Copy link
Contributor Author

ahaoboy commented Oct 12, 2024

On Ubuntu, It will use the quickInstall source, and on Windows, fnm will compile from source.

@SkySingh04
Copy link

@ahaoboy This sounds like a fun issue to work on! I'd love to pick it up.

My Approach is simple :

  • I'll configure precompiled binaries for the fnm project following the required naming conventions:

    • fnm-x86_64-pc-windows-msvc.zip
    • fnm-arm64-pc-windows-msvc.zip
  • These will be added to the GitHub Releases for fnm.

  • I'll automate the building and uploading of these binaries via GitHub Actions for both Windows platforms (x86_64 and arm64), as well as other target platforms.

    • If needed, I'll also modify the install.sh script to ensure proper installation flow when using cargo-binstall.

Let me know if this approach works, and I'd be happy to get started!

@Schniz
Copy link
Owner

Schniz commented Oct 13, 2024

This sounds good and I’d love to see that contributed! I suggest stacking these changes on a fork so we see that it works (all the release process has a very slow feedback loop). I think it will be best to first have both fnm-macos.zip etc along to the new files, so we can make sure all installers are updated (like winget, brew, apt etc). We just symlink or duplicate release artifacts to avoid breaking :) if there are any issues I can try to help

@Schniz
Copy link
Owner

Schniz commented Oct 13, 2024

Making cross compile work faster and nicer is pretty cool. Maybe with cargo zigbuild or whatever it is called

@ahaoboy
Copy link
Contributor Author

ahaoboy commented Oct 13, 2024

It is not clear whether fnm-macos is currently x86_64 or arm64, perhaps it should support both

  • fnm-aarch64-apple-darwin.zip
  • fnm-x86_64-apple-darwin.zip

@ahaoboy
Copy link
Contributor Author

ahaoboy commented Oct 13, 2024

Making cross compile work faster and nicer is pretty cool. Maybe with cargo zigbuild or whatever it is called

I often use this action, it is easier to use than cargo-dist

https://github.com/taiki-e/upload-rust-binary-action

@SkySingh04
Copy link

SkySingh04 commented Oct 13, 2024

@Schniz @ahaoboy
Before I proceed with adding cargo-binstall support and updating the release process, I wanted to check on the current binaries that are already available for fnm.

Could you confirm which binaries are currently being generated for each platform (e.g., fnm-x86_64-apple-darwin.zip, fnm-arm64-apple-darwin.zip, etc.)? This will help ensure I update the install script and CI process correctly without duplicating existing work.

This is in referrence to any existing work/ open PR's on the same

@ahaoboy
Copy link
Contributor Author

ahaoboy commented Oct 13, 2024

cargo-binstall has full list, but we don't need support all of them
https://github.com/cargo-bins/cargo-binstall/releases

@SkySingh04
Copy link

@ahaoboy @Schniz I have made a PR with the binstall.toml and CI changes, can you help me with what other changes are required to support the same?

@ahaoboy
Copy link
Contributor Author

ahaoboy commented Oct 14, 2024

Because actions/upload-artifact@v4 is used to compress files, CRC calculation errors occur. cargo-bins/cargo-binstall#1080. Therefore, zip packages such as fnm-windows.zip cannot be used even if metadata is added. It needs to be tested to prevent this problem.

You can test whether the local Cargo.toml is configured correctly by the following command

 cargo binstall --manifest-path=./Cargo.toml fnm --force


 WARN resolve: Error while downloading and extracting from fetcher github.com: Failed to extract zipfile: a computed CRC32 value did not match the expected value

Also, should the meta information be added to Cargo.toml? Using binstall.toml will duplicate package information, and I'm not sure if it will work.

[package.metadata.binstall]
pkg-fmt = "zip"
bin-dir = "fnm{ binary-ext }"

[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-url = "{ repo }/releases/download/v{ version }/fnm-windows.zip"

[package.metadata.binstall.overrides.x86_64-apple-darwin]
pkg-url = "{ repo }/releases/download/v{ version }/fnm-macos.zip"


[package.metadata.binstall.overrides.x86_64-unknown-linux-musl]
pkg-url = "{ repo }/releases/download/v{ version }/fnm-linux.zip"

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

3 participants