Skip to content

Commit

Permalink
feat: add macos support (#6)
Browse files Browse the repository at this point in the history
* feat: add macos support

Signed-off-by: Rintaro Okamura <[email protected]>

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore: add `ast-grep --version` command

Signed-off-by: Rintaro Okamura <[email protected]>

---------

Signed-off-by: Rintaro Okamura <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
rinx and github-actions[bot] authored Aug 25, 2024
1 parent 5e3e79c commit c43bd0c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ on:
pull_request:
jobs:
test-check:
name: runner / ast-grep (github-check)
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
name: runner (${{ matrix.os }}) / ast-grep (github-check)
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./
Expand Down
19 changes: 18 additions & 1 deletion script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,31 @@ echo '::group::🐶 Installing ast-grep ... https://github.com/ast-grep/ast-grep
TEMP_PATH="$(mktemp -d)"
PATH="${TEMP_PATH}:$PATH"

unameOS="$(uname -s)"
case "${unameOS}" in
Linux*) os=unknown-linux-gnu ;;
Darwin*) os=apple-darwin ;;
*) echo "Unsupported system: ${unameOS}" && exit 1 ;;
esac

unameArch="$(uname -m)"
case "${unameArch}" in
x86*) arch=x86_64 ;;
aarch64*) arch=aarch64 ;;
arm64*) arch=aarch64 ;;
*) echo "Unsupported architecture: ${unameArch}" && exit 1 ;;
esac

curl --silent --show-error --fail \
--location "https://github.com/ast-grep/ast-grep/releases/download/${INPUT_SG_VERSION}/app-x86_64-unknown-linux-gnu.zip" \
--location "https://github.com/ast-grep/ast-grep/releases/download/${INPUT_SG_VERSION}/app-${arch}-${os}.zip" \
--output "${TEMP_PATH}/sg.zip"

unzip -u "${TEMP_PATH}/sg.zip" -d "${TEMP_PATH}/temp-sg"
install "${TEMP_PATH}/temp-sg/ast-grep" "${TEMP_PATH}"
rm -rf "${TEMP_PATH}/sg.zip" "${TEMP_PATH}/temp-sg"

ast-grep --version

echo '::endgroup::'

echo '::group:: Running ast-grep with reviewdog 🐶 ...'
Expand Down

0 comments on commit c43bd0c

Please sign in to comment.