Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix running flank workflows on Windows #1250

Merged
merged 3 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/wsl-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ jobs:
sudo apt-get -y install openjdk-8-jdk

- name: Gradle clean build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_REF: ${{ github.ref }}
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
export HEAD_REF=${{ github.ref }}
./gradlew clean build

- name: Prepare Google Service Account
Expand Down
8 changes: 8 additions & 0 deletions flank-scripts/bash/buildFlankScripts.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Rem REPLACE with #1246
SET DIR=%~dp0

SET FLANK_SCRIPTS=%DIR%\..
SET GRADLE_EXECUTABLE_PATH=%FLANK_SCRIPTS%\..

%GRADLE_EXECUTABLE_PATH%\gradlew.bat flank-scripts:clean flank-scripts:assemble flank-scripts:shadowJar
copy %FLANK_SCRIPTS%\build\libs\flankScripts.jar %DIR%\flankScripts.jar
2 changes: 1 addition & 1 deletion flank-scripts/bash/buildFlankScripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ DIR=`dirname "$BASH_SOURCE"`

FLANK_SCRIPTS="$DIR/.."

"$FLANK_SCRIPTS/../gradlew" flank-scripts:clean flank-scripts:assemble flank-scripts:shadowJar
"$FLANK_SCRIPTS/../gradlew" :flank-scripts:clean :flank-scripts:assemble :flank-scripts:shadowJar
cp "$FLANK_SCRIPTS"/build/libs/flankScripts.jar "$DIR/flankScripts.jar"
4 changes: 4 additions & 0 deletions flank-scripts/bash/flankScripts.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SET DIR=%~dp0
SET scriptsJar=%DIR%\flankScripts.jar

java -jar "%scriptsJar%" %*
23 changes: 14 additions & 9 deletions test_runner/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import com.jfrog.bintray.gradle.BintrayExtension
import groovy.util.Node
import groovy.util.NodeList
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream
import java.util.*
import java.nio.file.Paths

plugins {
application
Expand Down Expand Up @@ -318,17 +320,17 @@ tasks.create("applyProguard", proguard.gradle.ProGuardTask::class.java) {
val generateCliAsciiDoc by tasks.registering(JavaExec::class) {
dependsOn(tasks.classes)
classpath(
configurations.compile,
configurations.annotationProcessor,
sourceSets["main"].runtimeClasspath
configurations.compile,
configurations.annotationProcessor,
sourceSets["main"].runtimeClasspath
)
group = "Documentation"
description = "Generate AsciiDoc manpage"
main = "picocli.codegen.docgen.manpage.ManPageGenerator"
args = listOf(
application.mainClass.get(),
"--outdir=${project.rootDir}/docs/ascii/",
"-v"
application.mainClass.get(),
"--outdir=${project.rootDir}/docs/ascii/",
"-v"
)
}

Expand Down Expand Up @@ -383,10 +385,13 @@ val resolveArtifacts by tasks.registering {
dependsOn(":flank-scripts:prepareJar")
group = "verification"
doLast {
val flankScriptsPath = rootDir.resolve("flank-scripts/bash/flankScripts").absolutePath
println(flankScriptsPath)
val flankScriptsRunnerName = if(DefaultNativePlatform.getCurrentOperatingSystem().isWindows)
"flankScripts.bat" else "flankScripts"
val flankScriptsPath = Paths.get("flank-scripts", "bash", flankScriptsRunnerName).toString()
val rootFlankScriptsPath = rootDir.resolve(flankScriptsPath).absolutePath
println(rootFlankScriptsPath)
exec {
commandLine(flankScriptsPath, "testArtifacts", "-p", rootDir.absolutePath, "resolve")
commandLine(rootFlankScriptsPath, "testArtifacts", "-p", rootDir.absolutePath, "resolve")
workingDir = rootDir
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ class IosRunCommandTest {

@Test
fun `should dump shards on ios test run`() {
assumeFalse(isWindows) // TODO remove in #1180

mockkStatic("ftl.run.DumpShardsKt")
val runCmd = IosRunCommand()
runCmd.configPath = "./src/test/kotlin/ftl/fixtures/simple-ios-flank.yml"
Expand All @@ -356,6 +358,8 @@ class IosRunCommandTest {

@Test
fun `should dump shards on ios test run and not upload when disable-upload-results set`() {
assumeFalse(isWindows) // TODO remove in #1180

mockkStatic("ftl.run.DumpShardsKt")
mockkObject(GcStorage) {
val runCmd = IosRunCommand()
Expand Down