Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Fix the predicate for the Github publish task
Browse files Browse the repository at this point in the history
  • Loading branch information
Azurelol committed Jul 6, 2021
1 parent 52d7527 commit cad3b16
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
package wooga.gradle.release

import org.ajoberstar.grgit.Grgit
import org.gradle.api.Task
import org.gradle.api.specs.Spec
import spock.lang.Ignore
import spock.lang.Unroll
import wooga.gradle.github.publish.GithubPublishPlugin
import wooga.gradle.paket.get.PaketGetPlugin
import wooga.gradle.unity.UnityPlugin

Expand All @@ -43,7 +46,6 @@ class ReleasePluginIntegrationSpec extends IntegrationSpec {
}



// @Unroll("verify dependency setup to #testType unity sub-projects")
// def "verify dependency setup to unity sub-projects"() {
// given: "some subprojects with net.wooga.unity applied"
Expand Down Expand Up @@ -329,12 +331,12 @@ class ReleasePluginIntegrationSpec extends IntegrationSpec {
createFile("paket.dependencies")

and: "optional paket.lock"
if(lock_status) {
if (lock_status) {
createFile("paket.lock")
}
def paketLock = new File(projectDir,"paket.lock")
def paketLock = new File(projectDir, "paket.lock")

assert(paketLock.exists() == lock_status)
assert (paketLock.exists() == lock_status)

when:
def result = runTasksSuccessfully("setup")
Expand Down Expand Up @@ -416,21 +418,55 @@ class ReleasePluginIntegrationSpec extends IntegrationSpec {
'12.34.200-2334' | 123600
}

// TODO: Implement when release notes page is added
@Ignore
def "writes release notes for release description "() {
@Unroll
def "predicates for #taskNames are #satisfiedMessage when release stage is #value and github repository is #repositoryName"() {

given:
given: "a properties file that sets the release.stage"
def propertiesFile = createFile("gradle.properties")
propertiesFile << """
release.stage = ${value}
""".stripIndent()

when: "gradle project with plugin applied and evaluated"
buildFile << """
group = 'test'
${applyPlugin(ReleasePlugin)}
""".stripIndent()

// TODO: Not needed anymore, right?
// and: "configured repository branch"
// if (repositoryName) {
// project.github.repositoryName = repositoryName
// }

when:
//def result = runTasksSuccessfully("check")
def result = runTasksSuccessfully("releaseNotesMD")
runTasksSuccessfully("test")

then:
fileExists("${projectDir}/outputs/release-notes.md")
for (taskName in taskNames) {
def task = project.tasks.getByName(taskName)
Spec<? super Task> predicate = task.getOnlyIf()
assert predicate.isSatisfiedBy(task) == satisfied
}

where:
value | repositoryName | satisfied
'rc' | "wooga/testRepo" | true
'rc' | null | false
'final' | "wooga/testRepo" | true
'final' | null | false
// TODO: Should release be still supported?
'release' | "wooga/testRepo" | false
'release' | null | false
// TODO: Should candidate be still supported?
'candidate' | "wooga/testRepo" | false
'candidate' | null | false
'snapshot' | "wooga/testRepo" | false
'snapshot' | null | false
'random value' | "wooga/testRepo" | false
'random value' | null | false

taskNames = [GithubPublishPlugin.PUBLISH_TASK_NAME, ReleasePlugin.RELEASE_NOTES_BODY_TASK_NAME]
satisfiedMessage = satisfied ? "satisfied" : "not satisfied"
}
}
Loading

0 comments on commit cad3b16

Please sign in to comment.