Skip to content

Commit

Permalink
Add WIP simple Leios spec (#12)
Browse files Browse the repository at this point in the history
* Add WIP simple Leios spec
* Added formal spec to Nix shell and CI (#13)
* Added agda and dependencies to Nix developement shell.
* Added Nix derivation for Leios spec.
* Updated logbook.
* Added caching of nix store, fixes #14.

---------

Co-authored-by: Brian W Bush <[email protected]>
Co-authored-by: Brian W Bush <[email protected]>
  • Loading branch information
3 people committed Sep 20, 2024
1 parent f8acfcc commit c30a055
Show file tree
Hide file tree
Showing 12 changed files with 1,047 additions and 63 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,52 @@ on:
- main
jobs:

typecheck:
name: Typecheck specification
runs-on: ubuntu-22.04
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
- name: 💾 Cache Nix store
uses: actions/[email protected]
id: nix-cache
with:
path: /tmp/nixcache
key: ${{ runner.os }}-nix-typecheck-${{ hashFiles('flake.lock') }}
restore-keys: ${{ runner.os }}-nix-typecheck-
- name: 🛠️ Install Nix
uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: https://releases.nixos.org/nix/nix-2.10.3/install
extra_nix_config: |
allowed-uris = ${{ env.ALLOWED_URIS }}
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }}
substituters = ${{ env.SUBSTITUTERS }}
experimental-features = nix-command flakes
- name: 💾➤ Import Nix store cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: "nix-store --import < /tmp/nixcache"
- name: 🏗️ Build specification
run: |
nix build --show-trace --accept-flake-config .#leiosSpec
- name: ➤💾 Export Nix store cache
if: "steps.nix-cache.outputs.cache-hit != 'true'"
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"

compile:
name: Build libraries
runs-on: ubuntu-22.04
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
- name: 💾 Cache Nix store
uses: actions/[email protected]
id: nix-cache
with:
path: /tmp/nixcache
key: ${{ runner.os }}-nix-compile-${{ hashFiles('flake.lock') }}
restore-keys: ${{ runner.os }}-nix-compile-
- name: 🛠️ Install Nix
uses: cachix/install-nix-action@v21
with:
Expand All @@ -29,12 +69,18 @@ jobs:
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }}
substituters = ${{ env.SUBSTITUTERS }}
experimental-features = nix-command flakes
- name: 💾➤ Import Nix store cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: "nix-store --import < /tmp/nixcache"
- name: 🏗️ Build `exe:leios`
run: |
nix build --show-trace --accept-flake-config .#leios
- name: 🏗️ Build `exe:ouroboros-net-vis`
run: |
nix build --show-trace --accept-flake-config .#ouroboros-net-vis
- name: ➤💾 Export Nix store cache
if: "steps.nix-cache.outputs.cache-hit != 'true'"
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"

tests:
if: true
Expand All @@ -43,6 +89,13 @@ jobs:
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
- name: 💾 Cache Nix store
uses: actions/[email protected]
id: nix-cache
with:
path: /tmp/nixcache
key: ${{ runner.os }}-nix-tests-${{ hashFiles('flake.lock') }}
restore-keys: ${{ runner.os }}-nix-tests-
- name: 🛠️ Install Nix
uses: cachix/install-nix-action@v21
with:
Expand All @@ -53,9 +106,15 @@ jobs:
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }}
substituters = ${{ env.SUBSTITUTERS }}
experimental-features = nix-command flakes
- name: 💾➤ Import Nix store cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: "nix-store --import < /tmp/nixcache"
- name: 🔬 Test with `leios-sim-test`
run: |
nix run --accept-flake-config .#leios-sim-test
- name: ➤💾 Export Nix store cache
if: "steps.nix-cache.outputs.cache-hit != 'true'"
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"

build-docusaurus:
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist-newstyle/
\#*
.\#*
.pre-commit-config.yaml
_build
29 changes: 29 additions & 0 deletions Logbook.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Leios logbook

## 2024-09-20

### Team meeting
Expand Down Expand Up @@ -64,6 +66,33 @@
- Live version of `leios-sim` at https://leios-simulation.cardano-scaling.org/index.html
- Run `simulation` locally via [instructions below](#running-ouroborous-net-viz-in-the-browser)

## 2024-08-30

### Nix and CI support for Leios specification

The Nix flake now builds the Leios specification and the libraries upon which it depends. The type checking of the spec is now added to the CI.

```console
$ nix develop

Welcome to Ouroboros Leios!

Locations of Agda libraries:
/nix/store/1yxiwwy44xxxgzdmvyjizq53w9cfinkn-standard-library-2.0/standard-library.agda-lib
/nix/store/ppsczpm7l2gx1zd3cx2brv49069krzzh-agda-stdlib-classes-2.0/standard-library-classes.agda-lib
/nix/store/gkci6kgv4v9qw2rh5gc0s26g53b253jy-agda-stdlib-meta-2.0/standard-library-meta.agda-lib
/nix/store/2gk6rvsplxww4i8dnflxbd319lfxdcvv-formal-ledger-1d77a35a/formal-ledger.agda-lib

Run 'emacs' to edit .agda files.


Type 'info' to see what's inside this shell.

$ cd formal-spec

$ emacs Leios/SimpleSpec.agda
```

## 2024-07-26

### Running `ouroborous-net-viz` in the browser
Expand Down
93 changes: 55 additions & 38 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
inputs = {
iogx = {
url = "github:input-output-hk/iogx";
# inputs.hackage.follows = "hackage";
# inputs.CHaP.follows = "CHaP";
# inputs.haskell-nix.follows = "haskell-nix";
# inputs.nixpkgs.follows = "nixpkgs";
};

# nixpkgs.follows = "haskell-nix/nixpkgs";
Expand All @@ -28,6 +24,7 @@
# url = "github:input-output-hk/haskell.nix";
# inputs.hackage.follows = "hackage";
# };

};


Expand Down
Loading

0 comments on commit c30a055

Please sign in to comment.