Compare commits
2 commits
7b827189c8
...
5fc345c0de
Author | SHA1 | Date | |
---|---|---|---|
5fc345c0de | |||
dbe6a60417 |
3 changed files with 67 additions and 10 deletions
|
@ -5,20 +5,26 @@ on:
|
|||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain:
|
||||
- stable
|
||||
- nightly
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Test
|
||||
- name: Test ${{ toolchain}}
|
||||
uses: https://git.kemitix.net/kemitix/rust@next
|
||||
with:
|
||||
args: cargo test
|
||||
args: ${{toolchain}} cargo test
|
||||
|
||||
- name: Build
|
||||
- name: Build ${{ toolchain }}
|
||||
uses: https://git.kemitix.net/kemitix/rust@next
|
||||
with:
|
||||
args: cargo build
|
||||
args: ${{ toolchain }} cargo build
|
||||
|
||||
- name: Run
|
||||
- name: Run ${{ toolchain }}
|
||||
uses: https://git.kemitix.net/kemitix/rust@next
|
||||
with:
|
||||
args: cargo run
|
||||
args: ${{ toolchain }} cargo run
|
||||
|
|
14
README.md
14
README.md
|
@ -14,12 +14,22 @@ jobs:
|
|||
steps:
|
||||
- uses: https://git.kemitix.net/kemitix/rust@v1.80.0
|
||||
with:
|
||||
args: cargo test
|
||||
args: nightly cargo test
|
||||
- uses: https://git.kemitix.net/kemitix/rust@v1.80.0
|
||||
with:
|
||||
args: cargo build
|
||||
args: v1.79.0 cargo build
|
||||
```
|
||||
|
||||
The `args` is one of the following:
|
||||
|
||||
- <COMMAND>
|
||||
- [ [nightly | stable | v1.xx.x] ] <COMMAND>
|
||||
|
||||
`COMMAND` is the command you want to run. The optional prefix is the Rust toolchain, or version. Allowed values are `nightly`, `stable` or a Rust version.
|
||||
|
||||
Where the optional prefix is not given, the `stable` toolchain will be used.
|
||||
|
||||
|
||||
## Contents
|
||||
|
||||
- nodejs
|
||||
|
|
|
@ -2,5 +2,46 @@
|
|||
|
||||
set -e
|
||||
|
||||
rustup update
|
||||
${INPUT_ARGS}
|
||||
echo "INPUT_ARGS: ${INPUT_ARGS}"
|
||||
|
||||
# split input into an array
|
||||
read -ra ARGS <<<"${INPUT_ARGS}"
|
||||
|
||||
# default toolchain
|
||||
TOOLCHAIN="stable"
|
||||
echo "Default toolchain: ${TOOLCHAIN}"
|
||||
|
||||
# if first parameter is 'nightly'...
|
||||
if test "${ARGS[0]}" == "nightly"; then
|
||||
TOOLCHAIN="nightly"
|
||||
ARGS=("${ARGS[@]:1}")
|
||||
fi
|
||||
if test "${ARGS[0]}" == "stable"; then
|
||||
TOOLCHAIN="stable" # redundant as this is the default
|
||||
ARGS=("${ARGS[@]:1}")
|
||||
fi
|
||||
if [[ "${ARGS[0]}" == v1* ]]; then
|
||||
TOOLCHAIN="${ARGS[0]:1}"
|
||||
ARGS=("${ARGS[@]:1}")
|
||||
fi
|
||||
echo "Selected toolchain: ${TOOLCHAIN}"
|
||||
|
||||
rustup update "${TOOLCHAIN}"
|
||||
|
||||
if test "${ARGS[0]}" == "cargo";then
|
||||
PRE_COMMAND="cargo +${TOOLCHAIN} "
|
||||
else
|
||||
PRE_COMMAND="${ARGS[0]}"
|
||||
fi
|
||||
ARGS=("${ARGS[@]:1}")
|
||||
|
||||
# ensure toolchain is up-to-date
|
||||
# recombine remaining arguments
|
||||
COMMAND=$(
|
||||
IFS=" "
|
||||
echo "${ARGS[*]}"
|
||||
)
|
||||
|
||||
# execute command
|
||||
echo "${PRE_COMMAND} ${COMMAND}"
|
||||
${PRE_COMMAND} ${COMMAND}
|
||||
|
|
Loading…
Reference in a new issue