Add more newlines in action.yml
This commit is contained in:
parent
a72a5f146c
commit
7619b10b9f
34
action.yml
34
action.yml
@ -1,55 +1,69 @@
|
|||||||
name: "Build Rust Projects with Cross"
|
name: "Build Rust Projects with Cross"
|
||||||
author: "Dave Rolsky <autarch@urth.org>"
|
author: "Dave Rolsky <autarch@urth.org>"
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: home
|
icon: home
|
||||||
color: gray-dark
|
color: gray-dark
|
||||||
|
|
||||||
description: |
|
description: |
|
||||||
Cross compile your Rust projects with cross (https://github.com/cross-rs/cross).
|
Cross compile your Rust projects with cross (https://github.com/cross-rs/cross).
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
target:
|
target:
|
||||||
description: The target platform
|
description: The target platform
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
command:
|
command:
|
||||||
description: |
|
description: |
|
||||||
The commands to run. This must be one of "build", "test", "both" (build and test), or "bench".
|
The commands to run. This must be one of "build", "test", "both" (build and test), or "bench".
|
||||||
default: build
|
default: build
|
||||||
|
|
||||||
toolchain:
|
toolchain:
|
||||||
description: |
|
description: |
|
||||||
The target toolchain to use (one of "stable", "beta", or "nightly").
|
The target toolchain to use (one of "stable", "beta", or "nightly").
|
||||||
default: stable
|
default: stable
|
||||||
|
|
||||||
working-directory:
|
working-directory:
|
||||||
description: The working directory for each step
|
description: The working directory for each step
|
||||||
default: "."
|
default: "."
|
||||||
|
|
||||||
GITHUB_TOKEN:
|
GITHUB_TOKEN:
|
||||||
description: |
|
description: |
|
||||||
A GitHub token, available in the secrets.GITHUB_TOKEN working-directory variable.
|
A GitHub token, available in the secrets.GITHUB_TOKEN working-directory variable.
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
|
|
||||||
args:
|
args:
|
||||||
description: |
|
description: |
|
||||||
The arguments to be passed to cross or cargo when building, as a
|
The arguments to be passed to cross or cargo when building, as a
|
||||||
space-separated string.
|
space-separated string.
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
strip:
|
strip:
|
||||||
description: Strip the compiled binary
|
description: Strip the compiled binary
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
cross-version:
|
cross-version:
|
||||||
description: |
|
description: |
|
||||||
The version of cross to use. If not specified, then the latest version
|
The version of cross to use. If not specified, then the latest version
|
||||||
will be used.
|
will be used.
|
||||||
|
|
||||||
cache-cross-binary:
|
cache-cross-binary:
|
||||||
description: |
|
description: |
|
||||||
Cache the cross binary if one is installed. This is primarily for use in
|
Cache the cross binary if one is installed. This is primarily for use in
|
||||||
tests of this action.
|
tests of this action.
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
use-rust-cache:
|
use-rust-cache:
|
||||||
description: |
|
description: |
|
||||||
Use `Swatinem/rust-cache@v2`. Defaults to true.
|
Use `Swatinem/rust-cache@v2`. Defaults to true.
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
rust-cache-parameters:
|
rust-cache-parameters:
|
||||||
description: |
|
description: |
|
||||||
A JSON string containing parameters to pass to `Swatinem/rust-cache@v2`. You can use the
|
A JSON string containing parameters to pass to `Swatinem/rust-cache@v2`. You can use the
|
||||||
`toJSON()` function in your action to make passing this easier.
|
`toJSON()` function in your action to make passing this easier.
|
||||||
default: "{}"
|
default: "{}"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@ -57,9 +71,11 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo '${{ toJSON(inputs) }}'
|
echo '${{ toJSON(inputs) }}'
|
||||||
|
|
||||||
- name: Add this action's path to PATH
|
- name: Add this action's path to PATH
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "${{ github.action_path }}" >> $GITHUB_PATH
|
run: echo "${{ github.action_path }}" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Validate inputs
|
- name: Validate inputs
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@ -73,15 +89,18 @@ runs:
|
|||||||
INPUTS_cache_cross_binary: ${{ inputs.cache-cross-binary }}
|
INPUTS_cache_cross_binary: ${{ inputs.cache-cross-binary }}
|
||||||
INPUTS_use_rust_cache: ${{ inputs.use-rust-cache }}
|
INPUTS_use_rust_cache: ${{ inputs.use-rust-cache }}
|
||||||
INPUTS_rust_cache_parameters: ${{ inputs.rust-cache-parameters }}
|
INPUTS_rust_cache_parameters: ${{ inputs.rust-cache-parameters }}
|
||||||
|
|
||||||
- name: Determine whether we need to cross-compile
|
- name: Determine whether we need to cross-compile
|
||||||
id: determine-cross-compile
|
id: determine-cross-compile
|
||||||
shell: bash
|
shell: bash
|
||||||
run: set-cross-compile.py ${{ inputs.target }}
|
run: set-cross-compile.py ${{ inputs.target }}
|
||||||
|
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
targets: ${{ inputs.target }}
|
targets: ${{ inputs.target }}
|
||||||
toolchain: ${{ inputs.toolchain }}
|
toolchain: ${{ inputs.toolchain }}
|
||||||
|
|
||||||
- name: Determine cross version
|
- name: Determine cross version
|
||||||
id: determine-cross-version
|
id: determine-cross-version
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -89,6 +108,7 @@ runs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross == 'true'
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true'
|
||||||
|
|
||||||
# We need to access this in both this YAML config and shell scripts. It
|
# We need to access this in both this YAML config and shell scripts. It
|
||||||
# doesn't seem like using ${{ env.RUNNER_TEMP }} works in the YAML config.
|
# doesn't seem like using ${{ env.RUNNER_TEMP }} works in the YAML config.
|
||||||
- name: Set directory for installing cross
|
- name: Set directory for installing cross
|
||||||
@ -96,6 +116,7 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: set-cross-dir.sh
|
run: set-cross-dir.sh
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross == 'true'
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true'
|
||||||
|
|
||||||
- name: Cache cross
|
- name: Cache cross
|
||||||
id: cache-cross
|
id: cache-cross
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
@ -103,12 +124,14 @@ runs:
|
|||||||
path: ${{ steps.set-cross-dir.outputs.cross-dir }}/cross
|
path: ${{ steps.set-cross-dir.outputs.cross-dir }}/cross
|
||||||
key: ${{ runner.os }}-${{ steps.determine-cross-version.outputs.cross-version }}
|
key: ${{ runner.os }}-${{ steps.determine-cross-version.outputs.cross-version }}
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && inputs.cache-cross-binary == 'true'
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && inputs.cache-cross-binary == 'true'
|
||||||
|
|
||||||
- name: Install cross if cross-compiling (*nix)
|
- name: Install cross if cross-compiling (*nix)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: install-cross-nix.sh ${{ steps.set-cross-dir.outputs.cross-dir }} ${{ steps.determine-cross-version.outputs.cross-version }}
|
run: install-cross-nix.sh ${{ steps.set-cross-dir.outputs.cross-dir }} ${{ steps.determine-cross-version.outputs.cross-version }}
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && steps.cache-cross.outputs.cache-hit != 'true'
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && steps.cache-cross.outputs.cache-hit != 'true'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Install musl-tools on Linux if target includes "musl"
|
- name: Install musl-tools on Linux if target includes "musl"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@ -118,14 +141,17 @@ runs:
|
|||||||
sudo apt-get update --yes && \
|
sudo apt-get update --yes && \
|
||||||
sudo apt-get install --yes musl-tools
|
sudo apt-get install --yes musl-tools
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross != 'true' && contains(inputs.target, 'musl')
|
if: steps.determine-cross-compile.outputs.needs-cross != 'true' && contains(inputs.target, 'musl')
|
||||||
|
|
||||||
- name: Set build command
|
- name: Set build command
|
||||||
id: set-build-command
|
id: set-build-command
|
||||||
shell: bash
|
shell: bash
|
||||||
run: set-build-command.sh ${{ steps.set-cross-dir.outputs.cross-dir }}
|
run: set-build-command.sh ${{ steps.set-cross-dir.outputs.cross-dir }}
|
||||||
|
|
||||||
- name: Determine which cargo commands to run
|
- name: Determine which cargo commands to run
|
||||||
id: determine-cargo-commands
|
id: determine-cargo-commands
|
||||||
shell: bash
|
shell: bash
|
||||||
run: determine-cargo-commands.sh ${{ inputs.command }}
|
run: determine-cargo-commands.sh ${{ inputs.command }}
|
||||||
|
|
||||||
- name: Parse `rust-cache-parameters` and set inputs for `Swatinem/rust-cache@v2`
|
- name: Parse `rust-cache-parameters` and set inputs for `Swatinem/rust-cache@v2`
|
||||||
id: parse-rust-cache-parameters
|
id: parse-rust-cache-parameters
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -144,16 +170,19 @@ runs:
|
|||||||
env:
|
env:
|
||||||
RUST_CACHE_PARAMETERS: ${{ inputs.rust-cache-parameters }}
|
RUST_CACHE_PARAMETERS: ${{ inputs.rust-cache-parameters }}
|
||||||
if: inputs.use-rust-cache == 'true'
|
if: inputs.use-rust-cache == 'true'
|
||||||
|
|
||||||
- name: Cache cargo & target directories
|
- name: Cache cargo & target directories
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with: ${{ steps.parse-rust-cache-parameters.outputs }}
|
with: ${{ steps.parse-rust-cache-parameters.outputs }}
|
||||||
if: inputs.use-rust-cache == 'true'
|
if: inputs.use-rust-cache == 'true'
|
||||||
|
|
||||||
- name: Run tests (*nix)
|
- name: Run tests (*nix)
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test --target ${{ inputs.target }} ${{ inputs.args }}
|
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test --target ${{ inputs.target }} ${{ inputs.args }}
|
||||||
if: steps.determine-cargo-commands.outputs.test == 'true' && runner.os != 'Windows'
|
if: steps.determine-cargo-commands.outputs.test == 'true' && runner.os != 'Windows'
|
||||||
|
|
||||||
# We want to run in Powershell on Windows to make sure we compile in a
|
# We want to run in Powershell on Windows to make sure we compile in a
|
||||||
# native Windows environment. Some things won't compile properly under
|
# native Windows environment. Some things won't compile properly under
|
||||||
# msys, notably OpenSSL, which is compiled locally when using the
|
# msys, notably OpenSSL, which is compiled locally when using the
|
||||||
@ -164,30 +193,35 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test --target ${{ inputs.target }} ${{ inputs.args }}
|
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test --target ${{ inputs.target }} ${{ inputs.args }}
|
||||||
if: steps.determine-cargo-commands.outputs.test == 'true' && runner.os == 'Windows'
|
if: steps.determine-cargo-commands.outputs.test == 'true' && runner.os == 'Windows'
|
||||||
|
|
||||||
- name: Run benchmarks (*nix)
|
- name: Run benchmarks (*nix)
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} bench --target ${{ inputs.target }} ${{ inputs.args }}
|
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} bench --target ${{ inputs.target }} ${{ inputs.args }}
|
||||||
if: steps.determine-cargo-commands.outputs.bench == 'true' && runner.os != 'Windows'
|
if: steps.determine-cargo-commands.outputs.bench == 'true' && runner.os != 'Windows'
|
||||||
|
|
||||||
- name: Run benchmarks (Windows)
|
- name: Run benchmarks (Windows)
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} bench --target ${{ inputs.target }} ${{ inputs.args }}
|
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} bench --target ${{ inputs.target }} ${{ inputs.args }}
|
||||||
if: steps.determine-cargo-commands.outputs.bench == 'true' && runner.os == 'Windows'
|
if: steps.determine-cargo-commands.outputs.bench == 'true' && runner.os == 'Windows'
|
||||||
|
|
||||||
- name: Build binary (*nix)
|
- name: Build binary (*nix)
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} build ${{ inputs.args }} --target ${{ inputs.target }}
|
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} build ${{ inputs.args }} --target ${{ inputs.target }}
|
||||||
if: steps.determine-cargo-commands.outputs.build == 'true' && runner.os != 'Windows'
|
if: steps.determine-cargo-commands.outputs.build == 'true' && runner.os != 'Windows'
|
||||||
|
|
||||||
- name: Build binary (Windows)
|
- name: Build binary (Windows)
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} build ${{ inputs.args }} --target ${{ inputs.target }}
|
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} build ${{ inputs.args }} --target ${{ inputs.target }}
|
||||||
if: steps.determine-cargo-commands.outputs.build == 'true' && runner.os == 'Windows'
|
if: steps.determine-cargo-commands.outputs.build == 'true' && runner.os == 'Windows'
|
||||||
|
|
||||||
- name: Strip binary
|
- name: Strip binary
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user