Skip to content

Commit 71a6572

Browse files
committed
Add CDDL tools to CI
1 parent 83c5eb5 commit 71a6572

File tree

5 files changed

+47
-8
lines changed

5 files changed

+47
-8
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ jobs:
5555
steps:
5656
- uses: actions/checkout@v4
5757

58-
- name: Clone Blueprints
59-
uses: actions/checkout@v4
60-
with:
61-
repository: 'cardano-scaling/cardano-blueprint'
62-
path: 'blueprints'
63-
6458
- name: Check CDDLs up-to-date with Blueprints
6559
continue-on-error: true
6660
run: |
@@ -149,6 +143,13 @@ jobs:
149143
- name: Build projects [build]
150144
run: cabal build all -j
151145

146+
- name: Install cddl tools
147+
run: |
148+
export GEM_HOME="$HOME/.gem"
149+
gem install cddlc
150+
echo "PATH=$HOME/.gem/bin:$PATH" >> $GITHUB_ENV
151+
cabal install cuddle-0.5.0.0
152+
152153
- name: Test
153154
if: matrix.test-set == 'all'
154155
run: cabal test all -j --test-show-details=streaming

nix/shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ hsPkgs.shellFor {
1616
pkgs.ghcid
1717
pkgs.xrefcheck
1818
pkgs.fourmolu
19+
pkgs.cuddle
1920

2021
# release management
2122
pkgs.scriv

nix/tools.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ in
3838

3939
fourmolu = tool "fourmolu" "0.18.0.0" { };
4040

41+
cuddle = tool "cuddle" "git" {
42+
src = final.fetchFromGitHub {
43+
owner = "input-output-hk";
44+
repo = "cuddle";
45+
rev = "cuddle-0.5.0.0";
46+
hash = "sha256-06a9N1IAh0kKW/xPu1qiLK22HpXyARnipA1YJxY4jOQ=";
47+
};
48+
};
49+
4150
haskellBuildUtils = prev.haskellBuildUtils.override {
4251
inherit (final.hsPkgs.args) compiler-nix-name;
4352
index-state = tool-index-state;

scripts/cbor/unwrap24serialised.hs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{- cabal:
2+
build-depends: cborg, bytestring, base
3+
-}
4+
5+
-- | A simple script that unwraps a CBOR term serialized as
6+
-- CBOR-in-CBOR. It gets input from stdin and emits on stdout.
7+
--
8+
-- > cat pre.cbor | cabal run ./scripts/unwrap24serialised.hs > post.cbor
9+
module Main where
10+
11+
import Prelude hiding (interact)
12+
import Data.ByteString
13+
import Codec.CBOR.Term
14+
import Codec.CBOR.Write
15+
import Codec.CBOR.Read
16+
import Data.ByteString.Lazy (fromStrict, toStrict)
17+
18+
main = interact $
19+
toStrict
20+
. toLazyByteString
21+
. encodeTerm
22+
. (\(Right (_, t)) -> t)
23+
. deserialiseFromBytes decodeTerm
24+
. (\(Right (_, TTagged _ (TBytes t))) -> fromStrict t)
25+
. deserialiseFromBytes decodeTerm
26+
. fromStrict

scripts/ci/diff-cddls.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/bin/bash
22

3+
git clone [email protected]:cardano-scaling/cardano-blueprint
4+
35
check_diff () {
4-
diff "ouroboros-consensus-cardano/cddl/node-to-node/$1" "blueprints/src/network/node-to-node/$1"
6+
diff "ouroboros-consensus-cardano/cddl/node-to-node/$1" "cardano-blueprint/src/network/node-to-node/$1"
57
if [ $? -ne 0 ]
68
then
7-
echo "::warning ouroboros-consensus-cardano/cddl/node-to-node/$1 differs from blueprints/src/network/node-to-node/$1"
9+
echo "::warning ouroboros-consensus-cardano/cddl/node-to-node/$1 differs from cardano-blueprint/src/network/node-to-node/$1"
810
else
911
echo "$1 OK"
1012
fi

0 commit comments

Comments
 (0)