Skip to content

Commit 2101eb1

Browse files
Create Jenkinsfile
Added the jenkins file for the cicd setup.
1 parent c27327e commit 2101eb1

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

Jenkinsfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
pipeline {
2+
agent any
3+
4+
environment {
5+
VENV = 'venv'
6+
}
7+
8+
stages {
9+
stage('Clone Repo') {
10+
steps {
11+
git 'https://github.com/ap-dev-github/sentiment-analyzer-api.git'
12+
}
13+
}
14+
15+
stage('Set Up Python') {
16+
steps {
17+
sh '''
18+
python3 -m venv venv
19+
. venv/bin/activate
20+
pip install --upgrade pip
21+
pip install -r requirements.txt
22+
'''
23+
}
24+
}
25+
26+
stage('Lint & Security') {
27+
steps {
28+
sh '''
29+
. venv/bin/activate
30+
flake8 .
31+
bandit -r . || true
32+
isort . --check-only
33+
mypy . || true
34+
'''
35+
}
36+
}
37+
38+
stage('Run Tests') {
39+
steps {
40+
sh '''
41+
. venv/bin/activate
42+
pytest tests/ --junitxml=results.xml
43+
'''
44+
}
45+
}
46+
47+
stage('Deploy to Lambda') {
48+
steps {
49+
sh '''
50+
. venv/bin/activate
51+
npm install -g serverless
52+
serverless deploy --stage dev
53+
'''
54+
}
55+
}
56+
}
57+
58+
post {
59+
always {
60+
junit 'results.xml'
61+
}
62+
}
63+
}

0 commit comments

Comments
 (0)