name: Tests

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-18.04, macos-latest]
        include:
          - os: macos-latest
            install_deps: brew install llvm@9
            path_extension: $(brew --prefix llvm@9)/bin
          - os: ubuntu-18.04
            install_deps: sudo apt-get install llvm-9-tools llvm-9-dev
            path_extension: /usr/lib/llvm-9/bin

    runs-on: ${{ matrix.os }}

    steps:
    - name: Checkout the repository
      uses: actions/checkout@v2

    - name: Setup Haskell Stack
      uses: actions/setup-haskell@v1
      with:
        enable-stack: true
        stack-no-global: true
        stack-version: 'latest'

    - name: Install system dependencies
      run: |
        ${{ matrix.install_deps }}
        echo "::add-path::${{ matrix.path_extension }}"

    - name: Cache
      uses: actions/cache@v2
      with:
        path: |
          ~/.stack
          $GITHUB_WORKSPACE/.stack-work
        key: ${{ runner.os }}-${{ hashFiles('**/*.cabal', 'stack*.yaml') }}
        restore-keys: ${{ runner.os }}-

    - name: Build
      run: make

    - name: Run tests
      run: make tests

name: Tests

on:
  push:
    branches: [ main, dev ]
  pull_request:
    branches: [ main, dev ]

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-18.04, macos-latest]
        include:
          - os: macos-latest
            install_deps: brew install llvm@9
            path_extension: $(brew --prefix llvm@9)/bin
          - os: ubuntu-18.04
            install_deps: sudo apt-get install llvm-9-tools llvm-9-dev
            path_extension: /usr/lib/llvm-9/bin

    runs-on: ${{ matrix.os }}

    steps:
    - name: Checkout the repository
      uses: actions/checkout@v2

    - name: Setup Haskell Stack
      uses: actions/setup-haskell@v1
      with:
        enable-stack: true
        stack-no-global: true
        stack-version: 'latest'

    - name: Install system dependencies
      run: |
        ${{ matrix.install_deps }}
        echo "::add-path::${{ matrix.path_extension }}"

    - name: Cache
      uses: actions/cache@v2
      with:
        path: |
          ~/.stack
          $GITHUB_WORKSPACE/.stack-work
        key: ${{ runner.os }}-${{ hashFiles('**/*.cabal', 'stack*.yaml') }}
        restore-keys: ${{ runner.os }}-

    - name: Build
      run: make

    - name: Run tests
      run: make tests

Enable CI on the dev branch
Enable CI on the dev branch
