mirror of
https://github.com/xmonad/xmonad.git
synced 2025-07-31 04:01:52 -07:00
GitHub Actions writes caches on the first miss and then never updates
them again. If the CI is used frequently, the caches never expire and
as they get old, become less useful.
To avoid this, force refreshing the caches once a month.
Related: 52751f47d0
92 lines
2.6 KiB
YAML
92 lines
2.6 KiB
YAML
name: Stack
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
name: Stack CI - Linux - ${{ matrix.resolver }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- resolver: lts-12
|
|
ghc: 8.4.4
|
|
- resolver: lts-14
|
|
ghc: 8.6.5
|
|
- resolver: lts-16
|
|
ghc: 8.8.4
|
|
- resolver: lts-17
|
|
ghc: 8.10.4
|
|
|
|
steps:
|
|
- name: Clone project
|
|
uses: actions/checkout@v2
|
|
|
|
- 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 \
|
|
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('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 }}-
|
|
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 and test
|
|
run: |
|
|
set -ex
|
|
stack test \
|
|
--fast --no-terminal \
|
|
--resolver=${{ matrix.resolver }} --system-ghc \
|
|
--flag=xmonad:pedantic
|