Skip to content

Commit a380ba7

Browse files
authored
Merge branch 'master' into uhbif19/update-soa-docs
2 parents 1c1cc0d + 1984e82 commit a380ba7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+5491
-75
lines changed

.0pdd.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.envrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# https://github.com/nix-community/nix-direnv A fast, persistent use_nix/use_flake implementation for direnv:
2+
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
3+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
4+
fi
5+
# https://github.com/input-output-hk/devx Slightly opinionated shared GitHub Action for Cardano-Haskell projects
6+
use flake "github:input-output-hk/devx?rev=6ee20d669c3a3823c5add1e1528818ccff1eb2b9#ghc96-iog"

.ghci

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:set -Wunused-binds -Wunused-imports -Worphans
2+
:set -isrc -itest

.ghcid

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--command="cabal repl test-suite:cem-sdk-test" -W -T ":main"

.github/workflows/haskell-ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Haskell-CI
2+
on:
3+
# Reusing caches requires building in `main` branch
4+
- push
5+
# Does not seem to work
6+
- merge_group
7+
8+
jobs:
9+
tests:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Setup DevX
14+
uses: input-output-hk/actions/devx@latest
15+
with:
16+
platform: 'x86_64-linux'
17+
compiler-nix-name: 'ghc96'
18+
minimal: false
19+
iog: true
20+
- name: Check Nix env
21+
shell: devx {0}
22+
run: |
23+
echo 'Running in DevX'
24+
ghc --version
25+
cabal --version
26+
- name: Use cabal cache
27+
id: cache-cabal
28+
uses: actions/cache/restore@v3
29+
with:
30+
path: |
31+
~/.cabal-devx
32+
dist-newstyle
33+
key: ${{ runner.os }}-ghc964-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
34+
restore-keys: ${{ runner.os }}-ghc964-
35+
- name: Cabal setup
36+
shell: devx {0}
37+
run: |
38+
cabal configure -f-dev
39+
cabal update
40+
- name: Install and run linters
41+
shell: devx {0}
42+
run: |
43+
cabal install --overwrite-policy=always cabal-fmt
44+
cabal install --overwrite-policy=always fourmolu
45+
/home/runner/.cabal-devx/bin/cabal-fmt --check cem-script.cabal
46+
/home/runner/.cabal-devx/bin/fourmolu --mode check .
47+
- name: Cabal build and test
48+
shell: devx {0}
49+
run: |
50+
cabal build
51+
cabal test
52+
- name: Build haddock
53+
if: ${{ vars.GITHUB_REF_NAME == 'master' }}
54+
shell: devx {0}
55+
run: |
56+
cabal haddock-project --hackage --internal
57+
- name: Save cabal cache
58+
uses: actions/cache/save@v3
59+
if: always()
60+
with:
61+
path: |
62+
~/.cabal-devx
63+
dist-newstyle
64+
key: ${{ runner.os }}-ghc964-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
65+
- name: Save cabal cache (generic key)
66+
uses: actions/cache/save@v3
67+
if: always()
68+
with:
69+
path: |
70+
~/.cabal-devx
71+
dist-newstyle
72+
key: ${{ runner.os }}-ghc964-

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ cabal.project.local~
2222
.HTF/
2323
.ghc.environment.*
2424
.vscode
25+
haddocks
26+
.direnv/
27+
# Functions changed by runing local testnet
28+
devnet/db
29+
devnet/genesis-*.json

.hlint.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22
- group: {name: generalise, enabled: true}
33
- functions:
44
- {name: undefined, within: []}
5+
# Do not prohibit using more monomorphic functions
56
- ignore: {name: Use pure}
7+
- ignore: {name: Use fmap}
8+
- ignore: {name: Use traverse_}
9+
- ignore: {name: "Use <>"}
10+
# Do not enforce less explicit expressions
11+
# and util functions consisting of single line of code
12+
- ignore: {name: Use isNothing}
613
- ignore: {name: Use print}
714
- ignore: {name: Use null}
815
- ignore: {name: Use notElem}
916
- ignore: {name: Use unless}
10-
- ignore: {name: Use fmap}
11-
- ignore: {name: Use traverse_}
17+
- ignore: {name: "Use asks"}
18+
- ignore: {name: "Eta reduce"}
19+
- ignore: {name: Use concatMap}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"cSpell.words": [
3+
"Fracada",
4+
"POCRE",
5+
"Serialised"
6+
],
7+
"haskell.manageHLS": "PATH"
8+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 MLabs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
[![PDD status](https://www.0pdd.com/svg?name=mlabs-haskell/cem-script)](https://www.0pdd.com/p?name=mlabs-haskell/cem-script)
2-
31
# CEM SDK
42

5-
* @todo #3 Take decision if to change project name to CEM SDK
6-
* @todo #3 Found out if we can make PDD bot descriptions and mentions less noisy
7-
83
## Project pitch
94

105
Define and reuse Cardano DApp logic via annotated CEM-machines, resulting in free implementations for:
@@ -15,6 +10,48 @@ Define and reuse Cardano DApp logic via annotated CEM-machines, resulting in fre
1510
* Automatically testing invariants
1611
* Human-readable specs
1712

13+
## Building
14+
15+
Building is performed with cabal.
16+
Building requires `libblst` and `libsodium` installed.
17+
18+
Arch Linux has `libblst` in AUR, nix are exemplified by IOHK,
19+
and manual installation is described here:
20+
https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/getting-started/install.md#installing-blst
21+
22+
Make sure to `cabal update` before building.
23+
24+
The project uses `github:input-output-hk/devx` to make the development shell. See `.envrc` for details.
25+
26+
## Running tests
27+
28+
Tests are runned in emulated environment by default.
29+
30+
Just run: `cabal test`.
31+
32+
For development and fast response once could consider `ghcid`.
33+
34+
## Starting local devnet
35+
36+
Tests depend on localdevnet, which is runned in Docker.
37+
To start it do:
38+
39+
```bash
40+
./prepare-devnet.sh
41+
docker-compose -f docker-compose.devnet.yaml up
42+
sudo chown -R $USER:$USER ./devnet/
43+
```
44+
45+
## Devnet stalling bug
46+
47+
Sometimes devnet stalls, due to some bug, in that case one should restart it,
48+
and wipe directory `./devnet/db`. To look for stalling one could check:
49+
`CARDANO_NODE_SOCKET_PATH=./devnet/node.socket cardano-cli query tip --testnet-magic 42`. For properly working devnet slots should change
50+
and sync be marked as 100%.
51+
52+
On this bug:
53+
https://forum.cardano.org/t/restarting-custom-private-networks-cardano-node-forge35/116921
54+
1855
## Project status
1956

2057
Project is in early development stage and is funded by

0 commit comments

Comments
 (0)