gauge: update plugins and add tests (#335080)
This commit is contained in:
@@ -3,6 +3,7 @@ lib.makeScope pkgs.newScope (final: let
|
||||
inherit (final) callPackage;
|
||||
in {
|
||||
makeGaugePlugin = callPackage ./make-gauge-plugin.nix { };
|
||||
testGaugePlugins = callPackage ./test-gauge-plugins.nix { };
|
||||
dotnet = callPackage ./dotnet { };
|
||||
html-report = callPackage ./html-report { };
|
||||
java = callPackage ./java { };
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"version": "0.10.3",
|
||||
"version": "0.11.0",
|
||||
"aarch64-darwin": {
|
||||
"url": "https://github.com/getgauge/gauge-java/releases/download/v0.10.3/gauge-java-0.10.3-darwin.arm64.zip",
|
||||
"hash": "sha256-Hs9ZNupj0s7YRjRZibphr7m5YjOj3MTgx/hqAbWyY6I="
|
||||
"url": "https://github.com/getgauge/gauge-java/releases/download/v0.11.0/gauge-java-0.11.0-darwin.arm64.zip",
|
||||
"hash": "sha256-o7viYih6oghPipGmpsdGZXxtML4++Ux7Qul8pRzkdUc="
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"url": "https://github.com/getgauge/gauge-java/releases/download/v0.10.3/gauge-java-0.10.3-darwin.x86_64.zip",
|
||||
"hash": "sha256-Hj/Lkwsx/RvyMiJO8dI6vFpIvvyhOA2Un5deC1syYY4="
|
||||
"url": "https://github.com/getgauge/gauge-java/releases/download/v0.11.0/gauge-java-0.11.0-darwin.x86_64.zip",
|
||||
"hash": "sha256-wTXVuyXU9mfVxAc/l0mgvKt3c/jinffILBUhe/tikgs="
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"url": "https://github.com/getgauge/gauge-java/releases/download/v0.10.3/gauge-java-0.10.3-linux.arm64.zip",
|
||||
"hash": "sha256-XJqP2eew+aI1jFaDzsJhfML8Ft+adFJrHURF8F391Pc="
|
||||
"url": "https://github.com/getgauge/gauge-java/releases/download/v0.11.0/gauge-java-0.11.0-linux.arm64.zip",
|
||||
"hash": "sha256-CsEzoNseWllbNtN5mOYVCPvTPlm60fd7eSXuTpxbRx8="
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"url": "https://github.com/getgauge/gauge-java/releases/download/v0.10.3/gauge-java-0.10.3-linux.x86_64.zip",
|
||||
"hash": "sha256-sMyWhAGo6oa7MsqK8xApdrwhZo8NkSTIRbsCu5LW3ls="
|
||||
"url": "https://github.com/getgauge/gauge-java/releases/download/v0.11.0/gauge-java-0.11.0-linux.x86_64.zip",
|
||||
"hash": "sha256-zig+Wq6uyBl8fKfjcpKCRFtHBZ/xFeDaUrUqvx1ails="
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
, lib
|
||||
, writeScript
|
||||
, autoPatchelfHook
|
||||
, testGaugePlugins
|
||||
}:
|
||||
|
||||
{ pname
|
||||
@@ -34,64 +35,67 @@ stdenvNoCC.mkDerivation (finalAttrs: (lib.recursiveUpdate {
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ autoPatchelfHook ];
|
||||
nativeBuildInputs = lib.optional stdenvNoCC.hostPlatform.isLinux autoPatchelfHook;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/share/gauge-plugins/${pname}/${finalAttrs.version}"
|
||||
cp -r . "$out/share/gauge-plugins/${pname}/${finalAttrs.version}"
|
||||
'';
|
||||
|
||||
passthru.updateScript = writeScript "update-${finalAttrs.pname}" ''
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl nix-prefetch yq-go
|
||||
passthru = {
|
||||
tests.loadPlugin = testGaugePlugins { plugins = [ finalAttrs.finalPackage ]; };
|
||||
updateScript = writeScript "update-${finalAttrs.pname}" ''
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl nix-prefetch yq-go
|
||||
|
||||
set -e
|
||||
set -e
|
||||
|
||||
dirname="pkgs/development/tools/gauge/plugins/${pname}"
|
||||
dirname="pkgs/development/tools/gauge/plugins/${pname}"
|
||||
|
||||
currentVersion=$(nix eval --raw -f default.nix gaugePlugins.${pname}.version)
|
||||
currentVersion=$(nix eval --raw -f default.nix gaugePlugins.${pname}.version)
|
||||
|
||||
latestTag=$(curl -s ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} https://api.github.com/repos/${repo}/releases/latest | yq ".tag_name")
|
||||
latestVersion="$(expr $latestTag : 'v\(.*\)')"
|
||||
latestTag=$(curl -s ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} https://api.github.com/repos/${repo}/releases/latest | yq ".tag_name")
|
||||
latestVersion="$(expr $latestTag : 'v\(.*\)')"
|
||||
|
||||
tempfile=$(mktemp)
|
||||
tempfile=$(mktemp)
|
||||
|
||||
if [[ "$FORCE_UPDATE" != "true" && "$currentVersion" == "$latestVersion" ]]; then
|
||||
echo "gauge-${pname} is up-to-date: ''${currentVersion}"
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$FORCE_UPDATE" != "true" && "$currentVersion" == "$latestVersion" ]]; then
|
||||
echo "gauge-${pname} is up-to-date: ''${currentVersion}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
yq -iPoj "{ \"version\": \"$latestVersion\" }" "$tempfile"
|
||||
yq -iPoj "{ \"version\": \"$latestVersion\" }" "$tempfile"
|
||||
|
||||
updateSystem() {
|
||||
system=$1
|
||||
url=$2
|
||||
updateSystem() {
|
||||
system=$1
|
||||
url=$2
|
||||
|
||||
echo "Fetching hash for $system"
|
||||
hash=$(nix-prefetch-url --type sha256 $url --unpack)
|
||||
sriHash="$(nix hash to-sri --type sha256 $hash)"
|
||||
echo "Fetching hash for $system"
|
||||
hash=$(nix-prefetch-url --type sha256 $url --unpack)
|
||||
sriHash="$(nix hash to-sri --type sha256 $hash)"
|
||||
|
||||
yq -iPoj '. + { "$system": { "url": "$url", "hash": "$sriHash" } }' "$tempfile"
|
||||
}
|
||||
yq -iPoj ". + { \"$system\": { \"url\": \"$url\", \"hash\": \"$sriHash\" } }" "$tempfile"
|
||||
}
|
||||
|
||||
updateSingle() {
|
||||
url=$1
|
||||
updateSingle() {
|
||||
url=$1
|
||||
|
||||
echo "Fetching hash"
|
||||
hash=$(nix-prefetch-url --type sha256 $url --unpack)
|
||||
sriHash="$(nix hash to-sri --type sha256 $hash)"
|
||||
echo "Fetching hash"
|
||||
hash=$(nix-prefetch-url --type sha256 $url --unpack)
|
||||
sriHash="$(nix hash to-sri --type sha256 $hash)"
|
||||
|
||||
yq -iPoj '. + { "url": "$url", "hash": "$sriHash" }' "$tempfile"
|
||||
}
|
||||
yq -iPoj ". + { \"url\": \"$url\", \"hash\": \"$sriHash\" }" "$tempfile"
|
||||
}
|
||||
|
||||
baseUrl="https://github.com/${repo}/releases/download/$latestTag/${releasePrefix}$latestVersion"
|
||||
baseUrl="https://github.com/${repo}/releases/download/$latestTag/${releasePrefix}$latestVersion"
|
||||
|
||||
${if isCrossArch then
|
||||
"updateSingle \${baseUrl}.zip"
|
||||
else
|
||||
lib.concatStringsSep "\n" (map (platform: ''updateSystem "${platform}" "''${baseUrl}-${systemMap.${platform}}.zip"'') meta.platforms)
|
||||
}
|
||||
${if isCrossArch then
|
||||
"updateSingle \${baseUrl}.zip"
|
||||
else
|
||||
lib.concatStringsSep "\n" (map (platform: ''updateSystem "${platform}" "''${baseUrl}-${systemMap.${platform}}.zip"'') meta.platforms)
|
||||
}
|
||||
|
||||
mv "$tempfile" "$dirname/data.json"
|
||||
'';
|
||||
mv "$tempfile" "$dirname/data.json"
|
||||
'';
|
||||
};
|
||||
} otherArgs))
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"version": "0.8.0",
|
||||
"version": "0.9.2",
|
||||
"aarch64-darwin": {
|
||||
"url": "https://github.com/getgauge/gauge-ruby/releases/download/v0.8.0/gauge-ruby-0.8.0-darwin.arm64.zip",
|
||||
"hash": "sha256-HQ7reuC7dQUMbhEzUBiEelPmFBsFJBHe42lmFufkZJY="
|
||||
"url": "https://github.com/getgauge/gauge-ruby/releases/download/v0.9.2/gauge-ruby-0.9.2-darwin.arm64.zip",
|
||||
"hash": "sha256-QPwqgQ+Qd+eHbw445GstcPqEODoKcvvt+YJxsJqxtPc="
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"url": "https://github.com/getgauge/gauge-ruby/releases/download/v0.8.0/gauge-ruby-0.8.0-darwin.x86_64.zip",
|
||||
"hash": "sha256-poxT9wYgs21GRx/eVvD7jA1T0VBDEHgH0Zv941pZcKA="
|
||||
"url": "https://github.com/getgauge/gauge-ruby/releases/download/v0.9.2/gauge-ruby-0.9.2-darwin.x86_64.zip",
|
||||
"hash": "sha256-AWe5S8QXkps6eV1+1GZbHY/S+kY/QQoiG/gbddZHZdk="
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"url": "https://github.com/getgauge/gauge-ruby/releases/download/v0.8.0/gauge-ruby-0.8.0-linux.arm64.zip",
|
||||
"hash": "sha256-SAEHPaWScux6C05jQBfDuLBN2J22Df9eKVM46kWawiU="
|
||||
"url": "https://github.com/getgauge/gauge-ruby/releases/download/v0.9.2/gauge-ruby-0.9.2-linux.arm64.zip",
|
||||
"hash": "sha256-7d6FETLrd7OePiWWRu+5OMKKH9t9H+ZnQCqqYTsuRrk="
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"url": "https://github.com/getgauge/gauge-ruby/releases/download/v0.8.0/gauge-ruby-0.8.0-linux.x86_64.zip",
|
||||
"hash": "sha256-aXLDK/7phdsX0CmIuxfK39mdrjGo2IpwYBL7uolP5Mk="
|
||||
"url": "https://github.com/getgauge/gauge-ruby/releases/download/v0.9.2/gauge-ruby-0.9.2-linux.x86_64.zip",
|
||||
"hash": "sha256-iPHQ5Tx3iCb/e3RoF5P2grCbNBFuagezQrABK7snFvw="
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"x86_64-darwin": {
|
||||
"url": "https://github.com/getgauge/gauge_screenshot/releases/download/v0.2.0/screenshot-0.2.0-darwin.x86_64.zip",
|
||||
"hash": "sha256-7bFuInEYAQ+fN12HTazQNfqpz5DAkYNCjUJbaj0DYb4="
|
||||
"url": "https://github.com/getgauge/gauge_screenshot/releases/download/v0.3.0/screenshot-0.3.0-darwin.x86_64.zip",
|
||||
"hash": "sha256-2PL0WrIpfDCK5+aKH1rtNVBTiIPYHU4f81UZpv9M2sQ="
|
||||
},
|
||||
"aarch64-darwin": {
|
||||
"url": "https://github.com/getgauge/gauge_screenshot/releases/download/v0.2.0/screenshot-0.2.0-darwin.arm64.zip",
|
||||
"hash": "sha256-Ly6iHBc2PfeFkKkZIkyD2JD5+EpFNL4SDjzG1oMpKfA="
|
||||
"url": "https://github.com/getgauge/gauge_screenshot/releases/download/v0.3.0/screenshot-0.3.0-darwin.arm64.zip",
|
||||
"hash": "sha256-QfpylVGxE/qKiN57ni4aJsh8Dfg/VIN9vfd1nHX2QO0="
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"url": "https://github.com/getgauge/gauge_screenshot/releases/download/v0.2.0/screenshot-0.2.0-linux.arm64.zip",
|
||||
"hash": "sha256-Pzfnhs4H0MmeBIhrZElFmvC+PuabLNU/pftVdIu4+LI="
|
||||
"url": "https://github.com/getgauge/gauge_screenshot/releases/download/v0.3.0/screenshot-0.3.0-linux.arm64.zip",
|
||||
"hash": "sha256-HfO2KjK1xSp6xw9F38JjkrUs7JfxkrdltRr6j5/5Cw8="
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"url": "https://github.com/getgauge/gauge_screenshot/releases/download/v0.2.0/screenshot-0.2.0-linux.x86_64.zip",
|
||||
"hash": "sha256-Wpuq3aSgbIhd4WuJx4SMv+NbEZMVIpAOUMdKV2xxd7c="
|
||||
"url": "https://github.com/getgauge/gauge_screenshot/releases/download/v0.3.0/screenshot-0.3.0-linux.x86_64.zip",
|
||||
"hash": "sha256-2EEUI2jBmEC2JfeJizFqNzINZtYy/y1c+B70hE1hCQk="
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
runCommand,
|
||||
gauge,
|
||||
lib,
|
||||
}:
|
||||
|
||||
/**
|
||||
Creates a gauge install with all given plugins and makes sure every plugin is loaded.
|
||||
*/
|
||||
{ plugins }:
|
||||
|
||||
let
|
||||
gaugeWithPlugins = gauge.withPlugins (_: plugins);
|
||||
in
|
||||
|
||||
runCommand "gauge-test" { nativeBuildInputs = [ gaugeWithPlugins ]; } ''
|
||||
mkdir $out
|
||||
echo $(gauge install || true) > $out/output.txt
|
||||
|
||||
function checkPlugin() {
|
||||
plugin="$1"
|
||||
version="$2"
|
||||
|
||||
echo Checking for plugin $plugin version $version
|
||||
if ! grep "$plugin ($version)" $out/output.txt
|
||||
then
|
||||
echo "Couldn't find plugin $plugin version $version"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
${lib.concatMapStringsSep "\n" (
|
||||
p: "checkPlugin '${lib.removePrefix "gauge-plugin-" p.pname}' '${p.version}'"
|
||||
) plugins}
|
||||
''
|
||||
@@ -6,6 +6,7 @@
|
||||
, xorg
|
||||
, gaugePlugins
|
||||
, plugins ? []
|
||||
, runCommand
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
@@ -53,6 +54,8 @@ stdenvNoCC.mkDerivation {
|
||||
requiredPlugins = with manifest; [ Language ] ++ Plugins;
|
||||
manifestPlugins = plugins: map (name: plugins.${name} or (throw "Gauge plugin ${name} is not available!")) requiredPlugins;
|
||||
in gauge.withPlugins manifestPlugins;
|
||||
# Builds gauge with all plugins and checks for successful installation
|
||||
tests.allPlugins = gaugePlugins.testGaugePlugins { plugins = lib.filter lib.isDerivation (lib.attrValues gaugePlugins); };
|
||||
};
|
||||
|
||||
inherit (gauge-unwrapped) meta;
|
||||
|
||||
Reference in New Issue
Block a user