Skip to content

Commit c43bd0c

Browse files
feat: add macos support (#6)
* 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>
1 parent 5e3e79c commit c43bd0c

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

.github/workflows/test.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ on:
66
pull_request:
77
jobs:
88
test-check:
9-
name: runner / ast-grep (github-check)
10-
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
os:
12+
- ubuntu-latest
13+
- macos-latest
14+
name: runner (${{ matrix.os }}) / ast-grep (github-check)
15+
runs-on: ${{ matrix.os }}
1116
steps:
1217
- uses: actions/checkout@v4
1318
- uses: ./

script.sh

+18-1
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,31 @@ echo '::group::🐶 Installing ast-grep ... https://github.com/ast-grep/ast-grep
2121
TEMP_PATH="$(mktemp -d)"
2222
PATH="${TEMP_PATH}:$PATH"
2323

24+
unameOS="$(uname -s)"
25+
case "${unameOS}" in
26+
Linux*) os=unknown-linux-gnu ;;
27+
Darwin*) os=apple-darwin ;;
28+
*) echo "Unsupported system: ${unameOS}" && exit 1 ;;
29+
esac
30+
31+
unameArch="$(uname -m)"
32+
case "${unameArch}" in
33+
x86*) arch=x86_64 ;;
34+
aarch64*) arch=aarch64 ;;
35+
arm64*) arch=aarch64 ;;
36+
*) echo "Unsupported architecture: ${unameArch}" && exit 1 ;;
37+
esac
38+
2439
curl --silent --show-error --fail \
25-
--location "https://github.com/ast-grep/ast-grep/releases/download/${INPUT_SG_VERSION}/app-x86_64-unknown-linux-gnu.zip" \
40+
--location "https://github.com/ast-grep/ast-grep/releases/download/${INPUT_SG_VERSION}/app-${arch}-${os}.zip" \
2641
--output "${TEMP_PATH}/sg.zip"
2742

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

47+
ast-grep --version
48+
3249
echo '::endgroup::'
3350

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

0 commit comments

Comments
 (0)