name: Test library

on: [push, pull_request]

jobs:
  test:
    name: Build and test
    runs-on: ubuntu-20.04

    strategy:
      matrix:
        compiler:
          - clang
          - gcc

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Install dependencies
        run: sudo apt-get install csh clang

      - name: Build
        run: |
          cp MAKE_INC/make.linux make.inc
          # We use ~ instead of / as a separator in sed, since $(pwd)
          # also includes /
          sed -i  "s~^SuperLUroot\s*=.*~SuperLUroot = $(pwd)~g" make.inc
          sed -i  "s/^CC\s*=.*/CC = ${CC_CI}/g" make.inc
          mkdir lib
          make install lib
        env:
          CC_CI: ${{ matrix.compiler }}
                
      - name: Test
        run: |
          make testing
