Skip to content

Commit

Permalink
fix: Fix running flank workflows on Windows (#1250)
Browse files Browse the repository at this point in the history
* fix: Fix running flankScripts on Windows

* skip ios test runs on Windows

* fix WSL workflow by setting environment variables
  • Loading branch information
piotradamczyk5 authored Oct 19, 2020
1 parent ad1ed84 commit 49e8840
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
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

0 comments on commit 49e8840

Please sign in to comment.