Stack #1328
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-20 | |
steps: | |
- name: Clone project | |
uses: actions/checkout@v4 | |
- name: Clone X11 | |
uses: actions/checkout@v4 | |
with: | |
repository: xmonad/X11 | |
path: X11 | |
- name: Clone X11-xft | |
uses: actions/checkout@v4 | |
with: | |
repository: xmonad/X11-xft | |
path: X11-xft | |
- name: Clone xmonad | |
uses: actions/checkout@v4 | |
with: | |
repository: xmonad/xmonad | |
path: xmonad | |
- name: Clone xmonad-contrib | |
uses: actions/checkout@v4 | |
with: | |
repository: xmonad/xmonad-contrib | |
path: xmonad-contrib | |
- name: Install C dependencies | |
run: | | |
set -ex | |
sudo apt update -y | |
sudo apt install -y \ | |
libx11-dev \ | |
libxext-dev \ | |
libxft-dev \ | |
libxinerama-dev \ | |
libxrandr-dev \ | |
libxss-dev \ | |
# | |
- 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. Additionally, the | |
# date is prefixed with an epoch number to let us manually refresh the | |
# cache when needed. This is a workaround for https://github.com/actions/cache/issues/2 | |
run: | | |
date +date=1-%Y-%m >> $GITHUB_OUTPUT | |
- name: Cache Haskell package metadata | |
uses: actions/cache@v4 | |
with: | |
path: ~/.stack/pantry | |
key: stack-pantry-${{ runner.os }}-${{ steps.cache-date.outputs.date }} | |
- name: Cache Haskell dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.stack/* | |
!~/.stack/pantry | |
!~/.stack/programs | |
key: stack-${{ runner.os }}-${{ matrix.resolver }}-${{ steps.cache-date.outputs.date }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('*/*.cabal') }} | |
restore-keys: | | |
stack-${{ runner.os }}-${{ matrix.resolver }}-${{ steps.cache-date.outputs.date }}-${{ hashFiles('stack.yaml') }}- | |
stack-${{ runner.os }}-${{ matrix.resolver }}-${{ steps.cache-date.outputs.date }}- | |
- 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 "dir=$dir" >> $GITHUB_OUTPUT | |
# make symlinks to package names without version so that we can link | |
# to the most recent documentation | |
./symlink-packages.sh "$dir" | |
touch "$dir"/.nojekyll | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4.6.9 | |
with: | |
branch: gh-pages | |
folder: ${{ steps.haddock.outputs.dir }} | |
single-commit: true # limit repo size | |
clean: false # don't break existing URIs | |
git-config-name: "github-actions[bot]" | |
git-config-email: "41898282+github-actions[bot]@users.noreply.github.com" | |
workflow-keepalive: | |
if: github.event_name == 'schedule' | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- uses: liskin/gh-workflow-keepalive@v1 |