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

Add option to install cross from source #7

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The following inputs are accepted:

| Name | Description | Required | Default | Example |
|-------------------|-----------------------------------------------------------------------|----------|------------|------------------------------|
| `cross-version` | The version desired for cross. Only relevant if `use-cross` is true. | false | `"v0.2.4"` | |
| `cross-version` | The version desired for cross. Only relevant if `use-cross` is true. | false | `"v0.2.4"` | `"v0.2.5"` or `"from-source"`|
| `nif-version` | The NIF version that we are aiming to. | false | `"2.16"` | |
| `project-dir` | A relative path where the project is located. | true | `"./"` | `"native/example"` |
| `project-name` | Name of the crate that is being built. Same as in Cargo.toml | true | | |
Expand Down
13 changes: 11 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ inputs:
description: The version to use in the name of the lib. This mostly matches the Elixir package version.
required: true
cross-version:
description: The version desired for cross, the tool that builds for multiple plataforms.
description: >
The version desired for cross, the tool that builds for multiple plataforms.
It's possible to specify a version, or the string "from-source" to install
from the main branch of the project repository.
required: false
default: "v0.2.4"
use-cross:
Expand Down Expand Up @@ -86,14 +89,20 @@ runs:

- name: Download cross from GitHub releases
uses: giantswarm/[email protected]
if: ${{ inputs.use-cross }}
if: ${{ inputs.use-cross && inputs.cross-version != 'from-source' }}
with:
binary: "cross"
version: ${{ inputs.cross-version }}
download_url: "https://github.com/cross-rs/cross/releases/download/${version}/cross-x86_64-unknown-linux-gnu.tar.gz"
tarball_binary_path: "${binary}"
smoke_test: "${binary} --version"

- name: Install cross from GitHub latest revision
shell: bash
if: ${{ inputs.use-cross && inputs.cross-version == 'from-source' }}
run: |
cargo install cross --git https://github.com/cross-rs/cross

- name: Show version information (Rust, cargo, GCC, NIF version)
shell: bash
run: |
Expand Down