1
1
mirror of https://github.com/coot/free-category.git synced 2024-08-17 01:50:28 +03:00
free-category/.github/workflows/ci.yaml
Marcin Szamotulski 18eed77646 GHC-9.6 support
2023-06-04 13:27:48 +02:00

88 lines
2.4 KiB
YAML

name: Haskell CI
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
ghc: ["8.10.7", "9.0.2", "9.2.4", "9.4.2", "9.6.2"]
os: [ubuntu-latest]
steps:
- name: Install Haskell
uses: haskell/actions/setup@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 3.8.1.0
- name: Select build directory
run: |
if [ "$RUNNER_OS" == Windows ]; then
CABAL_BUILDDIR="D:\\a\\_temp\\dist"
else
CABAL_BUILDDIR="dist-newstyle"
fi
echo "CABAL_BUILDDIR=$CABAL_BUILDDIR"
echo "CABAL_BUILDDIR=$CABAL_BUILDDIR" >> $GITHUB_ENV
- name: Set cache version
run: echo "CACHE_VERSION=9w76Z3Q" >> $GITHUB_ENV
- name: Set up temp directory
env:
RUNNER_TEMP: ${{ runner.temp }}
run: |
echo "TMPDIR=$RUNNER_TEMP" >> $GITHUB_ENV
echo "TMP=$RUNNER_TEMP" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Record dependencies
id: record-deps
run: |
cabal build all --dry-run
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
- name: Cache `cabal store`
uses: actions/cache@v2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: cabal-store-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
restore-keys: cabal-store-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
- name: Cache `dist-newstyle`
uses: actions/cache@v3
with:
path: |
dist-newstyle
!dist-newstyle/**/.git
key: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
- name: Use cabal.project.local
run: |
cat .github/workflows/cabal.project.local >> ./cabal.project.local
cat ./cabal.project.local
- name: Build dependencies
run: cabal --builddir="$CABAL_BUILDDIR" build --only-dependencies all
- name: Build projects [build]
run: cabal --builddir="$CABAL_BUILDDIR" build all
- name: free-category [test]
run: cabal --builddir="$CABAL_BUILDDIR" run free-category:test-cats
- name: free-category [benchmarks]
run: cabal build free-category:benchmarks