diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 78878bf..00bde15 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ permissions: on: push: - branches: [ "main" ] + branches: [ "main", "cd/2024-09-03-gen-docs" ] pull_request: branches: [ "main" ] @@ -41,4 +41,6 @@ jobs: - run: | cd /tmp/hell && stack build --fast - run: | - cd /tmp/hell && stack exec hell scripts/check.hell + cd /tmp/hell && stack exec hell scripts/check-examples.hell + - run: | + cd /tmp/hell && stack exec hell scripts/check-docs.hell diff --git a/scripts/check-docs.hell b/scripts/check-docs.hell new file mode 100644 index 0000000..6e048c1 --- /dev/null +++ b/scripts/check-docs.hell @@ -0,0 +1,7 @@ +main = do + Text.putStrLn "Checking docs are up to date ..." + Directory.copyFile "docs/api/index.html" "docs/api/index.html-prev" + Process.runProcess_ $ Process.proc "hell" ["scripts/gen-docs.hell"] + Process.runProcess_ $ + Process.proc "diff" ["docs/api/index.html", "docs/api/index.html-prev", "-q"] + Text.putStrLn "Docs are up to date." diff --git a/scripts/check-examples.hell b/scripts/check-examples.hell new file mode 100644 index 0000000..5d07f2b --- /dev/null +++ b/scripts/check-examples.hell @@ -0,0 +1,10 @@ +main = do + examples <- Directory.listDirectory "examples/" + let check = \fp -> do + Text.putStrLn $ Text.concat ["Checking ", fp] + Process.runProcess_ (Process.proc "hell" ["--check", fp]) + Monad.forM_ examples \example -> do + check $ Text.concat ["examples/", example] + check "scripts/static-build.hell" + check "scripts/install-hell.hell" + Text.putStrLn "All OK." diff --git a/scripts/gen-docs.ghci b/scripts/gen-docs.ghci deleted file mode 100644 index aee6f25..0000000 --- a/scripts/gen-docs.ghci +++ /dev/null @@ -1,3 +0,0 @@ -:l src/Hell.hs -_generateApiDocs -:quit diff --git a/scripts/gen-docs.hell b/scripts/gen-docs.hell new file mode 100644 index 0000000..408c7ca --- /dev/null +++ b/scripts/gen-docs.hell @@ -0,0 +1,7 @@ +main = do + Text.putStrLn "Generating docs ..." + let script = Text.unlines [":l src/Hell.hs", "_generateApiDocs", ":quit"] + _out <- ByteString.readProcess_ + (Text.setStdin script + (Process.proc "stack" ["ghci","--no-load"])) + Text.putStrLn "Generated docs."