-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
55 lines (45 loc) · 1.63 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
/* CLI Client build/packaging pipeline. This does a build and generates build artifacts for the
* supported platforms
*/
pipeline {
options {
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '') // keep builds for 30 days
}
agent {
label 'rust-crossbuild'
}
stages {
stage('Check and Build') {
steps {
script {
github.setBuildStatus('codedx/codedx-cli-client', env.GIT_COMMIT, 'package/jenkins/build.codedx.io', 'pending', 'Preparing to build...')
}
withCache(name: 'rust-cargo-cache', baseFolder: '$HOME/.cargo', contents: 'registry') {
script {
github.setBuildStatus('codedx/codedx-cli-client', env.GIT_COMMIT, 'package/jenkins/build.codedx.io', 'pending', '`cargo check`')
}
sh "cargo check"
script {
github.setBuildStatus('codedx/codedx-cli-client', env.GIT_COMMIT, 'package/jenkins/build.codedx.io', 'pending', '`cargo build`')
}
sh "cargo build --release --target=x86_64-unknown-linux-musl"
sh "cargo build --release --target=x86_64-pc-windows-gnu"
sh "cargo build --release --target=x86_64-apple-darwin"
}
}
post {
success {
script {
github.setBuildStatus('codedx/codedx-cli-client', env.GIT_COMMIT, 'package/jenkins/build.codedx.io', 'success', '')
}
archiveArtifacts artifacts: 'target/*/release/codedx-client, target/*/release/codedx-client.exe', fingerprint: true
}
failure {
script {
github.setBuildStatus('codedx/codedx-cli-client', env.GIT_COMMIT, 'package/jenkins/build.codedx.io', 'failed', 'Build failed')
}
}
}
}
}
}