mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 02:20:58 -05:00
Merge pull request #1095 from zyf722/actions-windows
feat(action): Add Windows support to actions
This commit is contained in:
commit
fcfade456a
2 changed files with 23 additions and 5 deletions
12
.github/workflows/test-action.yml
vendored
12
.github/workflows/test-action.yml
vendored
|
@ -6,12 +6,16 @@ jobs:
|
||||||
name: Spell Check with Typos
|
name: Spell Check with Typos
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Actions Repository
|
- name: Checkout Actions Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install wget for Windows
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
run: choco install wget --no-progress
|
||||||
|
|
||||||
- name: Prepare file with mistakes.
|
- name: Prepare file with mistakes.
|
||||||
run: echo "Finallizes" > file.txt
|
run: echo "Finallizes" > file.txt
|
||||||
- name: Test force pass with mistakes
|
- name: Test force pass with mistakes
|
||||||
|
@ -31,7 +35,7 @@ jobs:
|
||||||
name: Spell Check with Type w/History
|
name: Spell Check with Type w/History
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Actions Repository
|
- name: Checkout Actions Repository
|
||||||
|
@ -39,6 +43,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install wget for Windows
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
run: choco install wget --no-progress
|
||||||
|
|
||||||
- name: Prepare file with mistakes.
|
- name: Prepare file with mistakes.
|
||||||
run: echo "Finallizes" > file.txt
|
run: echo "Finallizes" > file.txt
|
||||||
- name: Test force pass with mistakes
|
- name: Test force pass with mistakes
|
||||||
|
|
|
@ -27,16 +27,26 @@ if [[ ! -x ${COMMAND} ]]; then
|
||||||
else
|
else
|
||||||
ARCH="x86_64"
|
ARCH="x86_64"
|
||||||
fi
|
fi
|
||||||
if [[ "$(uname -s)" == "Darwin" ]]; then
|
UNAME=$(uname -s)
|
||||||
|
if [[ "$UNAME" == "Darwin" ]]; then
|
||||||
TARGET_FILE="${ARCH}-apple-darwin"
|
TARGET_FILE="${ARCH}-apple-darwin"
|
||||||
|
FILE_EXT="tar.gz"
|
||||||
|
elif [[ "$UNAME" == CYGWIN* || "$UNAME" == MINGW* || "$UNAME" == MSYS* ]] ; then
|
||||||
|
TARGET_FILE="${ARCH}-pc-windows-msvc"
|
||||||
|
FILE_EXT="zip"
|
||||||
else
|
else
|
||||||
TARGET_FILE="${ARCH}-unknown-linux-musl"
|
TARGET_FILE="${ARCH}-unknown-linux-musl"
|
||||||
|
FILE_EXT="tar.gz"
|
||||||
fi
|
fi
|
||||||
FILE_NAME="typos-v${VERSION}-${TARGET_FILE}.tar.gz"
|
FILE_NAME="typos-v${VERSION}-${TARGET_FILE}.${FILE_EXT}"
|
||||||
log "Downloading 'typos' v${VERSION}"
|
log "Downloading 'typos' v${VERSION}"
|
||||||
wget --progress=dot:mega "https://github.com/crate-ci/typos/releases/download/v${VERSION}/${FILE_NAME}"
|
wget --progress=dot:mega "https://github.com/crate-ci/typos/releases/download/v${VERSION}/${FILE_NAME}"
|
||||||
mkdir -p ${_INSTALL_DIR}
|
mkdir -p ${_INSTALL_DIR}
|
||||||
|
if [[ "$FILE_EXT" == "zip" ]]; then
|
||||||
|
unzip -o "${FILE_NAME}" -d ${_INSTALL_DIR} ${CMD_NAME}.exe
|
||||||
|
else
|
||||||
tar -xzvf "${FILE_NAME}" -C ${_INSTALL_DIR} ./${CMD_NAME}
|
tar -xzvf "${FILE_NAME}" -C ${_INSTALL_DIR} ./${CMD_NAME}
|
||||||
|
fi
|
||||||
rm "${FILE_NAME}"
|
rm "${FILE_NAME}"
|
||||||
fi
|
fi
|
||||||
log "jq: $(jq --version)"
|
log "jq: $(jq --version)"
|
||||||
|
|
Loading…
Reference in a new issue