From edfa6838d2355f32f6ae7029f0d6752ee64819d5 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Thu, 26 Mar 2026 18:36:41 +0800 Subject: [PATCH] docs: Add generic matrix build example with caching --- docs/examples.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/examples.md b/docs/examples.md index f79b73f..f8522ff 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -79,6 +79,37 @@ jobs: - run: runhaskell Hello.hs ``` +### Basic generic matrix with caching +``` +name: build +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + ghc: ['9.14', '9.12', '9.10', '9.8', '9.6', '9.4', '9.2'] + name: Haskell GHC ${{ matrix.ghc }} + steps: + - uses: actions/checkout@v5 + - uses: haskell-actions/setup@v2 + with: + ghc-version: ${{ matrix.ghc }} + - uses: actions/cache@v5 + with: + path: | + ~/.cabal + dist-newstyle + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal','**/cabal.project') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.ghc }}- + ${{ runner.os }}- + - run: cabal update + - run: cabal build + - run: cabal haddock + - run: cabal sdist +``` + ### Multiple GHC versions If you need multiple versions of GHC installed at the same time, it is possible