-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
88 lines (80 loc) · 2.03 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 { dockerfile true }
stages {
stage('fetch') {
steps {
script {
if (env.JOB_NAME.endsWith("_pull-requests"))
setGitHubPullRequestStatus state: 'PENDING', context: "${env.JOB_NAME}", message: "Fetching dependencies"
}
ansiColor('xterm') {
sh '''#!/bin/bash
set -xeuo pipefail
DMD_VERSION=$(cat DMD_VERSION)
if [ -e dmd ]; then
pushd dmd
git fetch
git checkout -f ${DMD_VERSION}
popd
else
git clone https://github.com/dlang/dmd.git --branch ${DMD_VERSION}
fi
pushd dmd
git config user.name "WildBot"
git config user.email "[email protected]"
find .. -type f -name '*.patch' -exec git am '{}' \\;
popd
'''
}
}
}
stage('build') {
steps {
script {
if (env.JOB_NAME.endsWith("_pull-requests"))
setGitHubPullRequestStatus state: 'PENDING', context: "${env.JOB_NAME}", message: "Building powernex-dmd"
}
ansiColor('xterm') {
sh '''#!/bin/bash
set -xeuo pipefail
pushd dmd
make -f powernex.mak
mv generated/powernex/release/64/dmd ../powernex-dmd
popd
'''
}
}
}
stage('archive') {
steps {
script {
if (env.JOB_NAME.endsWith("_pull-requests"))
setGitHubPullRequestStatus state: 'PENDING', context: "${env.JOB_NAME}", message: "Archiving powernex-dmd"
}
ansiColor('xterm') {
sh '''#!/bin/bash
set -xeuo pipefail
mkdir bin
cp powernex-dmd dmd.conf bin
tar cvfJ powernex-dmd.tar.xz bin
'''
archiveArtifacts artifacts: 'powernex-dmd.tar.xz', fingerprint: true
}
}
}
}
post {
success {
script {
if (env.JOB_NAME.endsWith("_pull-requests"))
setGitHubPullRequestStatus state: 'SUCCESS', context: "${env.JOB_NAME}", message: "powernex-dmd building successed"
}
}
failure {
script {
if (env.JOB_NAME.endsWith("_pull-requests"))
setGitHubPullRequestStatus state: 'FAILURE', context: "${env.JOB_NAME}", message: "powernex-dmd building failed"
}
}
}
}