From 3cfaea2a444099e368bc0bccf11d7173dbef325a Mon Sep 17 00:00:00 2001 From: Brian W Bush Date: Fri, 26 Jul 2024 10:38:17 -0600 Subject: [PATCH] Added nix compile and test targets to CI (#9) * Added nix compile and test targets to CI * Set flake as trusted in the CI * Removed a build redundant with a test --- .github/workflows/ci.yaml | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f518e54..7eb06e4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,6 +2,9 @@ name: CI env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + 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: @@ -9,6 +12,51 @@ on: branches: - main jobs: + + compile: + name: Build libraries + runs-on: ubuntu-22.04 + steps: + - name: 📥 Checkout repository + uses: actions/checkout@v4 + - 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: 🏗️ 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 + + tests: + if: true + name: Run tests + runs-on: ubuntu-22.04 + steps: + - name: 📥 Checkout repository + uses: actions/checkout@v4 + - 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: 🔬 Test with `leios-sim-test` + run: | + nix run --accept-flake-config .#leios-sim-test + build-docusaurus: runs-on: ubuntu-22.04 steps: