name: CI on: push: branches: - master pull_request: types: - opened - synchronize jobs: build-test-ubuntu-stack: runs-on: ubuntu-latest name: Ubuntu / Stack steps: - uses: actions/checkout@v2 # relative paths are relative to the project directory - name: Cache Stack build artifacts (user + project) uses: actions/cache@v4 with: path: | ~/.stack .stack-work # best effort for cache: tie it to Stack resolver and package config key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock', 'package.yaml') }} restore-keys: | ${{ runner.os }}-stack - name: Install project dependencies run: stack --no-terminal test --only-dependencies - name: Build and run tests run: stack --no-terminal haddock --test --no-haddock-deps build-test-ubuntu-cabal: runs-on: ubuntu-latest name: Ubuntu / GHC ${{ matrix.ghc }}, Cabal ${{ matrix.cabal }} strategy: fail-fast: false # don't stop if one job (= GHC version) fails matrix: cabal: ["3.4"] # latest as of 2021-06-16 ghc: - "8.6.5" - "9.2.4" - "9.4.2" env: # note that all flags must be passed to every command even when # irrelevant, else Cabal will trigger arbitrary rebuilds CABAL_FLAGS: --enable-tests --enable-benchmarks --test-show-details=streaming steps: # TODO: GHC decides to recompile based on timestamp, so cache isn't used # Preferably GHC would work via hashes instead. Stack had this feature # merged in Aug 2020. # Upstream GHC issue: https://gitlab.haskell.org/ghc/ghc/-/issues/16495 # My issue on haskell/actions: https://github.com/haskell/actions/issues/41 # This also requires us to do a deep fetch, else we don't get the Git commit # history we need to rewrite mod times. - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set all tracked file modification times to the time of their last commit run: | rev=HEAD for f in $(git ls-tree -r -t --full-name --name-only "$rev") ; do touch -d $(git log --pretty=format:%cI -1 "$rev" -- "$f") "$f"; done - name: Setup Haskell build environment id: setup-haskell-build-env uses: haskell/actions/setup@v1 with: ghc-version: ${{ matrix.ghc }} cabal-version: ${{ matrix.cabal }} - name: Freeze Cabal plan run: cabal freeze - name: Cache Cabal build artifacts uses: actions/cache@v4 with: path: | ${{ steps.setup-haskell-build-env.outputs.cabal-store }} dist-newstyle key: ${{ runner.os }}-cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} restore-keys: | ${{ runner.os }}-cabal-${{ matrix.ghc }} - name: Build run: cabal build - name: Test run: cabal test --test-show-details=streaming env: HSPEC_OPTIONS: --color