-
Notifications
You must be signed in to change notification settings - Fork 26
/
smart-proxy.groovy
81 lines (74 loc) · 2.17 KB
/
smart-proxy.groovy
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
pipeline {
agent any
options {
timestamps()
timeout(time: 2, unit: 'HOURS')
ansiColor('xterm')
buildDiscarder(logRotator(daysToKeepStr: '7'))
}
stages {
stage('Test') {
matrix {
agent any
axes {
axis {
name 'ruby'
values '2.7', '3.0', '3.1'
}
}
stages {
stage("Clone repository") {
steps {
git url: git_url, branch: git_ref
}
}
stage("Test Ruby") {
steps {
run_test(env.ruby)
}
}
}
}
}
stage('Build and Archive Source') {
steps {
dir(project_name) {
git url: git_url, branch: git_ref
}
script {
archive_git_hash()
sourcefile_paths = generate_sourcefiles(project_name: project_name, source_type: source_type)
}
}
}
}
post {
success {
build(
job: "${project_name}-${git_ref}-package-release",
propagate: false,
wait: false
)
}
failure {
notifyDiscourse(env, "${project_name} source release pipeline failed:", currentBuild.description)
}
cleanup {
deleteDir()
}
}
}
def run_test(args) {
def ruby = args.ruby
def gemset = "ruby-${ruby}"
try {
configureRVM(ruby, gemset)
withRVM(["cp config/settings.yml.example config/settings.yml"], ruby, gemset)
withRVM(["bundle install --without=development --jobs=5 --retry=5"], ruby, gemset)
archiveArtifacts(artifacts: 'Gemfile.lock')
withRVM(["bundle exec rake jenkins:unit --trace"], ruby, gemset)
} finally {
cleanupRVM(ruby, gemset)
junit(testResults: 'jenkins/reports/unit/*.xml')
}
}