File tree Expand file tree Collapse file tree 3 files changed +29
-19
lines changed Expand file tree Collapse file tree 3 files changed +29
-19
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,19 @@ jobs:
14
14
- name : Install Nix
15
15
uses : cachix/install-nix-action@v12
16
16
17
- - name : Build Executable
18
- run : nix-build
19
-
20
17
- name : Build Site
21
- run : result/bin/haskell-org-site build
18
+ # we run the checks as a separate step
19
+ run : nix build -f . built -o built-site --arg doCheck false
22
20
23
21
- name : Check Links
24
- run : nix-shell --command 'linkchecker _site'
22
+ run : nix run --quiet -f . linkchecker -c linkchecker built-site
23
+
24
+ - uses : actions/upload-artifact@v2
25
+ with :
26
+ name : www.haskell.org
27
+ path : built-site* # Uses glob pattern because
28
+ # actions/upload-artifact@v2 gets
29
+ # confused by symlinks otherwise
30
+ #
31
+ # See:
32
+ # https://github.com/actions/upload-artifact/issues/92
Original file line number Diff line number Diff line change @@ -9,3 +9,4 @@ dist-newstyle
9
9
10
10
# Nix
11
11
result *
12
+ built-site
Original file line number Diff line number Diff line change 3
3
, pkgs ?
4
4
import ( builtins . fetchTarball {
5
5
url = "https://github.com/NixOS/nixpkgs/archive/${ rev } .tar.gz" ;
6
- } ) { }
6
+ } ) { }
7
+ , doCheck ? true
7
8
} :
8
9
9
10
let
26
27
"js/*"
27
28
"img/*"
28
29
".git"
30
+ ".github"
29
31
] ./. ;
30
32
modifier = drv : pkgs . haskell . lib . overrideCabal drv ( attrs : {
31
33
buildTools = with pkgs . haskell . packages . ${ compiler } ; ( attrs . buildTools or [ ] ) ++ [
50
52
51
53
built = pkgs . stdenv . mkDerivation {
52
54
name = "haskell.org" ;
55
+ inherit doCheck ;
56
+
53
57
src = gitignore . gitignoreSource [
54
58
".git"
55
59
"*.cabal"
56
60
"*.hs"
61
+ ".github"
57
62
] ./. ;
58
63
buildInputs = [ builder pkgs . linkchecker ] ;
64
+
59
65
LOCALE_ARCHIVE = "${ pkgs . glibcLocales } /lib/locale/locale-archive" ;
60
66
LC_ALL = "C.UTF-8" ;
61
- installPhase = ''
62
- echo ""
63
- echo " Building static site..."
64
- echo ""
65
- haskell-org-site build
66
- echo ""
67
- echo " Checking for bad links..."
68
- echo ""
67
+
68
+ buildPhase = ''
69
+ ${ builder } /bin/haskell-org-site build
70
+ '' ;
71
+ checkPhase = ''
69
72
linkchecker _site
70
- echo ""
71
- echo " Copying static site to $out..."
73
+ '' ;
74
+ installPhase = ''
72
75
cp -r _site $out
73
- echo " Build complete"
74
- echo ""
75
76
'' ;
76
77
} ;
77
78
in
78
79
if pkgs . lib . inNixShell then builder
79
- else { inherit builder built ; }
80
+ else { inherit builder built ; inherit ( pkgs ) linkchecker ; }
You can’t perform that action at this time.
0 commit comments