diff --git a/Jenkinsfile b/Jenkinsfile index 21fd56d..4f5fd07 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,17 +6,28 @@ stage('Build') { steps { echo 'Building..' - sh('./build.sh') + sh './build.sh' + archiveArtifacts artifacts: './build/hello*', fingerprint: true } } stage('Test') { steps { echo 'Testing..' + sh 'make test || true' + junit './build/*.xml' } } stage('Deploy') { steps { echo 'Deploying....' + when { + expression { + currentBuild.result == null || currentBuild.result == 'SUCCESS' + } + } + steps { + sh 'make publish' + } } } } diff --git a/Jenkinsfile b/Jenkinsfile index 21fd56d..4f5fd07 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,17 +6,28 @@ stage('Build') { steps { echo 'Building..' - sh('./build.sh') + sh './build.sh' + archiveArtifacts artifacts: './build/hello*', fingerprint: true } } stage('Test') { steps { echo 'Testing..' + sh 'make test || true' + junit './build/*.xml' } } stage('Deploy') { steps { echo 'Deploying....' + when { + expression { + currentBuild.result == null || currentBuild.result == 'SUCCESS' + } + } + steps { + sh 'make publish' + } } } } diff --git a/Makefile b/Makefile index 9cddf49..80f74c4 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,18 @@ all: - x86_64-linux-gnu-g++ Test.cpp -o Hello-linux-64 - x86_64-w64-mingw32-g++ Test.cpp -o Hello-win64.exe - x86_64-apple-darwin19-c++ Test.cpp -o Hello-macosx.bin + mkdir -p build + x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 + x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe + x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin +test: + mkdir -p build + echo "Blah" > build/tests.xml + + +publish: + echo "Publish..." +