├── ops.py ├── test_ops.py ├── Jenkinsfile └── LICENSE /ops.py: -------------------------------------------------------------------------------- 1 | def add(x,y): 2 | return x+y 3 | 4 | def subtract(x,y): 5 | return x-y 6 | 7 | def multiply(x,y): 8 | return x*y 9 | 10 | def divide(x,y): 11 | return x/y -------------------------------------------------------------------------------- /test_ops.py: -------------------------------------------------------------------------------- 1 | from ops import * 2 | 3 | def test_add(): 4 | assert add(2,3) == 5 5 | 6 | def test_subtract(): 7 | assert subtract(2, 3) == -1 8 | 9 | def test_multiply(): 10 | assert multiply(2, 3) == 6 11 | 12 | def test_divide(): 13 | assert divide(10,5) == 2 -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | 4 | stages { 5 | stage('Checkout') { 6 | steps { 7 | checkout([$class: 'GitSCM', branches: [[name: 'main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/omardbaa/CI_CD_Jinkins_Demo.git']]]) 8 | } 9 | } 10 | stage('Build') { 11 | steps { 12 | git branch: 'main', url: 'https://github.com/omardbaa/CI_CD_Jinkins_Demo.git' 13 | sh 'python3 ops.py' 14 | } 15 | } 16 | stage('Test') { 17 | steps { 18 | sh 'python3 -m pytest' 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 omardbaa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------