Rust simulation 2024-10-08 #134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
env: | |
ALLOWED_URIS: "https://github.com https://api.github.com" | |
TRUSTED_PUBLIC_KEYS: "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" | |
SUBSTITUTERS: "https://cache.nixos.org/ https://cache.iog.io" | |
on: | |
pull_request: | |
push: | |
branches: | |
- 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: | |
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 `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" | |
build-docusaurus: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v4 | |
- name: 🛠️ Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
cache-dependency-path: site/yarn.lock | |
- name: 📦 Install dependencies | |
working-directory: site | |
run: yarn install | |
- name: 🏗️ Build Docusaurus site | |
working-directory: site | |
run: | | |
yarn build | |
- name: 🚀 Publish Docusaurus build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docusaurus-build | |
if-no-files-found: error | |
path: | | |
site/build/* | |
publish-docs: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-22.04 | |
needs: | |
- build-docusaurus | |
steps: | |
- name: 📥 Download Docusaurus build | |
uses: actions/download-artifact@v4 | |
with: | |
name: docusaurus-build | |
path: ./github-pages | |
- name: 🚀 Publish GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN || github.token }} | |
publish_dir: ./github-pages | |
cname: leios.cardano-scaling.org |