pipeline {
    agent any

    stages {
        stage('Checkout') {
            steps {
                git url: 'https://git.comsys.kpi.ua/student077/lab4.git', credentialsId: 'jenkins_access'
            }
        }
        
        stage('Build') {
            steps {
                // Êðîê äëÿ çá³ðêè ïðîåêòó ç Visual Studio
                // Âñòàíîâ³òü ïðàâèëüí³ øëÿõè äî ð³øåííÿ/ïðîåêòó òà ïàðàìåòðè MSBuild
                bat '"D:\Install\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" IT-management-lab4.sln /t:Build /p:Configuration=Release'
            }
        }

        stage('Test') {
            steps {
                // Êîìàíäè äëÿ çàïóñêó òåñò³â
                bat "x64\\Debug\\test_repos.exe --gtest_output=xml:test_report.xml"
            }
        }
    }

    post {
    always {
        // Publish test results using the junit step
         // Specify the path to the XML test result files
         junit 'test_report.xml'
    }
}
}