[describe] add commit SHA to describe (#1747)

This commit is contained in:
Rahuλ Dé 2024-10-13 19:07:04 +01:00 committed by GitHub
parent 01cb6112f9
commit 24c644d9f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 34 additions and 3 deletions

View file

@ -84,7 +84,8 @@
:BABASHKA_PLATFORM "linux"
:GRAALVM_VERSION graalvm-version
:GRAALVM_HOME graalvm-home
:BABASHKA_TEST_ENV "jvm"}
:BABASHKA_TEST_ENV "jvm"
:BABASHKA_SHA (System/getenv "CIRCLE_SHA1")}
:resource_class "large"
:steps
(gen-steps
@ -128,7 +129,8 @@ java -jar \"$jar\" --config .build/bb.edn --deps-root . release-artifact \"$refl
"macos"
platform)
:BABASHKA_TEST_ENV "native"
:BABASHKA_XMX "-J-Xmx6500m"}
:BABASHKA_XMX "-J-Xmx6500m"
:BABASHKA_SHA (System/getenv "CIRCLE_SHA1")}
env (if (= "aarch64" arch)
(assoc env :BABASHKA_ARCH arch)
env)

View file

@ -24,6 +24,8 @@ task:
sudo /usr/sbin/softwareupdate --install-rosetta --agree-to-license
java -version
export BABASHKA_SHA=$(git rev-parse HEAD)
script/uberjar
# curl -sLO 'https://github.com/babashka/pgo-profiles/releases/download/2023.10.11/default.iprof'
script/compile # --pgo=default.iprof

View file

@ -24,6 +24,7 @@ jobs:
LEIN_ROOT: "true"
BABASHKA_PLATFORM: linux # could be used in jar name
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BABASHKA_SHA: ${{ github.sha }}
steps:
- name: Git checkout
uses: actions/checkout@v2
@ -107,6 +108,7 @@ jobs:
BABASHKA_TEST_ENV: native
BABASHKA_XMX: "-J-Xmx6500m"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BABASHKA_SHA: ${{ github.sha }}
steps:
- name: Git checkout
uses: actions/checkout@v2

View file

@ -61,6 +61,8 @@ build_script:
# see https://github.com/quarkusio/quarkus/pull/7663
- cmd: >-
set BABASHKA_SHA=%APPVEYOR_REPO_COMMIT%
call script/uberjar.bat
call script/compile.bat

View file

@ -53,4 +53,5 @@ Args=-H:+ReportExceptionStackTraces \
-EBABASHKA_FEATURE_LANTERNA \
-EBABASHKA_FEATURE_SPEC_ALPHA \
-EBABASHKA_FEATURE_RRB_VECTOR \
-EBABASHKA_REQUIRE_SCAN
-EBABASHKA_REQUIRE_SCAN \
-EBABASHKA_SHA

View file

@ -107,4 +107,14 @@ then
export BABASHKA_FEATURE_PRIORITY_MAP="${BABASHKA_FEATURE_PRIORITY_MAP:-false}"
fi
if [[ -z "$BABASHKA_SHA" ]]
then
sha=$(git rev-parse HEAD)
if [[ $? -eq 0 ]]; then
export BABASHKA_SHA=$sha
fi
fi
"$GRAALVM_HOME/bin/native-image" "${args[@]}" "$@"
./"$BABASHKA_BINARY" describe

View file

@ -23,6 +23,13 @@ Rem -H:EnableURLProtocols=jar,http,https is also not supported.
call %GRAALVM_HOME%\bin\gu.cmd install native-image
if "%BABASHKA_SHA%"=="" (
for /f %%i in ('git rev-parse HEAD') do set sha=%%i
if not errorlevel 1 (
set BABASHKA_SHA=%sha%
)
)
call %GRAALVM_HOME%\bin\native-image.cmd ^
"-jar" "target/babashka-%BABASHKA_VERSION%-standalone.jar" ^
"-H:Name=bb" ^
@ -39,3 +46,4 @@ call %GRAALVM_HOME%\bin\native-image.cmd ^
if %errorlevel% neq 0 exit /b %errorlevel%
call bb "(+ 1 2 3)"
call bb describe

View file

@ -110,6 +110,8 @@
(def version common/version)
(def build-commit-sha (or (System/getenv "BABASHKA_SHA") ""))
(defn parse-version [version]
(mapv #(Integer/parseInt %)
(-> version
@ -261,6 +263,7 @@ Use bb run --help to show this help output.
(format
(str/trim "
{:babashka/version \"%s\"
:git/sha \"%s\"
:feature/csv %s
:feature/java-nio %s
:feature/java-time %s
@ -281,6 +284,7 @@ Use bb run --help to show this help output.
:feature/logging %s
:feature/priority-map %s}")
version
build-commit-sha
features/csv?
features/java-nio?
features/java-time?