Use two different jenkinsfile
This commit is contained in:
89
Jenkinsfile.ci
Normal file
89
Jenkinsfile.ci
Normal file
@@ -0,0 +1,89 @@
|
||||
pipeline {
|
||||
agent none
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
}
|
||||
|
||||
environment {
|
||||
NODE_OPTIONS = '--max_old_space_size=2048'
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Init') {
|
||||
agent any
|
||||
steps {
|
||||
script {
|
||||
env.COMMIT_AUTHOR = sh(
|
||||
script: "git show -s --format=%an HEAD",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
env.COMMIT_SHORT = sh(
|
||||
script: "git rev-parse --short HEAD",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
}
|
||||
|
||||
echo "CI build for commit ${env.COMMIT_SHORT} by ${env.COMMIT_AUTHOR}"
|
||||
}
|
||||
}
|
||||
|
||||
/* =========================
|
||||
BACKEND CI
|
||||
========================= */
|
||||
|
||||
stage('Backend: lint & test') {
|
||||
agent {
|
||||
docker {
|
||||
image 'python:3.11-slim'
|
||||
args '-u root'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir('backend') {
|
||||
sh '''
|
||||
set -e
|
||||
python -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements-dev.txt
|
||||
ruff check app tests
|
||||
pytest
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* =========================
|
||||
FRONTEND CI
|
||||
========================= */
|
||||
|
||||
stage('Frontend: check & build') {
|
||||
agent {
|
||||
docker {
|
||||
image 'node:20-slim'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir('frontend') {
|
||||
sh '''
|
||||
set -e
|
||||
npm install --no-progress --no-audit --prefer-offline
|
||||
npm run check
|
||||
npm run build
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user