Skip to content

Commit

Permalink
Merge pull request #1095 from zyf722/actions-windows
Browse files Browse the repository at this point in the history
feat(action): Add Windows support to actions
  • Loading branch information
epage authored Sep 4, 2024
2 parents 853bbe8 + 264f549 commit fcfade4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ jobs:
name: Spell Check with Typos
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Actions Repository
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.
run: echo "Finallizes" > file.txt
- name: Test force pass with mistakes
Expand All @@ -31,14 +35,18 @@ jobs:
name: Spell Check with Type w/History
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install wget for Windows
if: matrix.os == 'windows-latest'
run: choco install wget --no-progress

- name: Prepare file with mistakes.
run: echo "Finallizes" > file.txt
- name: Test force pass with mistakes
Expand Down
16 changes: 13 additions & 3 deletions action/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,26 @@ if [[ ! -x ${COMMAND} ]]; then
else
ARCH="x86_64"
fi
if [[ "$(uname -s)" == "Darwin" ]]; then
UNAME=$(uname -s)
if [[ "$UNAME" == "Darwin" ]]; then
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
TARGET_FILE="${ARCH}-unknown-linux-musl"
FILE_EXT="tar.gz"
fi
FILE_NAME="typos-v${VERSION}-${TARGET_FILE}.tar.gz"
FILE_NAME="typos-v${VERSION}-${TARGET_FILE}.${FILE_EXT}"
log "Downloading 'typos' v${VERSION}"
wget --progress=dot:mega "https://github.com/crate-ci/typos/releases/download/v${VERSION}/${FILE_NAME}"
mkdir -p ${_INSTALL_DIR}
tar -xzvf "${FILE_NAME}" -C ${_INSTALL_DIR} ./${CMD_NAME}
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}
fi
rm "${FILE_NAME}"
fi
log "jq: $(jq --version)"
Expand Down

0 comments on commit fcfade4

Please sign in to comment.