From becb6e063a95dd370d697b3542a9ef6fca559894 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 28 Sep 2026 11:40:06 -0400 Subject: [PATCH] ci: Add scripts to install ast-grep in Linux jobs Issue: #28119 --- .gitlab/.gitignore | 1 + .gitlab/ci/ast-grep-env.sh | 3 +++ .gitlab/ci/ast-grep.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .gitlab/ci/ast-grep-env.sh create mode 100755 .gitlab/ci/ast-grep.sh diff --git a/.gitlab/.gitignore b/.gitlab/.gitignore index c0e73ebcde..82ec8f627a 100644 --- a/.gitlab/.gitignore +++ b/.gitlab/.gitignore @@ -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* diff --git a/.gitlab/ci/ast-grep-env.sh b/.gitlab/ci/ast-grep-env.sh new file mode 100644 index 0000000000..e0951cca72 --- /dev/null +++ b/.gitlab/ci/ast-grep-env.sh @@ -0,0 +1,3 @@ +.gitlab/ci/ast-grep.sh +export PATH=$PWD/.gitlab/ast-grep:$PATH +ast-grep --version diff --git a/.gitlab/ci/ast-grep.sh b/.gitlab/ci/ast-grep.sh new file mode 100755 index 0000000000..fd89d92134 --- /dev/null +++ b/.gitlab/ci/ast-grep.sh @@ -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