Skip to content

Commit 6463915

Browse files
authored
Merge branch 'main' into dcoutts/sim-old
2 parents f12d9c0 + 5670718 commit 6463915

File tree

113 files changed

+19232
-40
lines changed

Some content is hidden

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

113 files changed

+19232
-40
lines changed

.github/workflows/ci.yaml

+293
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
name: CI
2+
env:
3+
REGISTRY: ghcr.io
4+
IMAGE_NAME: ${{ github.repository }}
5+
ALLOWED_URIS: "https://github.com https://api.github.com"
6+
TRUSTED_PUBLIC_KEYS: "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
7+
SUBSTITUTERS: "https://cache.nixos.org/ https://cache.iog.io"
8+
9+
on:
10+
pull_request:
11+
push:
12+
branches:
13+
- main
14+
jobs:
15+
16+
typecheck:
17+
name: Typecheck specification
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- name: 📥 Checkout repository
21+
uses: actions/checkout@v4
22+
- name: 💾 Cache Nix store
23+
uses: actions/[email protected]
24+
id: nix-cache
25+
with:
26+
path: /tmp/nixcache
27+
key: ${{ runner.os }}-nix-typecheck-${{ hashFiles('flake.lock') }}
28+
restore-keys: ${{ runner.os }}-nix-typecheck-
29+
- name: 🛠️ Install Nix
30+
uses: cachix/install-nix-action@v21
31+
with:
32+
nix_path: nixpkgs=channel:nixos-unstable
33+
install_url: https://releases.nixos.org/nix/nix-2.10.3/install
34+
extra_nix_config: |
35+
allowed-uris = ${{ env.ALLOWED_URIS }}
36+
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }}
37+
substituters = ${{ env.SUBSTITUTERS }}
38+
experimental-features = nix-command flakes
39+
- name: 💾➤ Import Nix store cache
40+
if: "steps.nix-cache.outputs.cache-hit == 'true'"
41+
run: "nix-store --import < /tmp/nixcache"
42+
- name: 🏗️ Build specification
43+
run: |
44+
nix build --show-trace --accept-flake-config .#leiosSpec
45+
- name: ➤💾 Export Nix store cache
46+
if: "steps.nix-cache.outputs.cache-hit != 'true'"
47+
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"
48+
49+
compile:
50+
name: Build libraries
51+
runs-on: ubuntu-22.04
52+
steps:
53+
- name: 📥 Checkout repository
54+
uses: actions/checkout@v4
55+
- name: 💾 Cache Nix store
56+
uses: actions/[email protected]
57+
id: nix-cache
58+
with:
59+
path: /tmp/nixcache
60+
key: ${{ runner.os }}-nix-compile-${{ hashFiles('flake.lock') }}
61+
restore-keys: ${{ runner.os }}-nix-compile-
62+
- name: 🛠️ Install Nix
63+
uses: cachix/install-nix-action@v21
64+
with:
65+
nix_path: nixpkgs=channel:nixos-unstable
66+
install_url: https://releases.nixos.org/nix/nix-2.10.3/install
67+
extra_nix_config: |
68+
allowed-uris = ${{ env.ALLOWED_URIS }}
69+
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }}
70+
substituters = ${{ env.SUBSTITUTERS }}
71+
experimental-features = nix-command flakes
72+
- name: 💾➤ Import Nix store cache
73+
if: "steps.nix-cache.outputs.cache-hit == 'true'"
74+
run: "nix-store --import < /tmp/nixcache"
75+
- name: 🏗️ Build `exe:leios`
76+
run: |
77+
nix build --show-trace --accept-flake-config .#leios
78+
- name: 🏗️ Build `exe:ouroboros-net-vis`
79+
run: |
80+
nix build --show-trace --accept-flake-config .#ouroboros-net-vis
81+
- name: ➤💾 Export Nix store cache
82+
if: "steps.nix-cache.outputs.cache-hit != 'true'"
83+
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"
84+
85+
tests:
86+
if: true
87+
name: Run tests
88+
runs-on: ubuntu-22.04
89+
steps:
90+
- name: 📥 Checkout repository
91+
uses: actions/checkout@v4
92+
- name: 💾 Cache Nix store
93+
uses: actions/[email protected]
94+
id: nix-cache
95+
with:
96+
path: /tmp/nixcache
97+
key: ${{ runner.os }}-nix-tests-${{ hashFiles('flake.lock') }}
98+
restore-keys: ${{ runner.os }}-nix-tests-
99+
- name: 🛠️ Install Nix
100+
uses: cachix/install-nix-action@v21
101+
with:
102+
nix_path: nixpkgs=channel:nixos-unstable
103+
install_url: https://releases.nixos.org/nix/nix-2.10.3/install
104+
extra_nix_config: |
105+
allowed-uris = ${{ env.ALLOWED_URIS }}
106+
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }}
107+
substituters = ${{ env.SUBSTITUTERS }}
108+
experimental-features = nix-command flakes
109+
- name: 💾➤ Import Nix store cache
110+
if: "steps.nix-cache.outputs.cache-hit == 'true'"
111+
run: "nix-store --import < /tmp/nixcache"
112+
- name: 🔬 Test with `leios-sim-test`
113+
run: |
114+
nix run --accept-flake-config .#leios-sim-test
115+
- name: ➤💾 Export Nix store cache
116+
if: "steps.nix-cache.outputs.cache-hit != 'true'"
117+
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"
118+
119+
build-docusaurus:
120+
runs-on: ubuntu-22.04
121+
steps:
122+
- name: 📥 Checkout repository
123+
uses: actions/checkout@v4
124+
125+
- name: 🛠️ Setup Node.js
126+
uses: actions/setup-node@v4
127+
with:
128+
node-version: 20
129+
cache: 'yarn'
130+
cache-dependency-path: site/yarn.lock
131+
132+
- name: 📦 Install dependencies
133+
working-directory: site
134+
run: yarn install
135+
136+
- name: 🏗️ Build Docusaurus site
137+
working-directory: site
138+
run: |
139+
yarn build
140+
141+
- name: 🚀 Publish Docusaurus build
142+
uses: actions/upload-artifact@v4
143+
with:
144+
name: docusaurus-build
145+
if-no-files-found: error
146+
path: |
147+
site/build/*
148+
149+
publish-docs:
150+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
151+
runs-on: ubuntu-22.04
152+
needs:
153+
- build-docusaurus
154+
steps:
155+
- name: 📥 Download Docusaurus build
156+
uses: actions/download-artifact@v4
157+
with:
158+
name: docusaurus-build
159+
path: ./github-pages
160+
161+
- name: 🚀 Publish GitHub Pages
162+
uses: peaceiris/actions-gh-pages@v4
163+
with:
164+
github_token: ${{ secrets.GITHUB_TOKEN || github.token }}
165+
publish_dir: ./github-pages
166+
cname: leios.cardano-scaling.org
167+
168+
build-and-push-image:
169+
runs-on: ubuntu-latest
170+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
171+
permissions:
172+
contents: read
173+
packages: write
174+
attestations: write
175+
id-token: write
176+
177+
steps:
178+
- name: 📥 Checkout repository
179+
uses: actions/checkout@v4
180+
181+
# Uses the `docker/login-action` action to log in to the
182+
# Container registry registry using the account and password
183+
# that will publish the packages. Once published, the packages
184+
# are scoped to the account defined here.
185+
- name: 🛠️ Set up Docker Buildx
186+
uses: docker/setup-buildx-action@v3
187+
188+
- name: 👮 Log in to Google Cloud
189+
id: auth
190+
uses: 'google-github-actions/auth@v2'
191+
with:
192+
token_format: access_token
193+
credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}'
194+
access_token_lifetime: 3600s # need to be long enough for docker build to finish
195+
196+
- name: 👮 Log in to the Container registry
197+
uses: docker/login-action@v3
198+
with:
199+
registry: ${{ env.REGISTRY }}
200+
username: ${{ github.actor }}
201+
password: ${{ secrets.GITHUB_TOKEN }}
202+
203+
# This step uses
204+
# [docker/metadata-action](https://github.com/docker/metadata-action#about)
205+
# to extract tags and labels that will be applied to the
206+
# specified image. The `id` "meta" allows the output of this
207+
# step to be referenced in a subsequent step. The `images` value
208+
# provides the base name for the tags and labels.
209+
- name: 🛻 Extract metadata (tags, labels) for Docker
210+
id: meta
211+
uses: docker/metadata-action@v5
212+
with:
213+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
214+
215+
# This step uses the `docker/build-push-action` action to build
216+
# the image, based on your repository's `Dockerfile`. If the
217+
# build succeeds, it pushes the image to GitHub Packages. It
218+
# uses the `context` parameter to define the build's context as
219+
# the set of files located in the specified path. For more
220+
# information, see
221+
# "[Usage](https://github.com/docker/build-push-action#usage)"
222+
# in the README of the `docker/build-push-action` repository.
223+
# It uses the `tags` and `labels` parameters to tag and label
224+
# the image with the output from the "meta" step.
225+
- name: 🏗️ Build and push image to GHCR
226+
id: push
227+
uses: docker/build-push-action@v5
228+
with:
229+
context: .
230+
push: true
231+
tags: ${{ steps.meta.outputs.tags }}
232+
labels: ${{ steps.meta.outputs.labels }}
233+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:cache
234+
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:cache,mode=max
235+
236+
- name: 👮 Login to Artifact Registry
237+
uses: docker/login-action@v1
238+
with:
239+
registry: us-east1-docker.pkg.dev
240+
username: oauth2accesstoken
241+
password: ${{ steps.auth.outputs.access_token }}
242+
243+
- name: 📦 Push to GCR
244+
run: |-
245+
docker pull $image_tag
246+
docker tag $image_tag "us-east1-docker.pkg.dev/iog-hydra/leios-docker/${{ env.IMAGE_NAME}}:$GITHUB_SHA"
247+
docker push "us-east1-docker.pkg.dev/iog-hydra/leios-docker/${{ env.IMAGE_NAME}}:$GITHUB_SHA"
248+
env:
249+
image_id: ${{ steps.push.outputs.imageid }}
250+
image_tag: ${{ steps.meta.outputs.tags }}
251+
252+
# This step generates an artifact attestation for the image,
253+
# which is an unforgeable statement about where and how it was
254+
# built. It increases supply chain security for people who
255+
# consume the image. For more information, see
256+
# "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
257+
- name: Generate artifact attestation
258+
uses: actions/attest-build-provenance@v1
259+
with:
260+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
261+
subject-digest: ${{ steps.push.outputs.digest }}
262+
push-to-registry: true
263+
264+
# deploy built server to Gcloud run action when pushing to main
265+
deploy-server:
266+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
267+
runs-on: ubuntu-latest
268+
needs:
269+
- build-and-push-image
270+
permissions:
271+
contents: read
272+
packages: read
273+
274+
steps:
275+
- name: 📥 Checkout repository
276+
uses: 'actions/checkout@v4'
277+
278+
- name: 👮 Log in to Google Cloud
279+
id: auth
280+
uses: 'google-github-actions/auth@v2'
281+
with:
282+
credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}'
283+
284+
- name: 🚀 Deploy to Cloud Run
285+
id: 'deploy'
286+
uses: 'google-github-actions/deploy-cloudrun@v2'
287+
with:
288+
service: 'leios-server'
289+
image: 'us-east1-docker.pkg.dev/iog-hydra/leios-docker/${{ env.IMAGE_NAME}}:${{ github.sha }}'
290+
region: 'us-east1'
291+
292+
- name: 🔬 'Use output'
293+
run: 'curl -v -L "${{ steps.deploy.outputs.url }}"'

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ report/leios-design.log
33
report/leios-design.out
44
report/leios-design.pdf
55
report/leios-design.toc
6+
*~
7+
dist-newstyle/
8+
\#*
9+
.\#*
10+
.pre-commit-config.yaml
11+
_build

CNAME

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
leios.cardano-scaling.org

CODE-OF-CONDUCT.md

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
education, socio-economic status, nationality, personal appearance, race,
10+
religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at {{ email }}. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org

0 commit comments

Comments
 (0)