diff --git a/README.md b/README.md index a8ee7312c..5f7a3f98b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Example Voting App +Example Voting App, this is a sample voting App ========= Getting started @@ -58,3 +58,7 @@ Note ---- The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client. + +[![Build Status](https://eighty-cobras-slide.loca.lt/buildStatus/icon?job=instavote%2Fworker+build)](https://eighty-cobras-slide.loca.lt/job/instavote/job/worker%20build/) + +[![Build Status](https://eighty-cobras-slide.loca.lt/buildStatus/icon?job=instavote%2Fworker+test&subject=Unittest)](https://eighty-cobras-slide.loca.lt/job/instavote/job/worker%20test/) diff --git a/anto_test.txt b/anto_test.txt new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/anto_test.txt @@ -0,0 +1 @@ +test diff --git a/result/Jenkinsfile b/result/Jenkinsfile new file mode 100644 index 000000000..05d440370 --- /dev/null +++ b/result/Jenkinsfile @@ -0,0 +1,31 @@ +pipeline { + agent any + tools{ + nodejs 'NodeJS 22.4.0' + } + stages{ + stage("build"){ + when{ + changeset "**/result/**" + } + steps{ + echo 'Compiling result app' + dir('result'){ + sh 'npm install' + } + } + } + stage("test"){ + when{ + changeset "**/result/**" + } + steps{ + echo 'Running Unit Tests on result app' + dir('result'){ + sh 'npm install' + sh 'npm test' + } + } + } + } +} diff --git a/result/test/mock.test.js b/result/test/mock.test.js index aac871563..4a96f63cc 100644 --- a/result/test/mock.test.js +++ b/result/test/mock.test.js @@ -37,4 +37,9 @@ describe('mock test 6', () => { expect(true).to.be.true; }); }); +describe('mock test 7', () => { + it('unit test 7', () => { + expect(true).to.be.true; + }); +}); diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile new file mode 100644 index 000000000..c12ceba19 --- /dev/null +++ b/worker/Jenkinsfile @@ -0,0 +1,49 @@ +pipeline { + agent any + tools{ + maven 'maven 3.9.8' + } + stages{ + stage("build"){ + when{ + changeset "**/worker/**" + } + steps{ + echo 'Compiling worker app' + dir('worker'){ + sh 'mvn compile' + } + } + } + stage("test"){ + when{ + changeset "**/worker/**" + } + steps{ + echo 'Running Unit Tests on worker app' + dir('worker'){ + sh 'mvn clean test' + } + } + } + stage("package"){ + when{ + branch 'master' + changeset "**/worker/**" + } + steps{ + echo 'Packaging worker app' + dir('worker'){ + sh 'mvn package -DskipTests' + archiveArtifacts artifacts: '**/target/*.jar', +fingerprint: true } + + } + } + } + post{ + always{ + echo 'Building multibranch pipeline for worker is completed..' + } + } +}