Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added formal spec to Nix shell and CI #13

Merged
merged 6 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
27 changes: 27 additions & 0 deletions Logbook.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## 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
2 changes: 2 additions & 0 deletions formal-spec/Leios/SimpleSpec.agda
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS --allow-unsolved-metas #-}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WhatisRT, please delete if this interferes with your work in progress.


module Leios.SimpleSpec where

open import Ledger.Prelude
Expand Down
2 changes: 1 addition & 1 deletion formal-spec/leios-spec.agda-lib
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ depend:
standard-library
standard-library-classes
standard-library-meta
formal-ledger
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WhatisRT, please delete if this interferes with your work in progress.

include:
.
../../formal-ledger-specifications/src/
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WhatisRT, please restore if this interferes with your work in progress.

Loading
Loading