pipeline {
  agent {
    docker {
      image 'docker.pkgs.xarth.tv/ml/python3.7-poetry:latest'
      args '-u jenkins:jenkins'
    }
  }

  stages {
    stage('Install, Test, Build') {
      steps('Install, Test, Lint') {
        sh """
        poetry install
        make test
        make check
        poetry build -f wheel
        """
      }
    }

    stage('Deploy Pypi') {
      when { branch 'master' }
      steps {
        withCredentials([[$class: 'StringBinding', credentialsId: 'dta_tools_deploy', variable: 'DTA_TOOLS_DEPLOY_PASS']]) {
          sh """
            # Upload your package to artifactory
            uploadPypi --upload dist/*
          """
        }
      }
    }
  }
}

