######################################################
##                                                  ##
##  !!!! Autogenerated YAML file, do not edit !!!!  ##
##                                                  ##
##  Edit source in /src/github/workflows/ instead!  ##
##                                                  ##
######################################################
defaults:
  run:
    shell: bash
jobs:
  cabal:
    strategy:
      matrix:
        ghc-ver:
        - 9.2.1
        cabal-ver:
        - latest
        os:
        - ubuntu-latest
        - macos-latest
      fail-fast: false
    runs-on: ${{ matrix.os }}
    needs: auto-cancel
    steps:
    - with:
        submodules: recursive
      uses: actions/checkout@v2
    - with:
        cabal-version: ${{ matrix.cabal-ver }}
        ghc-version: ${{ matrix.ghc-ver }}
      uses: haskell/actions/setup@v1
      id: setup-haskell
    - run: |
        export GHC_VER=$(ghc --numeric-version)
        export CABAL_VER=$(cabal --numeric-version)
        echo "GHC_VER   = ${GHC_VER}"
        echo "CABAL_VER = ${CABAL_VER}"
        echo "GHC_VER=${GHC_VER}"       >> ${GITHUB_ENV}
        echo "CABAL_VER=${CABAL_VER}"   >> ${GITHUB_ENV}
      name: Environment settings based on the Haskell setup
    - run: |
        cabal update
        cabal configure -O1 --enable-tests
      name: Configure the build plan
    - with:
        path: |
          ${{ steps.setup-haskell.outputs.cabal-store }}
        key: ${{ runner.os }}-cabal-test-${{ env.GHC_VER }}-${{ env.CABAL_VER }}-${{
          hashFiles('**/plan.json') }}
      uses: actions/cache@v2
      name: Cache dependencies
      id: cache
    - if: ${{ !steps.cache.outputs.cache-hit }}
      run: |
        cabal build --only-dependencies --enable-tests
      name: Install dependencies
    - run: |
        mkdir -p ${HOME}/bin
        cabal install --installdir=${HOME}/bin
      name: Install Agda
    - run: |
        export PATH=${HOME}/bin:${PATH}
        cabal test
      name: Build and test Agda
  auto-cancel:
    if: |
      !contains(github.event.head_commit.message, '[skip ci]')
      && !contains(github.event.head_commit.message, '[ci skip]')
      && !contains(github.event.head_commit.message, '[github skip]')
      && !contains(github.event.head_commit.message, '[skip github]')
    runs-on: Ubuntu-latest
    steps:
    - with:
        access_token: ${{ github.token }}
      uses: styfle/cancel-workflow-action@0.6.0
name: cabal-test
'on':
  pull_request:
    paths:
    - .github/workflows/cabal-test.yml
    - Agda.cabal
    - Setup.hs
    - src/full/**
    - src/main/**
    - test/**.hs
  push:
    branches:
    - master
    - ci-*
    - release*
    paths:
    - .github/workflows/cabal-test.yml
    - Agda.cabal
    - Setup.hs
    - src/full/**
    - src/main/**
    - test/**.hs
