Replace Hakyll with Zodiac

There is no caching of Hakyll compilation between CI builds and as a result the builds time out (there are also other build-related problems). Zodiac is a much more lightweight solution.
parent 95efc38d
Pipeline #23232772 passed with stages
in 2 minutes 31 seconds
dist
dist-*
cabal-dev
*.o
*.hi
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
.HTF/
.ghc.environment.*
_cache/
public/
image: haskell:latest
image: alpine:latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- apt-get update && apt-get install xz-utils make
- export STACK_ROOT=`pwd`/.stack
- stack setup
- stack install --only-dependencies
- stack build
- apk update
# We install GNU awk as there is an issue with BusyBox’s awk: https://github.com/nuex/zodiac/issues/13
- apk add gawk make
- make -C zodiac install
build:
cache:
paths:
- _cache
- .stack
script:
- stack exec site build
- make
except:
- master
pages:
cache:
paths:
- _cache
- .stack
script:
- stack exec site build
- make
artifacts:
paths:
- public
......
[submodule "zodiac"]
path = zodiac
url = https://github.com/nuex/zodiac.git
.PHONY: all clean
all: clean public
zod src public
clean:
rm -rf public
public:
mkdir public
# Ercoin’s web site
## Installation
## Requirements
1. Install [Haskell Stack](https://haskellstack.org).
2. `stack build`
1. [Zodiac](https://github.com/nuex/zodiac). Linked as a Git submodule for convenience and version pinning, it needs to be installed.
2. make.
3. awk. If having trouble with a particular implementation, you may use [gawk](https://www.gnu.org/software/gawk/).
## Building
```
stack exec site rebuild
make
```
## Live server with automatic reloading
The site will be generated to the `public/` directory.
To remove generated files:
```
stack exec site watch
make clean
```
name: ercoin-site
version: 0.1.0.0
build-type: Simple
cabal-version: >= 1.10
executable site
main-is: site.hs
build-depends: base == 4.*
, hakyll == 4.12.*
ghc-options: -threaded
default-language: Haskell2010
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid (mappend)
import Hakyll
--------------------------------------------------------------------------------
config :: Configuration
config = defaultConfiguration {
destinationDirectory = "public"
}
main :: IO ()
main = hakyllWith config $ do
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ do
route idRoute
compile compressCssCompiler
match "posts/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
create ["archive.html"] $ do
route idRoute
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let archiveCtx =
listField "posts" postCtx (return posts) `mappend`
constField "title" "Archives" `mappend`
defaultContext
makeItem ""
>>= loadAndApplyTemplate "templates/archive.html" archiveCtx
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
>>= relativizeUrls
match "index.html" $ do
route idRoute
compile $ do
let indexCtx =
-- We don’t use default context to not have title field.
bodyField "body" `mappend`
metadataField `mappend`
urlField "url" `mappend`
pathField "path" `mappend`
missingField
getResourceBody
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
match "templates/*" $ compile templateBodyCompiler
--------------------------------------------------------------------------------
postCtx :: Context String
postCtx =
dateField "date" "%B %e, %Y" `mappend`
defaultContext
......@@ -3,8 +3,8 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ercoin $if(title)$— $title$$endif$</title>
<link rel="stylesheet" href="/css/default.css" />
<title>Ercoin</title>
<link rel="stylesheet" href="/style.css" />
</head>
<body>
<header>
......@@ -18,15 +18,8 @@
<a href="/#bounties">Bounties</a>
</nav>
</header>
<main role="main">
$if(title)$<h1>$title$</h1>$endif$
$body$
{{{yield}}}
</main>
<footer>
Site proudly generated by
<a href="http://jaspervdj.be/hakyll">Hakyll</a>
</footer>
</body>
</html>
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# http://docs.haskellstack.org/en/stable/yaml_configuration/
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ghcjs-0.1.0_ghc-7.10.2
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-11.11
# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
# git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# extra-dep: true
# subdirs:
# - auto-update
# - wai
#
# A package marked 'extra-dep: true' will only be built if demanded by a
# non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages.
packages:
- '.'
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps: []
# Override default flag values for local packages and extra-deps
flags: {}
# Extra package databases containing global packages
extra-package-dbs: []
# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=1.4"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor
Here you can find all my previous posts:
$partial("templates/post-list.html")$
<ul>
$for(posts)$
<li>
<a href="$url$">$title$</a> - $date$
</li>
$endfor$
</ul>
<article>
<section class="header">
Posted on $date$
$if(author)$
by $author$
$endif$
</section>
<section>
$body$
</section>
</article>
Subproject commit 7515f68a8d8f2f0345c80874b34eeedddd3407da
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment