-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
88 lines (88 loc) · 2.06 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
pipeline {
agent {
label "docker && linux"
}
options {
preserveStashes(buildCount: 5)
}
stages {
stage ('Build') {
agent {
docker {
image 'python:3'
label "docker && linux"
}
}
environment {
TAG_BUILD = """${sh(returnStdout: true, script: 'bash -c "[[ \\$TAG_NAME ]] && echo -n \'\' || echo -n --tag-build \\\'dev0+git-${GIT_COMMIT}\\\'"')}"""
}
steps {
sh "rm dist/* || true"
sh "mkdir -p .venv; python -m venv .venv; .venv/bin/pip install setuptools wheel;"
sh ".venv/bin/python setup.py egg_info ${env.TAG_BUILD} sdist bdist_wheel"
archiveArtifacts artifacts: 'dist/*'
stash includes: 'dist/*', name: 'built'
}
}
stage ('Test') {
agent {
dockerfile {
label "docker && linux"
filename 'Dockerfile.build'
}
}
environment {
PYTHONPATH="."
}
steps {
sh "pytest --junit-xml=junit.xml --cov-branch --cov=nmfu --cov-report=xml || true"
junit 'junit.xml'
recordCoverage sourceCodeRetention: 'EVERY_BUILD', tools: [[parser: 'COBERTURA', pattern: 'coverage.xml']]
}
}
stage('Deploy/Package') {
when {
beforeInput true
buildingTag()
}
input {
id 'Should-release-nmfu'
message 'Release this version of NMFU?'
ok 'Yes, do it!'
parameters {
choice(choices: ['pypi', 'testpypi'], description: 'Which registry should the package be sent to?', name: 'PYPI_REPOSITORY_NAME')
}
submitter 'matthew'
}
parallel {
stage ('Upload PyPI') {
agent {
dockerfile {
label "docker && linux"
filename 'Dockerfile.build'
}
}
environment {
DPYPI_INFO = credentials('pip-password')
}
steps {
unstash name: 'built'
sh 'twine upload -u $DPYPI_INFO_USR -p $DPYPI_INFO_PSW -r $PYPI_REPOSITORY_NAME --non-interactive dist/*'
}
}
stage('Generate AppImage') {
agent {
dockerfile {
label "docker && linux"
filename 'Dockerfile.appimage'
}
}
steps {
sh "appimage-builder"
archiveArtifacts "*.AppImage"
}
}
}
}
}
}