-
Notifications
You must be signed in to change notification settings - Fork 15
/
.space.kts
84 lines (77 loc) · 2.84 KB
/
.space.kts
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
/**
* JetBrains Space Automation
* This Kotlin-script file lets you automate build activities
* For more info, see https://www.jetbrains.com/help/space/automation.html
*/
job("build and test in latest preimage") {
startOn {
//push in phantasus repo
gitPush {
anyBranchMatching {
+"master"
}
}
}
container(displayName = "Build R package and copy to share", image = "ctlab.registry.jetbrains.space/p/phantasus/phantasus-containers/phantasus-preimage") {
shellScript {
content = """
R CMD build .
FILE=${'$'}(ls -1t *.tar.gz | head -n 1)
cp ${'$'}FILE $mountDir/share/
"""
}
}
parallel{
sequential{
container(displayName = "Check builded package", image = "ctlab.registry.jetbrains.space/p/phantasus/phantasus-containers/phantasus-preimage") {
shellScript {
content = """
FILE=${'$'}(ls -1t $mountDir/share/*.tar.gz | head -n 1)
export _R_CHECK_FORCE_SUGGESTS_=FALSE
R CMD check "${'$'}FILE" --no-manual
"""
}
}
}
container(displayName = "Check js", image = "ctlab.registry.jetbrains.space/p/phantasus/phantasus-containers/phantasus-preimage") {
shellScript {
content = """
add-apt-repository -y ppa:mozillateam/ppa
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | tee /etc/apt/preferences.d/mozilla-firefox
apt-get update && apt-get install -y --no-install-recommends nodejs npm firefox
bash inst/test_js.sh
"""
}
}
}
kaniko {
beforeBuildScript {
// Create an env variable BRANCH,
// use env var to get full branch name,
// leave only the branch name without the 'refs/heads/' path
content = """
export BRANCH=${'$'}(echo ${'$'}JB_SPACE_GIT_BRANCH | cut -d'/' -f 3)
export DOCKER_TAG=${'$'}BRANCH-${'$'}JB_SPACE_EXECUTION_NUMBER
case ${'$'}BRANCH in
"master") export LATEST="latest" ;;
*) export LATEST="test" ;;
esac
"""
}
build {
context = "."
dockerfile = "Dockerfile"
args["PREIMAGE_NAME"] = "ctlab.registry.jetbrains.space/p/phantasus/phantasus-containers/phantasus-preimage"
args["TARGET_BRANCH"] = "\$BRANCH"
args["PHANTASUS_BUILD"] = "\$DOCKER_TAG"
labels["vendor"] = "ctlab"
}
push("ctlab.registry.jetbrains.space/p/phantasus/phantasus-containers/phantasus") {
tags("\$DOCKER_TAG", "\$LATEST")
}
}
}