From 4c182ab5f544849c0c71651a9ea1b9879e6632c0 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 13 Nov 2020 21:44:26 -0800 Subject: [PATCH 1/2] Add test build on Windows --- .github/workflows/test.yml | 26 +++++++++++++++++++++++++- build.bat | 4 +++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2be561061..19aad5122 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,4 +52,28 @@ jobs: - name: Upload to Codecov uses: codecov/codecov-action@v1 with: - flags: unit \ No newline at end of file + flags: unit + test-windows: + runs-on: windows-latest + needs: test + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Cache Gradle packages + uses: actions/cache@v1 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Cache Maven Repository + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/dependency-versions.gradle') }} + restore-keys: ${{ runner.os }}-m2 + - name: gradle test + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: 6.3 + arguments: test \ No newline at end of file diff --git a/build.bat b/build.bat index 6787120f0..3b5359ea9 100755 --- a/build.bat +++ b/build.bat @@ -12,5 +12,7 @@ REM specific language governing permissions and limitations under the License. @echo on bitsadmin /transfer myDownloadJob https://services.gradle.org/distributions/gradle-6.5.1-bin.zip d:\gradle.zip unzip d:\gradle.zip -d gradle_download +set "task=%1" +if "%task%"=="" set "myvar=assemble" call gradle_download/gradle-6.5.1/bin/gradle.bat setup -call gradlew.bat assemble +call gradlew.bat %task% From d41f02364a4c2af795bccdbf419841be35d8e2f7 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 13 Nov 2020 21:45:10 -0800 Subject: [PATCH 2/2] ignore folder created by tests --- .github/workflows/test-windows.yml | 53 +++++++++++++++++++ .github/workflows/test.yml | 26 +-------- .gitignore | 1 + build.bat | 4 +- .../ethclient/EthereumClientConfigTest.kt | 10 ++-- .../tuweni/toml/MutableTomlArrayTest.java | 11 +++- 6 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/test-windows.yml diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml new file mode 100644 index 000000000..89581c2ec --- /dev/null +++ b/.github/workflows/test-windows.yml @@ -0,0 +1,53 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: test-windows + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: true + - name: Cache Gradle packages + uses: actions/cache@v1 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Cache Maven Repository + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/dependency-versions.gradle') }} + restore-keys: ${{ runner.os }}-m2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: gradle test + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: 6.3 + arguments: test \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19aad5122..2be561061 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,28 +52,4 @@ jobs: - name: Upload to Codecov uses: codecov/codecov-action@v1 with: - flags: unit - test-windows: - runs-on: windows-latest - needs: test - steps: - - uses: actions/checkout@v1 - with: - submodules: true - - name: Cache Gradle packages - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - name: Cache Maven Repository - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/dependency-versions.gradle') }} - restore-keys: ${{ runner.os }}-m2 - - name: gradle test - uses: eskatos/gradle-command-action@v1 - with: - gradle-version: 6.3 - arguments: test \ No newline at end of file + flags: unit \ No newline at end of file diff --git a/.gitignore b/.gitignore index 77dde573a..61493ae21 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ eth-client/data2 data ssb-keys docs_warning +io/org \ No newline at end of file diff --git a/build.bat b/build.bat index 3b5359ea9..6787120f0 100755 --- a/build.bat +++ b/build.bat @@ -12,7 +12,5 @@ REM specific language governing permissions and limitations under the License. @echo on bitsadmin /transfer myDownloadJob https://services.gradle.org/distributions/gradle-6.5.1-bin.zip d:\gradle.zip unzip d:\gradle.zip -d gradle_download -set "task=%1" -if "%task%"=="" set "myvar=assemble" call gradle_download/gradle-6.5.1/bin/gradle.bat setup -call gradlew.bat %task% +call gradlew.bat assemble diff --git a/eth-client/src/test/kotlin/org/apache/tuweni/ethclient/EthereumClientConfigTest.kt b/eth-client/src/test/kotlin/org/apache/tuweni/ethclient/EthereumClientConfigTest.kt index 8c496c770..e77eb35b6 100644 --- a/eth-client/src/test/kotlin/org/apache/tuweni/ethclient/EthereumClientConfigTest.kt +++ b/eth-client/src/test/kotlin/org/apache/tuweni/ethclient/EthereumClientConfigTest.kt @@ -20,15 +20,14 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -import java.lang.IllegalArgumentException import java.nio.file.Paths class EthereumClientConfigTest { @Test fun testFileConfig() { - val config = - EthereumClientConfig.fromFile(Paths.get(EthereumClientConfigTest::class.java.getResource("/minimal.conf").path)) + val config = EthereumClientConfig.fromFile( + Paths.get(EthereumClientConfigTest::class.java.getResource("/minimal.conf").toURI())) assertNotNull(config) } @@ -83,7 +82,10 @@ class EthereumClientConfigTest { @Test fun toToml() { val config = EthereumClientConfig.fromString("[storage.forui]\npath=\"data\"") - assertEquals("[storage.forui]\npath = \"data\"\n", config.toToml()) + assertEquals( + "[storage.forui]${System.lineSeparator()}path = \"data\"${System.lineSeparator()}", + config.toToml() + ) } @Test diff --git a/toml/src/test/java/org/apache/tuweni/toml/MutableTomlArrayTest.java b/toml/src/test/java/org/apache/tuweni/toml/MutableTomlArrayTest.java index b3a88453c..1ae87d599 100644 --- a/toml/src/test/java/org/apache/tuweni/toml/MutableTomlArrayTest.java +++ b/toml/src/test/java/org/apache/tuweni/toml/MutableTomlArrayTest.java @@ -143,6 +143,15 @@ void shouldGetLocalTime() { @Test void toJson() { MutableTomlArray array = new MutableTomlArray().append("foo", positionAt(1, 1)).append("bar", positionAt(10, 1)); - assertEquals("[\n \"foo\",\n \"bar\"\n]\n", array.toJson()); + assertEquals( + "[" + + System.lineSeparator() + + " \"foo\"," + + System.lineSeparator() + + " \"bar\"" + + System.lineSeparator() + + "]" + + System.lineSeparator(), + array.toJson()); } }