taiki-e / setup-cross-toolchain-action

GitHub Action for setup toolchains for cross compilation and cross testing for Rust.
Apache License 2.0
35 stars 4 forks source link

Question: integrate with `taiki-e/upload-rust-binary-action`? #24

Closed linrongbin16 closed 1 month ago

linrongbin16 commented 1 month ago

hi, thanks to your action, it helps a lot. But I am confused when try to integrate your several github actions to do following jobs for me:

  1. Build executable binary for multiple platforms. (include both normal/popular platforms such as x86-64 linux/windows, and non-popular platforms such as aarch64 windows, freebsd)
  2. Package them and upload to the target github release.

Here's my github action file (I think I copy this part from some other projects):

https://github.com/rsvim/rsvim/blob/f199ae47a9f641fe8e2fa4c2f0840fe90c9cecdf/.github/workflows/nightly.yml#L72-L93

And here's my question:

  1. Why have to install taiki-e/install-action@cross when building linux musl? I think taiki-e/setup-cross-toolchain-action already installs cross for me, correct?
  2. In the setup-cross-toolchain-action readme document: https://github.com/taiki-e/setup-cross-toolchain-action?tab=readme-ov-file#example-workflow-basic-usage, the example shows users only need to write cargo run. But in cross document, it says users need to use cross run instead of cargo. Which one is correct?
  3. How does taiki-e/upload-rust-binary-action action select whether it should use cargo or cross? (I remember I had read the source code, inside it will detect whether it's a cross-platform building or not, and auto select cross or cargo)
taiki-e commented 1 month ago

cross is unrelated to this action (setup-cross-toolchain-action). you have to use cross when using cross, cargo when using this action as documented.

Why have to install taiki-e/install-action@cross when building linux musl?

This action did not support musl in the past, so cross was necessary to build musl. It is no longer necessary. https://github.com/taiki-e/cargo-hack/commit/46f5675f11acc51cf7f48068f4cbfb172c8e1248#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34

3. How does taiki-e/upload-rust-binary-action action select whether it should use cargo or cross? (I remember I had read the source code, inside it will detect whether it's a cross-platform building or not, and auto select cross or cargo)

Please read documentation: https://github.com/taiki-e/upload-rust-binary-action?tab=readme-ov-file#example-workflow-cross-compilation

linrongbin16 commented 1 month ago

Got it, thanks for reply!