pipeline {
    agent {
        dockerfile {
            filename 'ci/Dockerfile'
            args '--gpus 1'
            label 'docker && v100'
        }
    }
    options {
        timeout(time: 1, unit: 'HOURS')
    }
    environment {
        HOME = "$WORKSPACE"
    }
    stages {
        stage('Build') {
            steps {
                sh 'python3 -m pip install -U pip'
                sh 'python3 -m pip install -v .[cuda,test]'
            }
        }
        stage('Test') {
            environment {
                OMP_NUM_THREADS = "4"
            }
            steps {
                sh 'python3 -m pytest -v tests/'
            }
        }
    }
}
