pipeline {
  agent any

  stages {
    stage('lint') {
      steps {
        sh '''#!/bin/bash
        export PATH=$PATH:$CONDAPATH
        source activate climada_env
        rm -f pylint.log
        pylint -ry climada | tee pylint.log'''

        recordIssues tools: [pyLint(pattern: 'pylint.log')]
      }
    }

    stage('integ_test') {
      steps {
        sh '''#!/bin/bash
        export PATH=$PATH:$CONDAPATH
        source activate climada_env
        rm -rf tests_xml/
        rm -rf coverage/
        make test'''
      }
    }
  }

  post {
    always {
      junit 'tests_xml/*.xml'
      cobertura coberturaReportFile: 'coverage.xml', enableNewApi: false
    }
  }
}
