From cd1dc0f73a2ee9869ae41f5eb2222905052b4c71 Mon Sep 17 00:00:00 2001 From: Muizz Ali Date: Thu, 27 Mar 2025 23:32:36 -0600 Subject: [PATCH 1/6] Add initial Jenkins Pipeline --- Jenkinsfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..23579513d --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,13 @@ +pipeline { + agent { + docker { image 'python:2-alpine' } + } + stages { + stage('Build') { + steps { + sh 'python -m py_compile sources/add2vals.py sources/calc.py' + stash(name: 'compiled-results', includes: 'sources/*.py*') + } + } + } +} \ No newline at end of file From 7720b7c6fcd585c1e9841500bd8fddf8748efbc0 Mon Sep 17 00:00:00 2001 From: Muizz Ali Date: Thu, 27 Mar 2025 23:47:09 -0600 Subject: [PATCH 2/6] Add Test stage --- Jenkinsfile | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 23579513d..d09e6cbed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,29 @@ pipeline { - agent { - docker { image 'python:2-alpine' } - } + agent none stages { - stage('Build') { + stage('Build') { + agent { + docker { + image 'python:2-alpine' + } + } steps { - sh 'python -m py_compile sources/add2vals.py sources/calc.py' - stash(name: 'compiled-results', includes: 'sources/*.py*') + sh 'python -m py_compile sources/add2vals.py sources/calc.py' + } + } + stage('Test') { //1 + agent { + docker { + image 'qnib/pytest' //2 + } + } + steps { + sh 'py.test --verbose --junit-xml test-reports/results.xml sources/test_calc.py' //3 + } + post { + always { + junit 'test-reports/results.xml' //4 + } } } } From 9fcc8876fc4e49d36f74658784736c9724078a5d Mon Sep 17 00:00:00 2001 From: Muizz Ali Date: Thu, 27 Mar 2025 23:49:57 -0600 Subject: [PATCH 3/6] Add Deliver stage --- Jenkinsfile | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d09e6cbed..b43181e83 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,8 @@ pipeline { agent none + options { + skipStagesAfterUnstable() + } stages { stage('Build') { agent { @@ -11,18 +14,33 @@ pipeline { sh 'python -m py_compile sources/add2vals.py sources/calc.py' } } - stage('Test') { //1 + stage('Test') { agent { docker { - image 'qnib/pytest' //2 + image 'qnib/pytest' } } steps { - sh 'py.test --verbose --junit-xml test-reports/results.xml sources/test_calc.py' //3 + sh 'py.test --verbose --junit-xml test-reports/results.xml sources/test_calc.py' } post { always { - junit 'test-reports/results.xml' //4 + junit 'test-reports/results.xml' + } + } + } + stage('Deliver') { //1 + agent { + docker { + image 'cdrx/pyinstaller-linux:python2' //2 + } + } + steps { + sh '/root/.pyenv/shims/pyinstaller --onefile sources/add2vals.py' //3 + } + post { + success { + archiveArtifacts 'dist/add2vals' //4 } } } From 9ef3645fabc211cf11cf9cd54852fa19c0c5ca49 Mon Sep 17 00:00:00 2001 From: Muizz Ali Date: Fri, 28 Mar 2025 00:02:47 -0600 Subject: [PATCH 4/6] Update Jenkinsfile to build Windows EXE --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b43181e83..1709f0fd5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,7 +32,7 @@ pipeline { stage('Deliver') { //1 agent { docker { - image 'cdrx/pyinstaller-linux:python2' //2 + image 'cdrx/pyinstaller-windows:python2' //2 } } steps { @@ -40,7 +40,7 @@ pipeline { } post { success { - archiveArtifacts 'dist/add2vals' //4 + archiveArtifacts 'dist/add2vals.exe' //4 } } } From a4243f3c897b3e40c506f9852d5513e1a075d272 Mon Sep 17 00:00:00 2001 From: Muizz Ali Date: Fri, 28 Mar 2025 00:08:30 -0600 Subject: [PATCH 5/6] Update Jenkinsfile --- Jenkinsfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1709f0fd5..8080b9b8d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,20 +29,18 @@ pipeline { } } } - stage('Deliver') { //1 + stage('Deliver') { agent { docker { - image 'cdrx/pyinstaller-windows:python2' //2 + image 'cdrx/pyinstaller-windows:python2' } } steps { - sh '/root/.pyenv/shims/pyinstaller --onefile sources/add2vals.py' //3 + sh 'wine pyinstaller --onefile sources/add2vals.py' // Use 'wine' to execute PyInstaller } post { success { - archiveArtifacts 'dist/add2vals.exe' //4 + archiveArtifacts 'dist/add2vals.exe' // Archive the Windows EXE } } - } - } -} \ No newline at end of file + } \ No newline at end of file From 473accb88141e938b88a39091e151cdb53f54940 Mon Sep 17 00:00:00 2001 From: Muizz Ali Date: Fri, 28 Mar 2025 00:11:52 -0600 Subject: [PATCH 6/6] Update Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8080b9b8d..2e132941d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,4 +43,6 @@ pipeline { archiveArtifacts 'dist/add2vals.exe' // Archive the Windows EXE } } - } \ No newline at end of file + } + } +}