diff --git a/Jenkinsfile b/Jenkinsfile index ea3a3b3..95208eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,28 +1,51 @@ pipeline { agent any + options { + timestamps() + buildDiscarder(logRotator(numToKeepStr: '10')) + } + stages { - stage('Build') { + stage('Build Linux') { steps { sh ''' - echo "Building project..." - mkdir -p build - g++ main.cpp -o build/test_app + mkdir -p build/linux + g++ main.cpp -o build/linux/test_app ''' } } - stage('Run') { + stage('Build Windows') { steps { sh ''' - ./build/test_app + mkdir -p build/windows + x86_64-w64-mingw32-g++ main.cpp -o build/windows/test_app.exe + ''' + } + } + + stage('Run Linux') { + steps { + sh ''' + ./build/linux/test_app + ''' + } + } + + stage('Package') { + steps { + sh ''' + cd build + tar -czf linux-build.tar.gz linux + zip -r windows-build.zip windows ''' } } stage('Archive') { steps { - archiveArtifacts artifacts: 'build/**', fingerprint: true + archiveArtifacts artifacts: 'build/linux-build.tar.gz, build/windows-build.zip', fingerprint: true } } }