Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rhysnewell/rust-cargo-musl-action
https://github.com/rhysnewell/rust-cargo-musl-action
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rhysnewell/rust-cargo-musl-action
- Owner: rhysnewell
- License: bsd-3-clause
- Fork: true (heroku/rust-cargo-musl-action)
- Created: 2021-10-16T10:46:00.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-03T23:40:39.000Z (over 2 years ago)
- Last Synced: 2024-07-07T13:22:44.666Z (5 months ago)
- Language: Dockerfile
- Size: 35.2 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Heroku Rust Cargo Action with MUSL Target
![experimental badge](images/experimental.png)This action sets up `cargo` and the `x86_64-unknown-linux-musl` target for handling cross compiling builds on the Heroku stack.
## Inputs
### `command`
This is the `cargo` command to be run like `build` or `test`.
When using `build`, the flags `--release` and `--target x86_64-unknown-linux-musl` are set. After thebuild is done, the binaries will be stripped.
**Default** If not `command` input is given, it will default to `build`.
### `flags`
These are any additional flags to be passed to the `cargo `.
## Outputs
### `release-dir`
If the `command` input is set to `build`, then this will be to te the target release directory.
## Example usage
To run tests with `cargo test`:
### GitHub Action Config
```YAML
- uses: actions/checkout@v2
- uses: heroku/rust-cargo-musl-action@v1
with:
command: test
```To cross compile a rust binary that targets a 64-bit musl linux binary that vendors OpenSSL with a binary called `binary` the configuration will look like the following:
### `Cargo.toml`
```TOML
[features]
# Force openssl-sys to staticly link in the openssl library. Necessary when
# cross compiling to x86_64-unknown-linux-musl.
vendored-openssl = ["openssl-sys/vendored"]
```### GitHub Action Config
```YAML
- uses: actions/checkout@v2
- id: 'compile'
uses: heroku/rust-cargo-musl-action@v1
with:
command: 'build'
flags: '--features vendored-openssl'
- uses: actions/upload-artifact@v2
with:
name: binary
path: ${{ steps.compile.outputs.release-dir }}/binary
```