Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(action): Add Windows support to actions #1095

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading