mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 13:38:43 +00:00
Fix installation script on MacOS (#1263)
Fixed #1254 and also add CI for installation script and shellcheck. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
7f1ddd1dd7
commit
1c886d8897
3 changed files with 118 additions and 3 deletions
84
.github/workflows/install-script.yml
vendored
Normal file
84
.github/workflows/install-script.yml
vendored
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
name: Test install-script
|
||||||
|
|
||||||
|
on:
|
||||||
|
merge_group:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
paths:
|
||||||
|
- install-from-binstall-release.ps1
|
||||||
|
- install-from-binstall-release.sh
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- install-from-binstall-release.ps1
|
||||||
|
- install-from-binstall-release.sh
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref || github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unix:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest]
|
||||||
|
set_cargo_home: [t, f]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set `CARGO_HOME`
|
||||||
|
if: matrix.set_cargo_home == 't'
|
||||||
|
run: |
|
||||||
|
CARGO_HOME="$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')"
|
||||||
|
mkdir -p "${CARGO_HOME}/bin"
|
||||||
|
echo "CARGO_HOME=$CARGO_HOME" >> "$GITHUB_ENV"
|
||||||
|
echo "${CARGO_HOME}/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Install `cargo-binstall` using scripts
|
||||||
|
run: ./install-from-binstall-release.sh
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Verify `cargo-binstall` installation
|
||||||
|
run: |
|
||||||
|
which cargo-binstall
|
||||||
|
cargo binstall -vV
|
||||||
|
|
||||||
|
windows:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
set_cargo_home: [t, f]
|
||||||
|
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set `CARGO_HOME`
|
||||||
|
if: matrix.set_cargo_home == 't'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
CARGO_HOME="$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')"
|
||||||
|
mkdir -p "${CARGO_HOME}/bin"
|
||||||
|
echo "CARGO_HOME=$CARGO_HOME" >> "$GITHUB_ENV"
|
||||||
|
echo "${CARGO_HOME}/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Install `cargo-binstall` using scripts
|
||||||
|
run: ./install-from-binstall-release.ps1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Verify `cargo-binstall` installation
|
||||||
|
run: cargo binstall -vV
|
32
.github/workflows/shellcheck.yml
vendored
Normal file
32
.github/workflows/shellcheck.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
name: Shellcheck
|
||||||
|
|
||||||
|
on:
|
||||||
|
merge_group:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
paths:
|
||||||
|
- '**.sh'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '**.sh'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref || github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
shellcheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: taiki-e/install-action@v2
|
||||||
|
with:
|
||||||
|
tool: fd-find
|
||||||
|
- name: shellcheck
|
||||||
|
run: fd -e sh -t f -X shellcheck
|
|
@ -27,9 +27,8 @@ fi
|
||||||
|
|
||||||
./cargo-binstall -y --force cargo-binstall
|
./cargo-binstall -y --force cargo-binstall
|
||||||
|
|
||||||
if ! [[ -v CARGO_HOME ]]; then
|
CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
|
||||||
CARGO_HOME=$HOME/.cargo
|
|
||||||
fi
|
|
||||||
if ! [[ ":$PATH:" == *":$CARGO_HOME/bin:"* ]]; then
|
if ! [[ ":$PATH:" == *":$CARGO_HOME/bin:"* ]]; then
|
||||||
echo
|
echo
|
||||||
printf "\033[0;31mYour path is missing %s, you might want to add it.\033[0m\n" "$CARGO_HOME/bin"
|
printf "\033[0;31mYour path is missing %s, you might want to add it.\033[0m\n" "$CARGO_HOME/bin"
|
||||||
|
|
Loading…
Add table
Reference in a new issue