arduino-cli: add date and shortened commit SHA, added also some tests

Closes #77741.

Signed-off-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
master
Umberto Baldi 2021-05-21 16:56:23 +02:00 committed by BrewTestBot
parent a645b0317d
commit 2db586f98d
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
1 changed files with 8 additions and 2 deletions

View File

@ -5,6 +5,7 @@ class ArduinoCli < Formula
tag: "0.18.3",
revision: "d710b642ef7992a678053e9d68996c02f5863721"
license "GPL-3.0-only"
revision 1
head "https://github.com/arduino/arduino-cli.git"
livecheck do
@ -25,7 +26,8 @@ class ArduinoCli < Formula
ldflags = %W[
-s -w
-X github.com/arduino/arduino-cli/version.versionString=#{version}
-X github.com/arduino/arduino-cli/version.commit=#{Utils.git_head}
-X github.com/arduino/arduino-cli/version.commit=#{Utils.git_head(length: 8)}
-X github.com/arduino/arduino-cli/version.date=#{Time.now.utc.iso8601}
]
system "go", "build", *std_go_args, "-ldflags", ldflags.join(" ")
@ -44,6 +46,10 @@ class ArduinoCli < Formula
assert File.directory?("#{testpath}/test_sketch")
version_output = shell_output("#{bin}/arduino-cli version 2>&1")
assert_match "arduino-cli alpha Version: #{version}", version_output
assert_match("arduino-cli alpha Version: #{version}", version_output)
assert_match("Commit:", version_output)
assert_match(/[a-f0-9]{8}/, version_output)
assert_match("Date: ", version_output)
assert_match(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/, version_output)
end
end