-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Liftric/chore/update_dependencies
refactor: use Property API for lazy configuration & update dependencies
- Loading branch information
Showing
30 changed files
with
750 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,24 @@ jobs: | |
# needed for FirstCommitHashTaskTest | ||
fetch-depth: 0 | ||
- name: Cache | ||
uses: gradle/gradle-build-action@v2 | ||
uses: gradle/[email protected] | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: Download and Install Octo CLI | ||
run: | | ||
wget https://github.com/OctopusDeploy/OctopusCLI/releases/download/v9.1.7/OctopusTools.9.1.7.linux-x64.tar.gz | ||
mkdir -p $HOME/.local/bin | ||
tar -xzf OctopusTools.9.1.7.linux-x64.tar.gz -C $HOME/.local/bin | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Build | ||
run: ./gradlew build | ||
- name: Validate | ||
run: ./gradlew check validatePlugins --continue | ||
- name: Integration Test | ||
run: | | ||
octo --version | ||
java -version | ||
./gradlew integrationTest --no-daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
89 changes: 89 additions & 0 deletions
89
...tlin/com/liftric/octopusdeploy/task/UploadBuildInformationOverwriteTaskIntegrationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.liftric.octopusdeploy.task | ||
|
||
import com.liftric.octopusdeploy.apiKey | ||
import com.liftric.octopusdeploy.getBuildInformationResponse | ||
import com.liftric.octopusdeploy.serverUrl | ||
import junit.framework.TestCase.assertEquals | ||
import junit.framework.TestCase.assertNotNull | ||
import org.gradle.testkit.runner.GradleRunner | ||
import org.gradle.testkit.runner.TaskOutcome | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.rules.TemporaryFolder | ||
import kotlin.random.Random | ||
|
||
class UploadBuildInformationOverwriteTaskIntegrationTest { | ||
@get:Rule | ||
val testProjectDir = TemporaryFolder() | ||
|
||
@Test | ||
fun testExecute() { | ||
val major = Random.Default.nextInt(0, 100) | ||
val minor = Random.Default.nextInt(0, 100) | ||
val micro = Random.Default.nextInt(0, 100) | ||
println(testProjectDir.root.absolutePath) | ||
setupBuild(major, minor, micro) | ||
val result = GradleRunner.create() | ||
.forwardOutput() | ||
.withProjectDir(testProjectDir.root) | ||
.withArguments("build", "uploadBuildInformation") | ||
.withPluginClasspath() | ||
.build() | ||
println(result.output) | ||
assertEquals(TaskOutcome.SUCCESS, result.task(":uploadBuildInformation")?.outcome) | ||
val buildInfoItem = getBuildInformationResponse() | ||
.items | ||
?.firstOrNull { | ||
it.version == "$major.$minor.$micro" | ||
} | ||
assertNotNull(buildInfoItem) | ||
assertEquals("Git", buildInfoItem?.vcsType) | ||
|
||
val secondResult = GradleRunner.create() | ||
.forwardOutput() | ||
.withProjectDir(testProjectDir.root) | ||
.withArguments("build", "uploadBuildInformation") | ||
.withPluginClasspath() | ||
.build() | ||
println(secondResult.output) | ||
assertEquals(TaskOutcome.SUCCESS, secondResult.task(":uploadBuildInformation")?.outcome) | ||
} | ||
|
||
fun setupBuild(major: Int, minor: Int, micro: Int) { | ||
testProjectDir.newFile("build.gradle.kts").apply { | ||
writeText( | ||
""" | ||
import com.liftric.octopusdeploy.api.OverwriteMode | ||
plugins { | ||
java | ||
id("com.liftric.octopus-deploy-plugin") | ||
} | ||
group = "com.liftric.test" | ||
version = "$major.$minor.$micro" | ||
tasks { | ||
withType<Jar> { | ||
archiveFileName.set( | ||
"${'$'}{archiveBaseName.get() | ||
.removeSuffix("-")}.${'$'}{archiveVersion.get()}.${'$'}{archiveExtension.get()}" | ||
) | ||
} | ||
} | ||
octopus { | ||
serverUrl.set("$serverUrl") | ||
apiKey.set("$apiKey") | ||
generateChangelogSinceLastTag.set(true) | ||
buildInformationOverwriteMode.set(OverwriteMode.OverwriteExisting) | ||
val jar by tasks.existing(Jar::class) | ||
packageName.set(jar.get().archiveBaseName.get().removeSuffix("-")) | ||
version.set(jar.get().archiveVersion.get()) | ||
pushPackage.set(jar.get().archiveFile) | ||
} | ||
""" | ||
) | ||
} | ||
testProjectDir.root.setupGitRepoCopy() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.