diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 1f4a160..9917a40 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -68,3 +68,36 @@ jobs: - name: Build the project run: nix build .#check.x86_64-linux + + + + haddock: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.4.0 + + - uses: cachix/install-nix-action@v16 + name: Set up Nix and IOHK caches + with: + nix_path: nixpkgs=channel:nixos-unstable + extra_nix_config: | + trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + substituters = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/ + experimental-features = nix-command flakes + + - uses: cachix/cachix-action@v10 + with: + name: mlabs + authToken: ${{ secrets.CACHIX_KEY }} + + - run: nix build .#packages.x86_64-linux.haddock + name: Run 'haddock' from flake.nix + + # This publishes the haddock result to the branch 'gh-pages', + # which is set to automatically deploy to https://liqwid-labs.github.io/agora/. + - name: Publish Documentation + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/master' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./result/agora/html diff --git a/README.md b/README.md index 11acb27..7bdec9a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ Open a development shell with `nix develop` and build the project with `cabal bu Documentation for Agora may be found in [docs](./docs). +Haddock is deployed on GitHub Pages [here](https://liqwid-labs.github.io/agora/). + ### Using Agora for your protocol If you are a protocol wanting to use Agora, read [Using Agora](./docs/using-agora.md). diff --git a/flake.nix b/flake.nix index 20ceebb..c6522d6 100644 --- a/flake.nix +++ b/flake.nix @@ -50,10 +50,8 @@ projectFor = system: let pkgs = nixpkgsFor system; - in - let pkgs' = nixpkgsFor' system; - in - (nixpkgsFor system).haskell-nix.cabalProject' { + in let pkgs' = nixpkgsFor' system; + in (nixpkgsFor system).haskell-nix.cabalProject' { src = ./.; compiler-nix-name = ghcVersion; inherit (plutarch) cabalProjectLocal; @@ -122,18 +120,16 @@ inherit (plutarch.tools) fourmolu; }) fourmolu; - in - pkgs.runCommand "format-check" - { - nativeBuildInputs = [ - pkgs'.git - pkgs'.fd - pkgs'.haskellPackages.cabal-fmt - pkgs'.nixpkgs-fmt - fourmolu - pkgs'.haskell.packages."${ghcVersion}".hlint - ]; - } '' + in pkgs.runCommand "format-check" { + nativeBuildInputs = [ + pkgs'.git + pkgs'.fd + pkgs'.haskellPackages.cabal-fmt + pkgs'.nixpkgs-fmt + fourmolu + pkgs'.haskell.packages."${ghcVersion}".hlint + ]; + } '' export LC_CTYPE=C.UTF-8 export LC_ALL=C.UTF-8 export LANG=C.UTF-8 @@ -142,12 +138,22 @@ find -name '*.hs' -not -path './dist*/*' -not -path './haddock/*' | xargs hlint mkdir $out ''; - in - { + + in { project = perSystem projectFor; flake = perSystem (system: (projectFor system).flake { }); - packages = perSystem (system: self.flake.${system}.packages); + packages = perSystem (system: + self.flake.${system}.packages // { + haddock = let + agora-doc = self.flake.${system}.packages."agora:lib:agora".doc; + pkgs = nixpkgsFor system; + in pkgs.runCommand "haddock-merge" { } '' + cd ${self} + mkdir $out + cp -r ${agora-doc}/share/doc/* $out + ''; + }); # Define what we want to test checks = perSystem (system: @@ -157,10 +163,9 @@ agora-test = self.flake.${system}.packages."agora:test:agora-test"; }); check = perSystem (system: - (nixpkgsFor system).runCommand "combined-test" - { - checksss = builtins.attrValues self.checks.${system}; - } '' + (nixpkgsFor system).runCommand "combined-test" { + checksss = builtins.attrValues self.checks.${system}; + } '' echo $checksss touch $out '');