diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0c54583..aa8349b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,23 @@ jobs: fetch-depth: 0 - name: Cache uses: gradle/gradle-build-action@v2.4.2 + - 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 diff --git a/build.gradle.kts b/build.gradle.kts index 2a3974e..4938d47 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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) diff --git a/src/main/kotlin/com/liftric/octopusdeploy/shell.kt b/src/main/kotlin/com/liftric/octopusdeploy/shell.kt index cadc9b3..b1dbe04 100644 --- a/src/main/kotlin/com/liftric/octopusdeploy/shell.kt +++ b/src/main/kotlin/com/liftric/octopusdeploy/shell.kt @@ -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()