Skip to content

Commit

Permalink
Build daily documentation snapshots and deploy them to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
liskin committed Jun 7, 2021
0 parents commit 9fa8f13
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 0 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Stack

on:
workflow_dispatch:
schedule:
- cron: '0 3 * * *'

jobs:
build:
name: Stack CI - Linux - ${{ matrix.resolver }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- resolver: lts-17
ghc: 8.10.4

steps:
- name: Clone project
uses: actions/checkout@v2

- name: Clone X11
uses: actions/checkout@v2
with:
repository: xmonad/X11
path: X11

- name: Clone xmonad
uses: actions/checkout@v2
with:
repository: xmonad/xmonad
path: xmonad

- name: Clone xmonad-contrib
uses: actions/checkout@v2
with:
repository: xmonad/xmonad-contrib
path: xmonad-contrib

- name: Prepare apt sources
run: |
set -ex
sudo add-apt-repository -y ppa:hvr/ghc
sudo apt update -y
- name: Install C dependencies
run: |
set -ex
sudo apt install -y \
libx11-dev \
libxext-dev \
libxft-dev \
libxinerama-dev \
libxrandr-dev \
libxss-dev \
#
- name: Install GHC
# use system ghc in stack, don't waste GH Actions cache space
run: |
set -ex
sudo apt install -y ghc-${{ matrix.ghc }}
echo /opt/ghc/${{ matrix.ghc }}/bin >> $GITHUB_PATH
- name: Refresh caches once a month
id: cache-date
# GHA writes caches on the first miss and then never updates them again;
# force updating the cache at least once a month
run: |
echo "::set-output name=date::$(date +%Y-%m)"
- name: Cache Haskell package metadata
uses: actions/cache@v2
with:
path: ~/.stack/pantry
key: stack-pantry-${{ runner.os }}-${{ steps.cache-date.outputs.date }}
restore-keys: |
stack-pantry-${{ runner.os }}-
- name: Cache Haskell dependencies
uses: actions/cache@v2
with:
path: |
~/.stack/*
!~/.stack/pantry
key: stack-${{ runner.os }}-${{ matrix.resolver }}-${{ steps.cache-date.outputs.date }}-${{ hashFiles(matrix.yaml) }}-${{ hashFiles('*.cabal') }}
restore-keys: |
stack-${{ runner.os }}-${{ matrix.resolver }}-${{ steps.cache-date.outputs.date }}-${{ hashFiles(matrix.yaml) }}-
stack-${{ runner.os }}-${{ matrix.resolver }}-${{ steps.cache-date.outputs.date }}-
stack-${{ runner.os }}-${{ matrix.resolver }}-
- name: Update hackage index
# always update index to prevent the shared ~/.stack/pantry cache from being empty
run: |
set -ex
stack update
- name: Build documentation
id: haddock
run: |
set -ex
# workaround for stack/pantry caching of github archives
sed -e "s/@{today}/@{$(date -u --iso-8601=seconds)}/" -i stack.yaml
stack haddock \
--fast --no-terminal \
--resolver=${{ matrix.resolver }} --system-ghc
read dir < <(
stack path \
--local-doc-root \
--resolver=${{ matrix.resolver }} --system-ghc
)
echo "::set-output name=dir::$dir"
touch "$dir"/.nojekyll
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ${{ steps.haddock.outputs.dir }}
single-commit: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.stack-work/
/stack.yaml.lock
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) The Xmonad Community

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of his contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# xmonad-docs

Daily snapshot of xmonad documentation.
9 changes: 9 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resolver: lts-16.31

packages:
- X11
- xmonad
- xmonad-contrib

ghc-options:
xmonad-contrib: '-j'

0 comments on commit 9fa8f13

Please sign in to comment.