Skip to content

build

build #392

Workflow file for this run

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
schedule:
- cron: '23 14 * * 2'
release:
name: build
jobs:
lint:
name: "Run hlint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up HLint
uses: haskell/actions/hlint-setup@v2
- name: Run HLint
uses: haskell/actions/hlint-run@v2
with:
fail-on: warning
fourmolu:
name: "Run fourmolu"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Set up and run fourmolu
run: |
nix shell nixpkgs#haskellPackages.fourmolu --command fourmolu --mode check .
generateMatrix:
name: "Generate matrix from cabal"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout base repo
uses: actions/checkout@v4
- name: Extract the tested GHC versions
id: set-matrix
run: |
wget https://github.com/Kleidukos/get-tested/releases/download/v0.1.3.0/get-tested-0.1.3.0-linux-amd64 -O get-tested
chmod +x get-tested
./get-tested --ubuntu rhine/rhine.cabal >> $GITHUB_OUTPUT
build-cabal:
runs-on: ubuntu-latest
needs: generateMatrix
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
name: Haskell GHC ${{ matrix.ghc }} cabal
steps:
- uses: actions/checkout@v4
- uses: haskell/actions/setup@v2
id: setup-haskell-build
with:
ghc-version: ${{ matrix.ghc }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
- name: Cache Cabal build artifacts
uses: actions/cache@v3
with:
path: |
${{ steps.setup-haskell-build.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-cabal-${{ matrix.ghc }}
restore-keys: |
${{ runner.os }}-cabal-${{ matrix.ghc }}
- name: Cabal update
run: cabal update
- name: Cabal build dependencies except rhine-bayes
# Temporarily disable building rhine-bayes on GHC 9.4.4
if: ${{ matrix.ghc == '9.4.4' }}
run: |
cabal build all --project-file cabal.9.4.4.project --enable-tests --only-dependencies
- name: Cabal build dependencies
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: |
cabal build all --enable-tests --only-dependencies
- name: Cabal build packages except rhine-bayes
if: ${{ matrix.ghc == '9.4.4' }}
run: |
cabal build all --project-file cabal.9.4.4.project --enable-tests -fdev
- name: Cabal build packages
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: |
cabal build all --enable-tests -fdev
- name: Cabal test all except rhine-bayes
if: ${{ matrix.ghc == '9.4.4' }}
run: |
cabal test all --project-file cabal.9.4.4.project --enable-tests --test-show-details=Always
- name: Cabal test
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: |
cabal test all --enable-tests --test-show-details=Always
build-stack:
runs-on: ubuntu-latest
needs: generateMatrix
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
name: Haskell GHC ${{ matrix.ghc }} stack
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
- name: Cache stack build artifacts
uses: freckle/stack-cache-action@v2
with:
stack-yaml: stack.${{ matrix.ghc }}.yaml
- name: Stack build and test
run: |
stack build --system-ghc --test --stack-yaml stack.${{ matrix.ghc }}.yaml
build-flake:
name: Nix Flake
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- name: Build default package (rhine)
run: nix build
- name: Build default package (rhine-examples)
run: nix build .#rhine-examples
- name: Build default package (rhine-gloss)
run: nix build .#rhine-gloss
- name: Build default package (rhine-bayes)
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: nix build .#rhine-bayes
- name: Run tests except rhine-bayes
if: ${{ matrix.ghc == '9.4.4' }}
run: nix develop -c cabal test all --project-file cabal.9.4.4.project
- name: Run tests
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: nix develop -c cabal test all
# nix flake check breaks on IFD in multi-platform flake https://github.com/NixOS/nix/issues/4265
# - run: nix flake check