git.iko.soy/rowtype-yoga/package-sets
on master help sign in
Add CI check to verify that all packages are in the registry (#666)
commit90b50c71e6f89a2a673808e3f80ec3d8fa7dcbea authorFabrizio Ferrai <fabrizio.ferrai@gmail.com> dateTue 28 Jul 2020, 16:27 (6 years ago) parent7aa586a
3 files changed+28−2
Makefile+4−1 default.nix+1−1 verify-packages-in-registry.sh+23
Makefile+4−1
@@ -15,7 +15,10 @@ test-psc-package:
1515 @echo testing package set with psc-package
1616 @psc-package install
1717
18−ci: generate test-psc-package
18+verify-registry:
19+ @./verify-packages-in-registry.sh
20+
21+ci: generate verify-registry test-psc-package
1922 echo "Checking if packages.json has changed..."
2023 git diff --exit-code packages.json
2124 cd src && spago verify-set
default.nix+1−1
@@ -31,5 +31,5 @@ pkgs.runCommand "easy-ps-test" {
3131 builtins.attrValues {
3232 inherit (easy-dhall) dhall-simple dhall-json-simple;
3333 } ++
34− [ pkgs.git ];
34+ [ pkgs.git pkgs.wget pkgs.jq ];
3535} ""
verify-packages-in-registry.shnew file+23
@@ -0,0 +1,23 @@
1+#!/usr/bin/env nix-shell
2+#!nix-shell -i bash
3+
4+set -euo pipefail
5+
6+# This script checks that all the packages in the set are present in the registry
7+
8+wget https://raw.githubusercontent.com/purescript/registry/master/new-packages.json
9+wget https://raw.githubusercontent.com/purescript/registry/master/bower-packages.json
10+
11+REGISTRY=$(cat bower-packages.json new-packages.json | jq -s 'map(keys) | add | unique | map (sub("purescript-";""))')
12+PKGSET=$(cat packages.json | jq -s 'map(keys) | add')
13+
14+RESULT=$(jq -n --argjson registry "${REGISTRY}" --argjson pkgset "${PKGSET}" '$pkgset-$registry')
15+
16+
17+if [ "${RESULT}" == "[]" ]; then
18+ exit 0
19+else
20+ echo "[ERROR] Found some packages not in the registry:"
21+ echo $RESULT
22+ exit 1
23+fi