######################################################
##                                                  ##
##  !!!! Autogenerated YAML file, do not edit !!!!  ##
##                                                  ##
##  Edit source in /src/github/workflows/ instead!  ##
##                                                  ##
######################################################
jobs:
  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
  stack:
    env:
      ICU: mingw-w64-x86_64-icu
      NON_DEFAULT_FLAGS: --flag Agda:enable-cluster-counting --flag Agda:cpphs --flag
        Agda:debug
      EXTRA_ARGS: --fast
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        include:
        - stack-ver: latest
          ghc-ver: 9.2.1
          os: macos-latest
        - stack-ver: latest
          ghc-ver: 9.0.1
          os: windows-latest
        stack-ver:
        - latest
        ghc-ver:
        - 9.2.1
        - 9.0.2
        - 8.10.7
        - 8.8.4
        - 8.6.5
        - 8.4.4
        - 8.2.2
        - 8.0.2
        os:
        - ubuntu-18.04
      fail-fast: false
    runs-on: ${{ matrix.os }}
    needs: auto-cancel
    steps:
    - with:
        submodules: recursive
      uses: actions/checkout@v2
    - with:
        ghc-version: ${{ matrix.ghc-ver }}
        stack-version: ${{ matrix.stack-ver }}
        enable-stack: true
      uses: haskell/actions/setup@v1
      id: haskell-setup
    - run: |
        echo "runner.os         = ${{ runner.os                               }}"
        echo "OSTYPE            = ${{ env.OSTYPE                              }}"
        echo "ghc-path          = ${{ steps.haskell-setup.outputs.ghc-path    }}"
        echo "ghc-exe           = ${{ steps.haskell-setup.outputs.ghc-exe     }}"
        echo "cabal-path        = ${{ steps.haskell-setup.outputs.cabal-path  }}"
        echo "cabal-exe         = ${{ steps.haskell-setup.outputs.cabal-exe   }}"
        echo "cabal-store       = ${{ steps.haskell-setup.outputs.cabal-store }}"
        echo "stack-path        = ${{ steps.haskell-setup.outputs.stack-path  }}"
        echo "stack-exe         = ${{ steps.haskell-setup.outputs.stack-exe   }}"
        echo "stack-root        = ${{ steps.haskell-setup.outputs.stack-root  }}"
        echo "STACK_ROOT (orig) = ${{ env.STACK_ROOT                          }}"
        echo "STACK_ROOT=${{ steps.haskell-setup.outputs.stack-root }}" >> ${GITHUB_ENV}
        echo "STACK_VER=$(stack --numeric-version)"                     >> ${GITHUB_ENV}
        export GHC_VER=$(ghc --numeric-version)
        echo "GHC_VER=${GHC_VER}"                                       >> ${GITHUB_ENV}
        echo "ARGS=--stack-yaml=stack-${GHC_VER}.yaml --no-terminal"    >> ${GITHUB_ENV}
      name: Environment settings based on the Haskell setup
    - run: |
        echo "STACK_ROOT (fix)  = ${STACK_ROOT}"
        echo "STACK_VER         = ${STACK_VER}"
        echo "GHC_VER           = ${GHC_VER}"
      name: Environment (review)
    - run: |
        stack update --silent
        echo "system-ghc: true" >> ${STACK_ROOT}/config.yaml
        stack build ${ARGS} --dry-run
      name: Update and configure stack package index
    - with:
        path: ${{ steps.haskell-setup.outputs.stack-root }}
        key: |
          ${{ runner.os }}-stack-01-${{ env.STACK_VER }}-${{ hashFiles(format('stack-{0}.yaml.lock', env.GHC_VER)) }}
      uses: actions/cache@v2
      name: Cache dependencies
      id: cache
    - if: ${{ runner.os == 'Linux' }}
      run: |
        sudo apt-get update -qq
        sudo apt-get install libicu-dev -qq
      name: Install the icu library (Ubuntu)
    - if: ${{ runner.os == 'Windows' }}
      run: |
        stack exec ${ARGS} -- pacman --noconfirm -Sy msys2-keyring
        stack exec ${ARGS} -- pacman --noconfirm -S ${ICU}
        stack exec ${ARGS} -- pacman --noconfirm -S mingw-w64-x86_64-pkg-config
      name: Install the icu library (Windows)
    - if: ${{ runner.os == 'Linux' && env.GHC_VER == '8.4.4' }}
      run: |
        sudo apt-get install libnuma-dev -qq
      name: Install the numa library (Ubuntu, GHC 8.4.4)
    - if: ${{ !steps.cache.outputs.cache-hit }}
      run: stack build ${ARGS} ${EXTRA_ARGS} ${NON_DEFAULT_FLAGS} --test --only-dependencies
      name: Install dependencies for Agda and `agda-tests` (i.e. the test suite).
    - run: stack build ${ARGS} ${EXTRA_ARGS} --test --no-run-tests
      name: Build Agda with the default flags in Agda.cabal. Also build `agda-tests`
        (i.e. the test suite).
    - run: stack build ${ARGS} ${EXTRA_ARGS} ${NON_DEFAULT_FLAGS}
      name: Build Agda with the non-default flags Agda.cabal.
name: Build (stack)
'on':
  pull_request:
    paths:
    - .github/workflows/stack.yml
    - Agda.cabal
    - Setup.hs
    - stack*.yaml
    - src/agda-mode/**
    - src/full/**
    - src/main/**
    - src/size-solver/**
    - test/**.hs
  push:
    branches:
    - master
    - ci-*
    - release*
    paths:
    - .github/workflows/stack.yml
    - Agda.cabal
    - Setup.hs
    - stack*.yaml
    - src/agda-mode/**
    - src/full/**
    - src/main/**
    - src/size-solver/**
    - test/**.hs
