Skip to content

Commit e539cd3

Browse files
hydra-coding-standards: 0.6.6 (#19)
* hydra-coding-standards: 0.6.6 * Add nix flake check github action
1 parent 7f78e00 commit e539cd3

16 files changed

+585
-49
lines changed

.github/workflows/ci-nix.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,35 @@ jobs:
3939
name: hydra-spec
4040
path: |
4141
./result/*.pdf
42+
43+
44+
nix-flake-check:
45+
name: "nix flake check"
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: 📥 Checkout repository
49+
uses: actions/checkout@v4
50+
51+
- name: ❄ Prepare nix
52+
uses: cachix/install-nix-action@v30
53+
with:
54+
extra_nix_config: |
55+
accept-flake-config = true
56+
log-lines = 1000
57+
58+
- name: ❄ Cachix cache of nix derivations
59+
uses: cachix/cachix-action@v15
60+
with:
61+
name: cardano-scaling
62+
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'
63+
64+
- name: ❄ Build specification
65+
run: |
66+
nix flake check
67+
68+
- name: 💾 Upload specification
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: hydra-spec
72+
path: |
73+
./result/*.pdf

Shakefile.hs

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
import Control.Monad (forM)
1+
import Control.Monad (forM_)
22
import Development.Shake
33
import Development.Shake.Command
44
import Development.Shake.FilePath
55
import Development.Shake.Util
66

77
main :: IO ()
8-
main = shakeArgs shakeOptions{shakeFiles="_build"} $ do
9-
want ["_build/hydra-spec" <.> "pdf"]
8+
main = shakeArgs shakeOptions{shakeFiles = "_build"} $ do
9+
want ["_build/hydra-spec" <.> "pdf"]
1010

11-
phony "clean" $ do
12-
putInfo "Cleaning files in _build"
13-
removeFilesAfter "_build" ["//*"]
11+
phony "clean" $ do
12+
putInfo "Cleaning files in _build"
13+
removeFilesAfter "_build" ["//*"]
1414

15-
"_build/hydra-spec" <.> "pdf" %> \out -> do
16-
assets <- getDirectoryFiles "src" ["//*.sty", "Hydra/Protocol/Figures/*.svg", "//*.bib", "//*.ttf"]
17-
need ["_build/latex" </> c | c <- assets]
15+
"_build/hydra-spec" <.> "pdf" %> \out -> do
16+
assets <- getDirectoryFiles "src" ["//*.sty", "Hydra/Protocol/Figures/*.svg", "//*.bib", "//*.ttf"]
17+
need ["_build/latex" </> c | c <- assets]
1818

19-
srcs <- getDirectoryFiles "src" ["//*.lagda", "//*.tex"]
20-
need ["_build/latex" </> c -<.> "tex" | c <- srcs]
19+
srcs <- getDirectoryFiles "src" ["//*.lagda", "//*.tex"]
20+
need ["_build/latex" </> c -<.> "tex" | c <- srcs]
2121

22-
cmd_ (Cwd "_build/latex") "latexmk -xelatex -shell-escape -halt-on-error Hydra/Protocol/Main.tex"
23-
cmd_ "cp _build/latex/Main.pdf _build/hydra-spec.pdf"
22+
cmd_ (Cwd "_build/latex") "latexmk -xelatex -shell-escape -halt-on-error Hydra/Protocol/Main.tex"
23+
cmd_ "cp _build/latex/Main.pdf _build/hydra-spec.pdf"
2424

25-
-- Copy assets
26-
forM ["sty", "svg", "bib", "ttf"] $ \ext ->
27-
("_build/latex//*." <> ext) %> \out -> do
28-
let src = "src" </> dropDirectory1 (dropDirectory1 out)
29-
copyFile' src out
30-
31-
-- Copy or compile from lagda files
32-
"_build/latex//*.tex" %> \out -> do
25+
-- Copy assets
26+
forM_ ["sty", "svg", "bib", "ttf"] $ \ext ->
27+
("_build/latex//*." <> ext) %> \out -> do
3328
let src = "src" </> dropDirectory1 (dropDirectory1 out)
34-
b <- doesFileExist src
35-
if b then do
29+
copyFile' src out
30+
31+
-- Copy or compile from lagda files
32+
"_build/latex//*.tex" %> \out -> do
33+
let src = "src" </> dropDirectory1 (dropDirectory1 out)
34+
b <- doesFileExist src
35+
if b
36+
then do
3637
need [src]
3738
copyFile' src out
3839
else do

0 commit comments

Comments
 (0)