language: c
dist: xenial

git:
  submodules: false  # whether to recursively clone submodules

matrix:
  include:
    - compiler: "ghc-8.8.1"
      addons: {apt: {packages: [ghc-8.8.1], sources: [hvr-ghc]}}
    - compiler: "ghc-8.6.5"
      addons: {apt: {packages: [ghc-8.6.5], sources: [hvr-ghc]}}
    - compiler: "ghc-8.4.4"
      addons: {apt: {packages: [ghc-8.4.4], sources: [hvr-ghc]}}
    - compiler: "ghc-8.2.2"
      addons: {apt: {packages: [ghc-8.2.2], sources: [hvr-ghc]}}
    - compiler: "ghc-8.0.2"
      addons: {apt: {packages: [ghc-8.0.2], sources: [hvr-ghc]}}

before_install:
  - HC=${CC}
  - HCPKG=${HC/ghc/ghc-pkg}
  - unset CC
  - ROOTDIR=$(pwd)
  - mkdir -p $HOME/.local/bin
  - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
  - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
  - echo $HCNUMVER

# Here starts the actual work to be performed for the package under test;
# any command which exits with a non-zero exit code causes the build to fail.
script:
  - chmod go-w .ghci
  - chmod go-w .
  - "echo :quit | ghci"