mirror of
https://github.com/srid/ema.git
synced 2024-11-25 20:12:20 +03:00
Publish docs to GitHub Pages (#15)
This commit is contained in:
parent
dd97398be8
commit
e9cd43723d
28
.github/workflows/docs.yaml
vendored
Normal file
28
.github/workflows/docs.yaml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: "Publish Ema Docs"
|
||||||
|
on:
|
||||||
|
# Run only when pushing to master branch
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: cachix/install-nix-action@v13
|
||||||
|
with:
|
||||||
|
install_url: https://nixos-nix-install-tests.cachix.org/serve/lb41az54kzk6j12p81br4bczary7m145/install
|
||||||
|
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
|
||||||
|
extra_nix_config: |
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
# This builds neuron, as well as run tests
|
||||||
|
- name: Build and generate docs HTML 🔧
|
||||||
|
run: |
|
||||||
|
nix run -- generate ./docs-output
|
||||||
|
- name: Deploy to GitHub Pages 🚀
|
||||||
|
uses: JamesIves/github-pages-deploy-action@3.7.1
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
BRANCH: gh-pages
|
||||||
|
FOLDER: docs-output
|
||||||
|
CLEAN: true
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -22,4 +22,5 @@ cabal.project.local~
|
|||||||
.HTF/
|
.HTF/
|
||||||
.ghc.environment.*
|
.ghc.environment.*
|
||||||
result
|
result
|
||||||
result-*
|
result-*
|
||||||
|
docs-output/
|
@ -16,6 +16,14 @@ main = do
|
|||||||
encodeUtf8 $ "<b>Hello</b>, from " <> name
|
encodeUtf8 $ "<b>Hello</b>, from " <> name
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Quick Preview
|
||||||
|
|
||||||
|
If you have Nix installed with Flakes, give Ema a test-drive by running it to serve its own documentation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PORT=8000 nix run
|
||||||
|
```
|
||||||
|
|
||||||
## Hacking
|
## Hacking
|
||||||
|
|
||||||
Run `bin/run` (or <kbd>Ctrl+Shift+B</kbd> in VSCode). This runs the clock example; modify `./.ghcid` to run a different example.
|
Run `bin/run` (or <kbd>Ctrl+Shift+B</kbd> in VSCode). This runs the clock example; modify `./.ghcid` to run a different example.
|
||||||
|
6
docs/Main.hs
Normal file
6
docs/Main.hs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module Main where
|
||||||
|
|
||||||
|
import qualified Ema.Example.Ex03_Documentation as Doc
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = Doc.main
|
10
ema.cabal
10
ema.cabal
@ -113,10 +113,18 @@ library
|
|||||||
Ema.Server
|
Ema.Server
|
||||||
|
|
||||||
if flag(with-examples)
|
if flag(with-examples)
|
||||||
other-modules:
|
exposed-modules:
|
||||||
Ema.Example.Ex01_HelloWorld
|
Ema.Example.Ex01_HelloWorld
|
||||||
Ema.Example.Ex02_Clock
|
Ema.Example.Ex02_Clock
|
||||||
Ema.Example.Ex03_Documentation
|
Ema.Example.Ex03_Documentation
|
||||||
|
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
executable ema-docs
|
||||||
|
hs-source-dirs: docs
|
||||||
|
default-language: Haskell2010
|
||||||
|
main-is: Main.hs
|
||||||
|
build-depends:
|
||||||
|
, base
|
||||||
|
, ema
|
16
flake.nix
16
flake.nix
@ -11,14 +11,14 @@
|
|||||||
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
|
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
|
||||||
flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system:
|
flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system:
|
||||||
let
|
let
|
||||||
|
name = "ema";
|
||||||
overlays = [ ];
|
overlays = [ ];
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system overlays;
|
inherit system overlays;
|
||||||
};
|
};
|
||||||
emaProject = returnShellEnv:
|
emaProject = returnShellEnv:
|
||||||
pkgs.haskellPackages.developPackage {
|
pkgs.haskellPackages.developPackage {
|
||||||
inherit returnShellEnv;
|
inherit name returnShellEnv;
|
||||||
name = "ema";
|
|
||||||
root = ./.;
|
root = ./.;
|
||||||
withHoogle = false;
|
withHoogle = false;
|
||||||
modifier = drv:
|
modifier = drv:
|
||||||
@ -32,12 +32,20 @@
|
|||||||
haskell-language-server
|
haskell-language-server
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
ema = emaProject false;
|
||||||
in
|
in
|
||||||
{
|
rec {
|
||||||
# Used by `nix build`
|
# Used by `nix build`
|
||||||
defaultPackage = emaProject false;
|
defaultPackage = ema;
|
||||||
|
|
||||||
# Used by `nix develop`
|
# Used by `nix develop`
|
||||||
devShell = emaProject true;
|
devShell = emaProject true;
|
||||||
|
|
||||||
|
# Used by `nix run` (for docs)
|
||||||
|
apps.${name} = flake-utils.lib.mkApp {
|
||||||
|
drv = ema;
|
||||||
|
exePath = "/bin/ema-docs";
|
||||||
|
};
|
||||||
|
defaultApp = apps.${name};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user