Skip to content

Added kleidukos/get-tested action to generate CI matrix #64 #105

Added kleidukos/get-tested action to generate CI matrix #64

Added kleidukos/get-tested action to generate CI matrix #64 #105

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-matrix:
name: "Generate matrix from cabal"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Extract the tested GHC versions
id: set-matrix
uses: kleidukos/[email protected]
with:
cabal-file: dotenv.cabal
ubuntu: true
macos: true
version: 0.1.6.0
build-and-test:
name: GHC ${{ matrix.ghc }} on ${{ matrix.os }}
needs: generate-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: Setup Haskell
id: setup-haskell-cabal
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: "3.8"
- name: Update dependencies with Hackage
run: cabal update
- name: Build dependencies
run: cabal freeze --enable-tests
- name: Cache dependencies and dist-newstyle
uses: actions/cache@v3
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
key: dependencies-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
dependencies-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
dependencies-${{ runner.os }}-${{ matrix.ghc }}-
- name: Install dependencies
run: cabal install --only-dependencies
- name: Build project
run: cabal build --enable-tests
- name: Run tests
run: cabal test --enable-tests