diff options
author | Johannes Jöns | 2024-08-30 20:57:06 +0000 |
---|---|---|
committer | GitHub | 2024-08-30 20:57:06 +0000 |
commit | b762fd2bfd8b56fb5f9125fd7335d9ddca80603f (patch) | |
tree | 97294597af1fa6f1b6c41ccb5f29b9a6b4bcb80f /pkgs | |
parent | 2d3ffea1966d409f7b9b14a18ee92307d983dedc (diff) | |
parent | ad16a8d0524fee884fa38a5b7e145d2fa9827f9c (diff) |
gauge: update plugins and add tests (#335080)
Diffstat (limited to 'pkgs')
7 files changed, 108 insertions, 65 deletions
diff --git a/pkgs/development/tools/gauge/plugins/default.nix b/pkgs/development/tools/gauge/plugins/default.nix index 92ee2fca77d0..b68d48ba4767 100644 --- a/pkgs/development/tools/gauge/plugins/default.nix +++ b/pkgs/development/tools/gauge/plugins/default.nix @@ -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 { }; diff --git a/pkgs/development/tools/gauge/plugins/java/data.json b/pkgs/development/tools/gauge/plugins/java/data.json index 96c993e6f306..f5a9e09edfdc 100644 --- a/pkgs/development/tools/gauge/plugins/java/data.json +++ b/pkgs/development/tools/gauge/plugins/java/data.json @@ -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=" } } diff --git a/pkgs/development/tools/gauge/plugins/make-gauge-plugin.nix b/pkgs/development/tools/gauge/plugins/make-gauge-plugin.nix index 81fbff823802..acf902e1b79d 100644 --- a/pkgs/development/tools/gauge/plugins/make-gauge-plugin.nix +++ b/pkgs/development/tools/gauge/plugins/make-gauge-plugin.nix @@ -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)) diff --git a/pkgs/development/tools/gauge/plugins/ruby/data.json b/pkgs/development/tools/gauge/plugins/ruby/data.json index b7f827cfc569..95316f6b7ca0 100644 --- a/pkgs/development/tools/gauge/plugins/ruby/data.json +++ b/pkgs/development/tools/gauge/plugins/ruby/data.json @@ -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=" } } diff --git a/pkgs/development/tools/gauge/plugins/screenshot/data.json b/pkgs/development/tools/gauge/plugins/screenshot/data.json index c836d5a84a95..bc2c83ad6425 100644 --- a/pkgs/development/tools/gauge/plugins/screenshot/data.json +++ b/pkgs/development/tools/gauge/plugins/screenshot/data.json @@ -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=" } } diff --git a/pkgs/development/tools/gauge/plugins/test-gauge-plugins.nix b/pkgs/development/tools/gauge/plugins/test-gauge-plugins.nix new file mode 100644 index 000000000000..3648e87f7b91 --- /dev/null +++ b/pkgs/development/tools/gauge/plugins/test-gauge-plugins.nix @@ -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} +'' diff --git a/pkgs/development/tools/gauge/wrapper.nix b/pkgs/development/tools/gauge/wrapper.nix index 67b1a8ddc52b..8f4ceca25e9e 100644 --- a/pkgs/development/tools/gauge/wrapper.nix +++ b/pkgs/development/tools/gauge/wrapper.nix @@ -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; |