git.iko.soy/typeable/compaREST
on fbd027d help sign in
.github/actions/common_setup/action.yaml+2−2
since splitsnapshots
unifiedsplit
@@ -30,13 +30,13 @@ runs:
30 fi
30 fi
31
31
32 - name: Install Nix
32 - name: Install Nix
33− uses: cachix/install-nix-action@v27
33+ uses: cachix/install-nix-action@v16
34 with:
34 with:
35 extra_nix_config: |
35 extra_nix_config: |
36 system-features = kvm
36 system-features = kvm
37 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
37 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
38 substituters = https://hydra.iohk.io https://cache.nixos.org/
38 substituters = https://hydra.iohk.io https://cache.nixos.org/
39− - uses: cachix/cachix-action@v15
39+ - uses: cachix/cachix-action@v10
40 with:
40 with:
41 name: typeable
41 name: typeable
42 authToken: "${{ inputs.authToken }}"
42 authToken: "${{ inputs.authToken }}"
.github/workflows/github-actions-image.yaml+53−63
@@ -9,34 +9,29 @@ on:
9 types: [prereleased]
9 types: [prereleased]
10
10
11jobs:
11jobs:
12−# check-formatting:
12+ check-formatting:
13−# name: Check Haskell formatting
13+ name: Check Haskell formatting
14−# runs-on: ubuntu-latest
15−# steps:
16−# - uses: actions/checkout@v2
17−#
18−# - name: Common setup
19−# uses: ./.github/actions/common_setup
20−# with:
21−# authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
22−#
23−# - name: Run fourmolu
24−# run: |
25−# nix-shell nix/ci.nix -j auto --run "git ls-files '*.hs' | xargs fourmolu -m inplace -o -XRecursiveDo -o -XTypeApplications -o -XPatternSynonyms -o -XBangPatterns"
26−# git diff --exit-code
27−
28− check_versions:
29 runs-on: ubuntu-latest
14 runs-on: ubuntu-latest
30 steps:
15 steps:
31 - uses: actions/checkout@v2
16 - uses: actions/checkout@v2
32− with:
33− submodules: recursive
34
17
35 - name: Common setup
18 - name: Common setup
36 uses: ./.github/actions/common_setup
19 uses: ./.github/actions/common_setup
37 with:
20 with:
38 authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
21 authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
39
22
23+ - name: Run fourmolu
24+ run: |
25+ nix-shell nix/ci.nix -j auto --run "git ls-files '*.hs' | xargs fourmolu -m inplace -o -XRecursiveDo -o -XTypeApplications -o -XPatternSynonyms -o -XBangPatterns"
26+ git diff --exit-code
27+
28+ check_versions:
29+ runs-on: ubuntu-latest
30+ steps:
31+ - uses: actions/checkout@v2
32+ with:
33+ submodules: recursive
34+
40 - name: Check library version
35 - name: Check library version
41 if: github.event_name == 'release'
36 if: github.event_name == 'release'
42 run: |
37 run: |
@@ -159,18 +154,13 @@ jobs:
159 tag: ${{ github.ref }}
154 tag: ${{ github.ref }}
160
155
161 dist:
156 dist:
162− needs: [check_versions, Linux]
157+ needs: check_versions
163 runs-on: ubuntu-latest
158 runs-on: ubuntu-latest
164 steps:
159 steps:
165 - uses: actions/checkout@v2
160 - uses: actions/checkout@v2
166 with:
161 with:
167 submodules: recursive
162 submodules: recursive
168
163
169− - name: Common setup
170− uses: ./.github/actions/common_setup
171− with:
172− authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
173−
174 - name: Cache
164 - name: Cache
175 uses: actions/cache@v1
165 uses: actions/cache@v1
176 with:
166 with:
@@ -189,7 +179,7 @@ jobs:
189
179
190 - name: Build dist
180 - name: Build dist
191 run: |
181 run: |
192− stack sdist --pvp-bounds both
182+ stack sdist --pvp-bounds both --test-tarball
193 echo "distPath=$(stack path | awk -F ": " '/dist-dir/ {print $2}')" >> $GITHUB_ENV
183 echo "distPath=$(stack path | awk -F ": " '/dist-dir/ {print $2}')" >> $GITHUB_ENV
194
184
195 - name: Upload compaREST sources artifact
185 - name: Upload compaREST sources artifact
@@ -213,7 +203,7 @@ jobs:
213 env:
203 env:
214 HACKAGE_KEY: ${{ secrets.HACKAGE_KEY }}
204 HACKAGE_KEY: ${{ secrets.HACKAGE_KEY }}
215 run: |
205 run: |
216− stack upload --pvp-bounds both --candidate .
206+ stack upload --pvp-bounds both --test-tarball --candidate .
217
207
218 macOS:
208 macOS:
219 needs: check_versions
209 needs: check_versions
@@ -252,39 +242,39 @@ jobs:
252 file: compaREST-macOS-x86.zip
242 file: compaREST-macOS-x86.zip
253 tag: ${{ github.ref }}
243 tag: ${{ github.ref }}
254
244
255−# Linux-Windows:
245+ Linux-Windows:
256−# needs: check_versions
246+ needs: check_versions
257−# runs-on: ubuntu-latest
247+ runs-on: ubuntu-latest
258−# steps:
248+ steps:
259−# - uses: actions/checkout@v2
249+ - uses: actions/checkout@v2
260−# with:
250+ with:
261−# submodules: recursive
251+ submodules: recursive
262−#
252+
263−# - name: Common setup
253+ - name: Common setup
264−# uses: ./.github/actions/common_setup
254+ uses: ./.github/actions/common_setup
265−# with:
255+ with:
266−# authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
256+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
267−#
257+
268−# - name: Build Windows binary
258+ - name: Build Windows binary
269−# run: |
259+ run: |
270−# cp -LR $(nix-build -A WindowsCompaRESTBin -j auto --no-out-link)/bin compaREST
260+ cp -LR $(nix-build -A WindowsCompaRESTBin -j auto --no-out-link)/bin compaREST
271−#
261+
272−# - name: Upload Windows compaREST bundle
262+ - name: Upload Windows compaREST bundle
273−# uses: actions/upload-artifact@v2
263+ uses: actions/upload-artifact@v2
274−# with:
264+ with:
275−# name: compaREST binary – Windows
265+ name: compaREST binary – Windows
276−# path: compaREST
266+ path: compaREST
277−#
267+
278−# - name: Zip Release Assets
268+ - name: Zip Release Assets
279−# if: github.event_name == 'release'
269+ if: github.event_name == 'release'
280−# shell: bash
270+ shell: bash
281−# run: |
271+ run: |
282−# zip -r compaREST-Windows.zip compaREST
272+ zip -r compaREST-Windows.zip compaREST
283−#
273+
284−# - name: Upload compaREST binary – Windows to release
274+ - name: Upload compaREST binary – Windows to release
285−# if: github.event_name == 'release'
275+ if: github.event_name == 'release'
286−# uses: svenstaro/upload-release-action@2.2.1
276+ uses: svenstaro/upload-release-action@2.2.1
287−# with:
277+ with:
288−# repo_token: ${{ secrets.GITHUB_TOKEN }}
278+ repo_token: ${{ secrets.GITHUB_TOKEN }}
289−# file: compaREST-Windows.zip
279+ file: compaREST-Windows.zip
290−# tag: ${{ github.ref }}
280+ tag: ${{ github.ref }}
default.nix+6−17
@@ -1,13 +1,11 @@
1{ sources ? import ./nix/sources.nix
1{ sources ? import ./nix/sources.nix
2, haskellNix ? import sources.haskellNix { inherit system; }
2, haskellNix ? import sources.haskellNix { inherit system; }
3−, pkgs ? import haskellNix.sources.nixpkgs-2311 (haskellNix.nixpkgsArgs // { inherit system; })
3+, pkgs ? import haskellNix.sources.nixpkgs-2105 (haskellNix.nixpkgsArgs // { inherit system; })
4, system ? builtins.currentSystem
4, system ? builtins.currentSystem
5, nix-filter ? import sources.nix-filter
5, nix-filter ? import sources.nix-filter
6}:
6}:
7let
7let
8 masterPkgs = import sources.nixpkgs { inherit system; };
8 masterPkgs = import sources.nixpkgs { inherit system; };
9− yq = import ./nix/yq.nix { pkgs = masterPkgs; };
10− diffYaml = import ./nix/diff-yaml.nix { pkgs = masterPkgs; };
11
9
12 hsPkgs = pkgs.haskell-nix.stackProject {
10 hsPkgs = pkgs.haskell-nix.stackProject {
13 src = nix-filter {
11 src = nix-filter {
@@ -99,18 +97,6 @@ let
99 };
97 };
100
98
101 WindowsCompaRESTBin = hsPkgs.projectCross.mingwW64.hsPkgs.compaREST.components.exes.compaREST;
99 WindowsCompaRESTBin = hsPkgs.projectCross.mingwW64.hsPkgs.compaREST.components.exes.compaREST;
102−
103− # We use the static version so that we don't have to rebuild everything on CI.
104− # The only binaries build on CI are static.
105− test = hsPkgs.projectCross.musl64.hsPkgs.compaREST.components.tests.compaREST-tests.overrideAttrs (final: old: {
106− buildInputs = old.buildInputs ++ [ diffYaml yq ];
107− nativeBuildInputs = old.nativeBuildInputs ++ (with masterPkgs; [ makeWrapper ]);
108−
109− postInstall = ''
110− wrapProgram $out/bin/compaREST-tests \
111− --prefix PATH : ${masterPkgs.lib.makeBinPath [ diffYaml yq ]}
112− '';
113− });
114in
100in
115{
101{
116 inherit
102 inherit
@@ -120,6 +106,9 @@ in
120 compaRESTBin
106 compaRESTBin
121 hsPkgs
107 hsPkgs
122 macOSCompaRESTBundle
108 macOSCompaRESTBundle
123− WindowsCompaRESTBin
109+ WindowsCompaRESTBin;
124− test;
110+
111+ # We use the static version so that we don't have to rebuild everything on CI.
112+ # The only binaries build on CI are static.
113+ test = hsPkgs.projectCross.musl64.hsPkgs.compaREST.components.tests.compaREST-tests;
125}
114}
nix/ci.nix+1−6
@@ -1,11 +1,6 @@
1{ sources ? import ./sources.nix
1{ sources ? import ./sources.nix
2, pkgs ? import sources.nixpkgs { }
2, pkgs ? import sources.nixpkgs { }
3}:
3}:
4−
5−let
6− yq = import ./yq.nix { inherit pkgs; };
7− diff-yaml = import ./diff-yaml.nix { inherit pkgs; };
8−in
9pkgs.mkShell {
4pkgs.mkShell {
10− packages = [ pkgs.haskellPackages.fourmolu diff-yaml yq ];
5+ packages = [ pkgs.haskellPackages.fourmolu ];
11}
6}
nix/diff-yaml.nixdeleted−20
@@ -1,20 +0,0 @@
1−{ pkgs ? import <nixpkgs> {} }:
2−
3−let
4− inherit (pkgs) stdenv;
5− yq = import ./yq.nix { inherit pkgs; };
6−in
7−stdenv.mkDerivation {
8− name = "diff-yaml";
9−
10− src = ../scripts/diff-yaml;
11−
12− buildInputs = [ pkgs.bash yq ];
13−
14− phases = [ "installPhase" ];
15−
16− installPhase = ''
17− mkdir -p $out/bin
18− cp $src $out/bin/diff-yaml
19− '';
20−}
nix/shell.nixdeleted−11
@@ -1,11 +0,0 @@
1−{ sources ? import ./sources.nix
2−, pkgs ? import sources.nixpkgs { }
3−}:
4−
5−let
6− patched-yq = import ./yq.nix { inherit pkgs; };
7− diffYaml = import ./diff-yaml.nix { inherit pkgs; };
8−in
9−pkgs.mkShell {
10− buildInputs = with pkgs; [ pkg-config diffYaml patched-yq zlib ];
11−}
nix/sources.json+13−13
@@ -5,10 +5,10 @@
5 "homepage": "https://input-output-hk.github.io/haskell.nix",
5 "homepage": "https://input-output-hk.github.io/haskell.nix",
6 "owner": "input-output-hk",
6 "owner": "input-output-hk",
7 "repo": "haskell.nix",
7 "repo": "haskell.nix",
8− "rev": "d7f95903c84a5a50d6fe0844280da82c3c81680a",
8+ "rev": "50c6984263f14c110551a74d36020d0f39160019",
9− "sha256": "02870rk4sx44lwwa0k20iwdhqcx0ayz34yb3b0qy045p22q45815",
9+ "sha256": "1nbv78127dq01vyhgaw7l6hnz2qdsv115vv2gy4vvayh0y39km91",
10 "type": "tarball",
10 "type": "tarball",
11− "url": "https://github.com/input-output-hk/haskell.nix/archive/d7f95903c84a5a50d6fe0844280da82c3c81680a.tar.gz",
11+ "url": "https://github.com/input-output-hk/haskell.nix/archive/50c6984263f14c110551a74d36020d0f39160019.tar.gz",
12 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
12 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13 },
13 },
14 "niv": {
14 "niv": {
@@ -17,22 +17,22 @@
17 "homepage": "https://github.com/nmattia/niv",
17 "homepage": "https://github.com/nmattia/niv",
18 "owner": "nmattia",
18 "owner": "nmattia",
19 "repo": "niv",
19 "repo": "niv",
20− "rev": "f7c538837892dd2eb83567c9f380a11efb59b53f",
20+ "rev": "9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a",
21− "sha256": "0xl33k24vfc29cg9lnp95kvcq69qbq5fzb7jk9ig4lgrhaarh651",
21+ "sha256": "1ajyqr8zka1zlb25jx1v4xys3zqmdy3prbm1vxlid6ah27a8qnzh",
22 "type": "tarball",
22 "type": "tarball",
23− "url": "https://github.com/nmattia/niv/archive/f7c538837892dd2eb83567c9f380a11efb59b53f.tar.gz",
23+ "url": "https://github.com/nmattia/niv/archive/9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a.tar.gz",
24 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
24 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25 },
25 },
26 "nix-filter": {
26 "nix-filter": {
27− "branch": "main",
27+ "branch": "master",
28 "description": "a small self-container source filtering lib",
28 "description": "a small self-container source filtering lib",
29 "homepage": "",
29 "homepage": "",
30 "owner": "numtide",
30 "owner": "numtide",
31 "repo": "nix-filter",
31 "repo": "nix-filter",
32− "rev": "3342559a24e85fc164b295c3444e8a139924675b",
32+ "rev": "38bc843f1ce76958a9f6f0a1e4e3455221c8ecf6",
33− "sha256": "08xia32g5jzaiyhfl3kzxslzbr4w1i56i0mhy5gpfggv8gqy8sym",
33+ "sha256": "1lgznp706q5ngyl4zm39j0dlrpam2ds5miiwmc9j9vq4jg5z8sfg",
34 "type": "tarball",
34 "type": "tarball",
35− "url": "https://github.com/numtide/nix-filter/archive/3342559a24e85fc164b295c3444e8a139924675b.tar.gz",
35+ "url": "https://github.com/numtide/nix-filter/archive/38bc843f1ce76958a9f6f0a1e4e3455221c8ecf6.tar.gz",
36 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
36 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
37 },
37 },
38 "nixpkgs": {
38 "nixpkgs": {
@@ -41,10 +41,10 @@
41 "homepage": "",
41 "homepage": "",
42 "owner": "NixOS",
42 "owner": "NixOS",
43 "repo": "nixpkgs",
43 "repo": "nixpkgs",
44− "rev": "bf038bd724982de67a2ee9a6b2f1fcb7d6a87bd7",
44+ "rev": "276f639ac2cbfa55beb554e13cc091ecf8a65b19",
45− "sha256": "0ivvwdmg9fipj6ylq5ipxqpb0xnz6hsx3lyn377jacfpiqi9w0cv",
45+ "sha256": "1y4ddnwb6y2l0lbs3661ymjlj3m9r2ibv6pfajjdyarmjb7qph1c",
46 "type": "tarball",
46 "type": "tarball",
47− "url": "https://github.com/NixOS/nixpkgs/archive/bf038bd724982de67a2ee9a6b2f1fcb7d6a87bd7.tar.gz",
47+ "url": "https://github.com/NixOS/nixpkgs/archive/276f639ac2cbfa55beb554e13cc091ecf8a65b19.tar.gz",
48 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
48 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
49 }
49 }
50}
50}
nix/yq.nixdeleted−26
@@ -1,26 +0,0 @@
1−{ pkgs ? import <nixpkgs> {} }:
2−
3−# Make yq work inside whatever `stack test` launches.
4−# Nuke this when https://github.com/kislyuk/yq/pull/193 is merged
5−# and nixpkgs includes that fix.
6−
7−let
8− yq-patch = pkgs.writeText "yq-tty-fix.patch" ''
9−diff --git a/yq/__init__.py b/yq/__init__.py
10−index d95ac4b..ae7d59e 100644
11−--- a/yq/__init__.py
12−+++ b/yq/__init__.py
13−@@ -110,7 +110,7 @@ def cli(args=None, input_format="yaml", program_name="yq"):
14− in_place = args.in_place
15− delattr(args, "in_place")
16−
17−- if sys.stdin.isatty() and not args.input_streams:
18−+ if (sys.stdin is None or sys.stdin.isatty()) and not args.input_streams:
19− parser.print_help()
20− sys.exit(2)
21− elif not args.input_streams:
22− '';
23−in
24−pkgs.yq.overrideAttrs (final: old: {
25− patches = old.patches ++ [ yq-patch ];
26−})
scripts/diff-yamldeleted−35
@@ -1,35 +0,0 @@
1−#!/usr/bin/env bash
2−set -e
3−
4−# Normalise YAML files passed as inputs, then run diff on them.
5−
6−check_util() {
7− local util=$1
8−
9− if [ -z $util ]; then
10− echo "Error: $util not found in PATH"
11− exit 1
12− fi
13−}
14−
15−DIFF=`which diff`
16−check_util $DIFF
17−
18−YQ=`which yq`
19−check_util $YQ
20−
21−# Only normalise YAML files.
22−# Print anything else as is.
23−normalise() {
24− local file=$1
25− local contents=($YQ -y -S '.' $file)
26−
27− # if $contents contains actual YAML data, print it
28− if [[ $? == 0 ]]; then
29− echo $contents
30− else
31− cat $file
32− fi
33−}
34−
35−$DIFF -u <(normalise $1) <(normalise $2)
stack.yaml+2−6
@@ -1,4 +1,4 @@
1−resolver: lts-22.34
1+resolver: lts-22.17
2
2
3packages:
3packages:
4 - .
4 - .
@@ -6,11 +6,9 @@ packages:
6extra-deps:
6extra-deps:
7 - base16-bytestring-1.0.2.0
7 - base16-bytestring-1.0.2.0
8 - freer-simple-1.2.1.2
8 - freer-simple-1.2.1.2
9− - generics-sop-0.5.1.4
10 - github-0.29
9 - github-0.29
11 - http-link-header-1.2.1
10 - http-link-header-1.2.1
12 - open-union-0.4.0.0
11 - open-union-0.4.0.0
13− - th-abstraction-0.7.0.0
14 - type-fun-0.1.3
12 - type-fun-0.1.3
15 - typerep-map-0.6.0.0
13 - typerep-map-0.6.0.0
16
14
@@ -18,6 +16,4 @@ extra-deps:
18allow-newer: true
16allow-newer: true
19
17
20nix:
18nix:
21−# packages: [pkg-config yq zlib]
19+ packages: [pkg-config zlib]
22− shell-file: ./nix/shell.nix
23− pure: false
test/Spec/Golden/Extra.hs+2−2
@@ -59,7 +59,7 @@ goldenInputsTree ::
59 s ->
59 s ->
60 (t -> IO BSL.ByteString) ->
60 (t -> IO BSL.ByteString) ->
61 IO TestTree
61 IO TestTree
62−goldenInputsTree name filepath golden inp f =
62+goldenInputsTree name filepath golden inp f = do
63 runTestInputTree golden f <$> getGoldenInputs name filepath inp
63 runTestInputTree golden f <$> getGoldenInputs name filepath inp
64
64
65runTestInputTree ::
65runTestInputTree ::
@@ -72,7 +72,7 @@ runTestInputTree golden f (TestInputNode name rest) =
72runTestInputTree golden f (TestInputLeaf name t path) =
72runTestInputTree golden f (TestInputLeaf name t path) =
73 goldenVsStringDiff
73 goldenVsStringDiff
74 name
74 name
75− (\ref new -> ["diff-yaml", ref, new])
75+ (\ref new -> ["diff", "-u", ref, new])
76 (path </> golden)
76 (path </> golden)
77 (f t)
77 (f t)
78
78