1{ sources ? import ./nix/sources.nix
2, gomod2nix ? sources.gomod2nix
3, haskellNix ? (import ../. {}).haskellNix
4, pkgs ? import haskellNix.sources.nixpkgs-2105 (haskellNix.nixpkgsArgs // {
5 overlays = haskellNix.nixpkgsArgs.overlays ++ [
7 buildGoApplication = super.callPackage (gomod2nix + "/builder") { };
11, compaRESThsPkgs ? (import ../. {}).hsPkgs
12, npmNix ? import (sources.npmNix + "/npmPackages") { inherit pkgs; }
13, mavenix ? import (sources.mavenix) { inherit pkgs; }
15, bumpDocumentation ? null
18 typeable-comparest = compaRESThsPkgs.comparest.components.exes.comparest;
19 typeable-comparest-exe = typeable-comparest + "/bin/comparest";
20 typeable-comparest-differ = pkgs.writeScript "typeable-comparest-differ" ''
21 #!${pkgs.stdenv.shell}
23 ${typeable-comparest-exe} -c $1 -s $2 -o $3/typeable.md
27 atlassian-openapi-diff = pkgs.mkYarnPackage {
28 name = "openapi-diff";
29 src = sources.atlassian-openapi-diff;
30 yarnLock = ./atlassian/yarn.lock;
31 patches = [ ./atlassian/addDist.patch ];
32 postBuild = "yarn run gulp compileDist";
34 atlassian-openapi-diff-exe = atlassian-openapi-diff + "/bin/openapi-diff";
35 atlassian-openapi-diff-differ = pkgs.writeScript "atlassian-openapi-diff-differ" ''
36 #!${pkgs.stdenv.shell}
38 ${atlassian-openapi-diff-exe} $1 $2 >$3/atlassian.json 2>$3/atlassian.error.txt
39 if [ ! -s $3/atlassian.error.txt ]; then
40 rm $3/atlassian.error.txt
45 openapitools-openapi-diff = mavenix.buildMaven {
47 src = sources.openapitools-openapi-diff;
49 infoFile = ./openapitools/mavenix.lock;
50 MAVEN_OPTS = "-Dgithook.plugin.skip=true";
52 openapitools-openapi-diff-exe =
53 pkgs.runCommand "openapitools-openapi-diff"
54 { buildInputs = [ pkgs.makeWrapper ]; }
55 ''makeWrapper ${pkgs.jdk}/bin/java $out --add-flags "-jar ${openapitools-openapi-diff}/share/java/openapi-diff-cli-2.0.0-SNAPSHOT-all.jar"'';
56 openapitools-openapi-diff-differ = pkgs.writeScript "openapitools-openapi-diff-differ" ''
57 #!${pkgs.stdenv.shell}
59 ${openapitools-openapi-diff-exe} $1 $2 --off --markdown $3/openapitools.md 2>$3/openapitools.error.txt
60 if [ ! -s $3/openapitools.error.txt ]; then
61 rm $3/openapitools.error.txt
66 oasdiff = pkgs.pkgs.buildGoApplication {
69 src = sources.oasdiff;
70 modules = ./oasdiff/gomod2nix.toml;
72 oasdiff-differ = pkgs.writeScript "oasdiff-differ" ''
73 #!${pkgs.stdenv.shell}
75 ${oasdiff}/bin/oasdiff -base $1 -revision $2 -format text >$3/oasdiff.txt 2>$3/oasdiff.error.txt
76 if [ ! -s $3/oasdiff.error.txt ]; then
77 rm $3/oasdiff.error.txt
82 bump-differ = { bumpToken, bumpDocumentation }: pkgs.writeScript "bump-differ" ''
83 #!${pkgs.stdenv.shell}
85 ${pkgs.httpie}/bin/https --ignore-stdin POST bump.sh/api/v1/versions definition=@$1 documentation=${bumpDocumentation} -a ${bumpToken}: >/dev/null
86 id=$(${pkgs.httpie}/bin/https --ignore-stdin POST bump.sh/api/v1/versions definition=@$2 documentation=${bumpDocumentation} -a ${bumpToken}: | ${pkgs.jq}/bin/jq -r .id)
90 echo "Not changed" > $3/bump.txt
94 while [ "$state" != "deployed" ]
96 state=$(${pkgs.httpie}/bin/https --ignore-stdin GET bump.sh/api/v1/versions/$id -a ${bumpToken}: | ${pkgs.jq}/bin/jq -r .state)
99 ${pkgs.httpie}/bin/https --ignore-stdin GET bump.sh/api/v1/versions/$id -a ${bumpToken}: | ${pkgs.jq}/bin/jq -r .diff_summary > $3/bump.txt
103 getInputs = with pkgs;
104 dir: lib.flatten (lib.mapAttrsToList
106 if type == "directory" then
108 path = dir + "/${name}";
109 contents = builtins.readDir path;
111 if contents."a.yaml" or null == "regular" && contents."b.yaml" or null == "regular"
116 (builtins.readDir dir)
119 runBenchmark = root: pkgs.runCommand "openapi-diff-benchmarks"
122 (path: builtins.toJSON {
123 relativePath = pkgs.lib.removePrefix (builtins.toString root) (builtins.toString path);
124 a = path + "/a.yaml";
125 b = path + "/b.yaml";
129 typeable-comparest-differ
130 atlassian-openapi-diff-differ
131 openapitools-openapi-diff-differ
134 if bumpToken == null || bumpDocumentation == null
135 then builtins.trace "Warning: bumpToken or bumpDocumentation not provided. Skipping bump.sh benchmarks." [ ]
136 else [ (bump-differ { inherit bumpToken bumpDocumentation; }) ]
140 echo "Running compatibility checks:"
143 a=$(echo $dir | ${pkgs.jq}/bin/jq -r .a)
144 b=$(echo $dir | ${pkgs.jq}/bin/jq -r .b)
145 relativePath=$(echo $dir | ${pkgs.jq}/bin/jq -r .relativePath)
146 echo "''\t$relativePath"
147 output=$out$relativePath
149 for differ in $differs
151 $differ $a $b $output
158 benchmarkReportTemplate = root:
167 foo = with pkgs.lib.strings;
168 concatMapStrings (x: "| " + x) ([ "" ] ++ tools) + "| \n" + concatMapStrings (_: "|---") ([ "" ] ++ tools) + "| \n" +
172 relativePath = pkgs.lib.removePrefix (builtins.toString root + "/") (builtins.toString path);
175 "[${relativePath}](./${relativePath})${concatMapStrings (_: " | ✅❌") tools} \n")
181runBenchmark ../test/golden/common
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list