-
Notifications
You must be signed in to change notification settings - Fork 10
/
GithubReleasePluginIntegTest.groovy
98 lines (77 loc) · 3.17 KB
/
GithubReleasePluginIntegTest.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package org.shipkit.github.release
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import org.shipkit.BaseSpecification
/**
* Smoke test, we don't want an integration test that actually posts to Github
*/
class GithubReleasePluginIntegTest extends BaseSpecification {
@Rule TemporaryFolder tmp = new TemporaryFolder()
def setup() {
file("settings.gradle")
}
def "basic task configuration"() {
file("build.gradle") << """
plugins {
id 'org.shipkit.shipkit-github-release'
}
tasks.named("githubRelease") {
repository = "shipkit/shipkit-changelog"
changelog = file("changelog.md")
newTagRevision = "ff2fb22b3bb2fb08164c126c0e2055d57dee441b"
githubToken = "secret"
}
"""
expect:
runner("githubRelease", "-m").build()
}
def "complete task configuration"() {
file("build.gradle") << """
plugins {
id 'org.shipkit.shipkit-github-release'
}
tasks.named("githubRelease") {
//Github API url, configure if you use Github Enterprise, default as below
githubApiUrl = "https://api.github.com"
//Repository where to create a release, *no default*
repository = "shipkit/shipkit-changelog"
//The file with changelog (release notes), *no default*
changelog = file("changelog.md")
//The name of the release, default as below
releaseName = "v" + project.version
//SHA of the revision from which release is created; *no default*
newTagRevision = "ff2fb22b3bb2fb08164c126c0e2055d57dee441b"
//Release tag, by default it is "v" + project.version
releaseTag = "v" + project.version
//Github token used for posting to Github API, *no default*
githubToken = "secret"
}
"""
expect:
runner("githubRelease", "-m").build()
}
def "fails with clean exception"() {
file("build.gradle") << """
plugins { id 'org.shipkit.shipkit-github-release' }
version = "1.2.3"
file("changelog.md") << "Spanking new release!"
tasks.named("githubRelease") {
repository = "shipkit/shipkit-changelog"
changelog = file("changelog.md")
newTagRevision = "ff2fb22b3bb2fb08164c126c0e2055d57dee441b"
githubToken = "secret"
}
"""
when:
def result = runner("githubRelease", "-s").buildAndFail()
then: //fails because we don't have the credentials
result.output.contains """Unable to post release to Github.
* url: https://api.github.com/repos/shipkit/shipkit-changelog/releases
* release tag: v1.2.3
* release name: v1.2.3
* token: sec...
* content:
Spanking new release!
* underlying problem:"""
}
}