From 89fad3115df0604d9f647bf7f2854fd78bd685ad Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Mon, 17 Jun 2024 11:11:57 -0400 Subject: [PATCH] feat[ci]: add support for mac and arm systems to the github action --- .github/workflows/test-action.yml | 10 ++++++++-- action/entrypoint.sh | 18 +++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index 92f7369f6..ea047f53a 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -4,7 +4,10 @@ on: [pull_request] jobs: shallow: name: Spell Check with Typos - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - name: Checkout Actions Repository uses: actions/checkout@v4 @@ -26,7 +29,10 @@ jobs: deep: name: Spell Check with Type w/History - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - name: Checkout Actions Repository uses: actions/checkout@v4 diff --git a/action/entrypoint.sh b/action/entrypoint.sh index 07731163a..71628d7ec 100755 --- a/action/entrypoint.sh +++ b/action/entrypoint.sh @@ -19,13 +19,25 @@ if [[ -z $(ls ${TARGET} 2>/dev/null) ]]; then exit 1 fi + if [[ ! -x ${COMMAND} ]]; then VERSION=1.22.7 + if [[ "$(uname -m)" == "arm64" ]]; then + ARCH="aarch64" + else + ARCH="x86_64" + fi + if [[ "$(uname -s)" == "Darwin" ]]; then + TARGET_FILE="${ARCH}-apple-darwin" + else + TARGET_FILE="${ARCH}-unknown-linux-musl" + fi + FILE_NAME="typos-v${VERSION}-${TARGET_FILE}.tar.gz" log "Downloading 'typos' v${VERSION}" - wget --progress=dot:mega "https://github.com/crate-ci/typos/releases/download/v${VERSION}/typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz" + wget --progress=dot:mega "https://github.com/crate-ci/typos/releases/download/v${VERSION}/${FILE_NAME}" mkdir -p ${_INSTALL_DIR} - tar -xzvf typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz -C ${_INSTALL_DIR} ./${CMD_NAME} - rm typos-v${VERSION}-x86_64-unknown-linux-musl.tar.gz + tar -xzvf "${FILE_NAME}" -C ${_INSTALL_DIR} ./${CMD_NAME} + rm "${FILE_NAME}" fi log "jq: $(jq --version)"