diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8486aa3..ba81649 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: ./ diff --git a/script.sh b/script.sh index 02fdff2..5b19fac 100755 --- a/script.sh +++ b/script.sh @@ -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 🐶 ...'