Skip to content

Commit ab67cbb

Browse files
authored
Merge pull request #1040 from dyc3/action-support-mac-arm
add support for mac and arm systems to the github action
2 parents ff76542 + 89fad31 commit ab67cbb

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

.github/workflows/test-action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ on: [pull_request]
44
jobs:
55
shallow:
66
name: Spell Check with Typos
7-
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest, macos-latest]
10+
runs-on: ${{ matrix.os }}
811
steps:
912
- name: Checkout Actions Repository
1013
uses: actions/checkout@v4
@@ -26,7 +29,10 @@ jobs:
2629

2730
deep:
2831
name: Spell Check with Type w/History
29-
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
os: [ubuntu-latest, macos-latest]
35+
runs-on: ${{ matrix.os }}
3036
steps:
3137
- name: Checkout Actions Repository
3238
uses: actions/checkout@v4

action/entrypoint.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,25 @@ if [[ -z $(ls ${TARGET} 2>/dev/null) ]]; then
1919
exit 1
2020
fi
2121

22+
2223
if [[ ! -x ${COMMAND} ]]; then
2324
VERSION=1.22.7
25+
if [[ "$(uname -m)" == "arm64" ]]; then
26+
ARCH="aarch64"
27+
else
28+
ARCH="x86_64"
29+
fi
30+
if [[ "$(uname -s)" == "Darwin" ]]; then
31+
TARGET_FILE="${ARCH}-apple-darwin"
32+
else
33+
TARGET_FILE="${ARCH}-unknown-linux-musl"
34+
fi
35+
FILE_NAME="typos-v${VERSION}-${TARGET_FILE}.tar.gz"
2436
log "Downloading 'typos' v${VERSION}"
25-
wget --progress=dot:mega "https://github.com/crate-ci/typos/releases/download/v${VERSION}/typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz"
37+
wget --progress=dot:mega "https://github.com/crate-ci/typos/releases/download/v${VERSION}/${FILE_NAME}"
2638
mkdir -p ${_INSTALL_DIR}
27-
tar -xzvf typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz -C ${_INSTALL_DIR} ./${CMD_NAME}
28-
rm typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz
39+
tar -xzvf "${FILE_NAME}" -C ${_INSTALL_DIR} ./${CMD_NAME}
40+
rm "${FILE_NAME}"
2941
fi
3042
log "jq: $(jq --version)"
3143

0 commit comments

Comments
 (0)