ci: Add scripts to install ast-grep in Linux jobs

Issue: #28119
This commit is contained in:
Brad King committed 2026-09-28 12:05:01 -04:00
1 parent 66cfa81885
commit becb6e063a
3 files changed
+35

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
# Ignore files known to be downloaded by CI jobs.
/6.9.3-0-202509261208*
/6.9.3-0-202509261207*
/ast-grep
/appimagetool
/bcc*
/cmake*
+3
View File
@@ -0,0 +1,3 @@
.gitlab/ci/ast-grep.sh
export PATH=$PWD/.gitlab/ast-grep:$PATH
ast-grep --version
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh
set -e
readonly version="0.45.3"
baseurl="https://github.com/ast-grep/ast-grep/releases/download/$version"
case "$(uname -s)-$(uname -m)" in
Linux-x86_64)
shatool="sha256sum"
sha256sum="f8ac830881339d1edee6b2652f54798c0f4da5a827f2db38a08ee31117783ce8"
filename="app-x86_64-unknown-linux-gnu"
;;
*)
echo "Unrecognized platform $(uname -s)-$(uname -m)"
exit 1
;;
esac
readonly shatool
readonly sha256sum
readonly tarball="$filename.zip"
cd .gitlab
echo "$sha256sum $tarball" > ast-grep.sha256sum
curl -OL "$baseurl/$tarball"
$shatool --check ast-grep.sha256sum
mkdir -p ast-grep
unzip -d ast-grep "$tarball" -x sg
rm "$tarball" ast-grep.sha256sum