@@ -14,49 +14,47 @@ def needToBuild = false
1414
1515node(' words-linux' ) {
1616 cleanWs()
17- if (! params. branch. contains(" release" )) {
18- dir(' swift' ) {
19- try {
20- stage(' checkout' ){
21- checkout([$class : ' GitSCM' , branches : [[name : params. branch]], doGenerateSubmoduleConfigurations : false , extensions : [[$class : ' LocalBranch' , localBranch : " **" ]], submoduleCfg : [], userRemoteConfigs : [[credentialsId : ' 361885ba-9425-4230-950e-0af201d90547' , url : ' https://git.auckland.dynabic.com/words-cloud/words-cloud-sdk-swift.git' ]]])
22-
23- sh ' git show -s HEAD > gitMessage'
24- def commitMessage = readFile(' gitMessage' ). trim()
25- echo commitMessage
26- needToBuild = params. ignoreCiSkip || ! commitMessage. contains(' [ci skip]' )
27- sh ' git clean -fdx'
28-
29- if (needToBuild) {
30- withCredentials([usernamePassword(credentialsId : params. credentialsId, passwordVariable : ' ClientSecret' , usernameVariable : ' ClientId' )]) {
31- sh ' mkdir -p Settings'
32- sh ' echo "{\\ "ClientId\\ ": \\ "$ClientId\\ ",\\ "ClientSecret\\ ": \\ "$ClientSecret\\ ", \\ "BaseUrl\\ ": \\ "$apiUrl\\ "}" > Settings/servercreds.json'
33- }
17+ dir(' swift' ) {
18+ try {
19+ stage(' checkout' ){
20+ checkout([$class : ' GitSCM' , branches : [[name : params. branch]], doGenerateSubmoduleConfigurations : false , extensions : [[$class : ' LocalBranch' , localBranch : " **" ]], submoduleCfg : [], userRemoteConfigs : [[credentialsId : ' 361885ba-9425-4230-950e-0af201d90547' , url : ' https://git.auckland.dynabic.com/words-cloud/words-cloud-sdk-swift.git' ]]])
21+
22+ sh ' git show -s HEAD > gitMessage'
23+ def commitMessage = readFile(' gitMessage' ). trim()
24+ echo commitMessage
25+ needToBuild = params. ignoreCiSkip || ! commitMessage. contains(' [ci skip]' )
26+ sh ' git clean -fdx'
27+
28+ if (needToBuild) {
29+ withCredentials([usernamePassword(credentialsId : params. credentialsId, passwordVariable : ' ClientSecret' , usernameVariable : ' ClientId' )]) {
30+ sh ' mkdir -p Settings'
31+ sh ' echo "{\\ "ClientId\\ ": \\ "$ClientId\\ ",\\ "ClientSecret\\ ": \\ "$ClientSecret\\ ", \\ "BaseUrl\\ ": \\ "$apiUrl\\ "}" > Settings/servercreds.json'
3432 }
3533 }
34+ }
35+
36+ if (needToBuild) {
37+ docker. image(' swift:5.0' ). inside{
38+ stage(' build' ){
39+ sh " swift build"
40+ }
3641
37- if (needToBuild) {
38- docker. image(' swift:5.0' ). inside{
39- stage(' build' ){
40- sh " swift build"
42+ stage(' tests' ){
43+ try {
44+ sh " chmod +x ./Scripts/runTests.sh"
45+ sh " ./Scripts/runTests.sh"
46+ } finally {
47+ junit ' tests.xml'
4148 }
49+ }
4250
43- stage(' tests' ){
44- try {
45- sh " chmod +x ./Scripts/runTests.sh"
46- sh " ./Scripts/runTests.sh"
47- } finally {
48- junit ' tests.xml'
49- }
50- }
51-
52- stage(' clean-compiled' ){
53- sh " rm -rf %s"
54- }
55- }
56- }
57- } finally {
58- deleteDir()
51+ stage(' clean-compiled' ){
52+ sh " rm -rf %s"
53+ }
54+ }
5955 }
56+ } finally {
57+ deleteDir()
6058 }
6159 }
6260}
0 commit comments