name: QP Compilation

on:
  push:
    branches:
    - master
    - dev-stable
  pull_request:
    branches:
    - dev-stable
    - master


jobs:

  configuration:
    runs-on: ubuntu-20.04
    name: Dependencies

    steps:
       - name: install dependencies
         run: |
           sudo apt install gfortran gcc liblapack-dev libblas-dev wget python3 make m4 pkg-config

  compilation:
    name: Compilation
    runs-on: ubuntu-20.04

    steps:
       - uses: actions/checkout@v3
       - name: Restore configuration
         id: restore
         uses: actions/cache@v3
         continue-on-error: false
         with:
           key: qp2-config
           fail-on-cache-miss: true
           path: |
             external/opampack/
             include/
             lib/
             lib64/
             libexec/
           restore-keys: qp2-
       - name: Configuration
         run: |
              ./configure -i ninja || :
              ./configure -i docopt || :
              ./configure -i resultsFile || :
              ./configure -i bats || :
              ./configure -i trexio-nohdf5 || :
              ./configure -c ./config/gfortran_debug.cfg
       - name: Compilation
         run: |
              bash -c "source quantum_package.rc ; exec ninja"



