Skip to content

Commit

Permalink
feat(ci): add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Mirwald committed Aug 15, 2024
1 parent f128e8a commit 07e8ea5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,23 @@ jobs:
fetch-depth: 0
- name: Cache
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
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ gradlePlugin {
dockerCompose {
useComposeFiles.set(listOf("docker-compose.yml"))
waitForTcpPorts.set(true)
captureContainersOutput.set(true)
captureContainersOutput.set(false)
stopContainers.set(true)
removeContainers.set(true)
buildBeforeUp.set(true)
Expand Down
9 changes: 8 additions & 1 deletion src/main/kotlin/com/liftric/octopusdeploy/shell.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ internal fun shell(cmd: String, logger: Logger): ShellResult = File(".").shell(c

internal fun File.shell(cmd: String, logger: Logger): ShellResult {
val tmpDir = System.getProperty("java.io.tmpdir")
// GitHub Workflow Fix for Integration Test
val env = System.getenv().toMutableMap()
env["GITHUB_PATH"]?.let { githubPath ->
env["PATH"] = "${env["PATH"]}:$githubPath"
}
val envArray = env.map { (key, value) -> "$key=$value" }.toTypedArray()

// DOTNET_BUNDLE_EXTRACT_BASE_DIR is a workaround for https://github.com/dotnet/runtime/issues/3846
val cmdarray = arrayOf("sh", "-c", "DOTNET_BUNDLE_EXTRACT_BASE_DIR=$tmpDir $cmd")
val cmdDir = this
logger.debug("shell: cmdarray='${cmdarray.toList()}'")
logger.debug("shell: cmdDir='$cmdDir'")
logger.debug("shell: tmpDir='$tmpDir'")
val process = Runtime.getRuntime().exec(cmdarray, emptyArray(), cmdDir)
val process = Runtime.getRuntime().exec(cmdarray, envArray, cmdDir)
val exitCode = process.waitFor()
val inputText = process.inputStream.bufferedReader().readText().trim()
val errorText = process.errorStream.bufferedReader().readText().trim()
Expand Down

0 comments on commit 07e8ea5

Please sign in to comment.