-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
41 lines (34 loc) · 1.02 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Jenkinsfile
pipeline {
agent any
stages {
stage('Git Checkout') {
steps {
echo 'Code checkout.'
git branch: 'main', url: 'https://github.com/cvamsikrishna11/python-cicd-repo.git'
}
}
stage('Prepare') {
steps {
echo 'Creating a virtual environment...'
sh 'python3 -m venv venv'
echo 'Installing required packages...'
sh 'venv/bin/python -m pip install -r requirements.txt'
}
}
stage('Test') {
steps {
echo 'Running tests with coverage...'
sh 'venv/bin/coverage run --source=. test_main.py'
sh 'venv/bin/coverage xml -o coverage.xml'
sh 'venv/bin/coverage html'
}
}
}
post {
always {
junit 'test-results.xml'
cobertura coberturaReportFile: 'coverage.xml'
}
}
}