emk / rust-musl-builder

Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k stars 193 forks source link

Github Action support #143

Closed hoijui closed 2 years ago

hoijui commented 2 years ago

How would you go about this?

I found quite some actions support this, but they are all outdated/unmaintained. The best I found so far is this: https://github.com/stevenleadbeater/rust-musl-builder which is stuck at rust 2018. Now I could fork it and update it, but in one or two years my fork would be outdated again, and I would just have added to an "orbital space pollution" kind of problem.

Do you see a good way to integrate it into this repo somehow? I think that would make most sense, practically. I could try doing it, given some rough guidelines.

hoijui commented 2 years ago

Solution

Don't use this docker image, but the normal actions-rs/toolchain action you also use for non-MUSL building, and just add the target property like so:

      - name: "Get the Rust toolchain"
         uses: actions-rs/toolchain@v1
         with:
             toolchain: stable
             override: true
             target: x86_64-unknown-linux-musl
             components: rustfmt, clippy

      - name: "Build manual"
        run: cargo build --verbose --release --target=x86_64-unknown-linux-musl