Skip to content

Commit 4ede539

Browse files
committed
Attempt to add the relevant tools to ci
1 parent a1056ec commit 4ede539

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,22 @@ jobs:
138138
- name: Build projects [build]
139139
run: cabal build all -j
140140

141+
- name: Install cddlc
142+
run: gem install cddlc
143+
144+
- name: Clone cuddle with validator
145+
uses: actions/checkout
146+
with:
147+
repo: 'input-output-hk/cuddle'
148+
ref: 'js/validator'
149+
path: 'cuddle'
150+
151+
- name: Install cuddle
152+
run: |
153+
( cd $GITHUB_WORKSPACE/cuddle
154+
cabal install --ignore-project exe:cuddle
155+
)
156+
141157
- name: Test
142158
if: matrix.test-set == 'all'
143159
run: cabal test all -j --test-show-details=streaming

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

0 commit comments

Comments
 (0)