node {
    def app
    stage('Clone repository') {
        /* Let's make sure we have the repository cloned to our workspace */
        checkout scm
    }
    withEnv([
        "FINN_XILINX_PATH=/proj/xbuilds/SWIP/2022.2_1014_8888/installs/lin64",
        "FINN_XILINX_VERSION=2022.2",
        "FINN_DOCKER_TAG=xilinx/finn:jenkins",
        "FINN_HOST_BUILD_DIR=/scratch/users/finn_ci",
        "PLATFORM_REPO_PATHS=/opt/xilinx/platforms"
    ]){
        parallel firstBranch: {
            stage('Brevitas export') {
                dir("${env.WORKSPACE}") {
                sh("bash run-docker.sh python setup.py test --addopts -mbrevitas_export")
                }
            }
        }, secondBranch: {
            stage('Streamlining transformations') {
                dir("${env.WORKSPACE}") {
                sh("bash run-docker.sh python setup.py test --addopts -mstreamline")
                }
            }
        }, thirdBranch: {
            stage('Util functions') {
                dir("${env.WORKSPACE}") {
                sh("bash run-docker.sh python setup.py test --addopts -mutil")
                }
            }
        }, fourthBranch: {
            stage('General transformations') {
                dir("${env.WORKSPACE}") {
                sh("bash run-docker.sh python setup.py test --addopts -mtransform")
                }
            }
        }, fifthBranch: {
            stage('Fpgadataflow transformations and simulations') {
                dir("${env.WORKSPACE}") {
                sh("bash run-docker.sh python setup.py test --addopts -mfpgadataflow")
                }
            }
        }
    }
}