-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathJenkinsfile
80 lines (72 loc) · 3.42 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
// See help here:
// - https://www.jenkins.io/doc/book/pipeline/
// - https://www.jenkins.io/doc/book/pipeline/syntax/
// - https://www.jenkins.io/doc/pipeline/steps/
//
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '30'))
}
environment {
// this enables ruby gem binaries, such as xcpretty
PATH = "$HOME/.rbenv/bin:$HOME/.rbenv/shims:/usr/local/bin:/usr/local/sbin:$PATH"
// to enable utf-8 in logs output
LC_CTYPE = "en_US.UTF-8"
CONFIG_KEY_STAGING = credentials('CONFIG_KEY_STAGING')
CONFIG_KEY_PROD = credentials('CONFIG_KEY_PROD')
CONFIG_FILE_STAGING = credentials('CONFIG_FILE_STAGING')
CONFIG_FILE_PROD = credentials('CONFIG_FILE_PROD')
ENCRYPTION_KEY = credentials('ENCRYPTION_KEY')
CODECOV_TOKEN = credentials('CODECOV_TOKEN')
}
stages {
stage('Unit Test') {
when {
allOf {
// Jenkins checks out PRs with a PR-XXX format
expression { BRANCH_NAME ==~ /^PR-.*/ }
}
}
steps {
ansiColor('xterm') {
// clean build dir
// (was useful when CoreData code generation didn't work properly for some reason)
sh "rm -rf Build"
sh 'rm -f Multisig/Cross-layer/Configuration/config.bundle/*.json'
sh 'cp -f \"${CONFIG_FILE_STAGING}\" \"Multisig/Cross-layer/Configuration/config.bundle/apis-staging.enc.json\"'
sh 'CONFIG_KEY_STAGING=\"${CONFIG_KEY_STAGING}\" bin/test.sh \"Multisig - Staging\"'
junit 'Build/reports/junit.xml'
archiveArtifacts 'Build/*/xcodebuild-test.log'
archiveArtifacts 'Build/*/tests-bundle.xcresult.tgz'
}
}
}
stage('Upload to TestFlight') {
when {
allOf {
expression { BRANCH_NAME ==~ /^(main|release\/.*)$/ }
}
}
steps {
ansiColor('xterm') {
// NOTE: on Xcode 11.5, the keychain is not accessible
// by the xcode, so the Jenkins's builds are failing when
// user is logged out.
// The https://stackoverflow.com/a/55699898 has a fix.
// After applying it, the first build has to be manually
// granted the access to the signing certificates via
// the machine's UI (remotely or directly), then
// the uploading to AppStoreConnect started to work.
sh 'rm -f Multisig/Cross-layer/Configuration/config.bundle/*.json'
sh 'cp -f \"${CONFIG_FILE_PROD}\" Multisig/Cross-layer/Configuration/config.bundle/apis-prod.enc.json'
sh 'CONFIG_KEY_PROD=\"${CONFIG_KEY_PROD}\" bin/archive.sh \"Multisig - Production\"'
sh 'rm -f Multisig/Cross-layer/Configuration/config.bundle/*.json'
sh 'cp -f \"${CONFIG_FILE_STAGING}\" Multisig/Cross-layer/Configuration/config.bundle/apis-staging.enc.json'
sh 'CONFIG_KEY_STAGING=\"${CONFIG_KEY_STAGING}\" bin/archive.sh \"Multisig - Staging\"'
archiveArtifacts 'Build/*/xcodebuild-*.log'
}
}
}
}
}