From fa040411ca48c83022a491a1116f76188db447ef Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Sat, 19 Aug 2023 20:22:51 -0700 Subject: [PATCH] build with public runners (#23) * build with public runners * spotless * fix test * fix builds --- .github/workflows/build.yml | 14 +++++++------- .github/workflows/ssb-integration-tests.yml | 2 +- .github/workflows/test-windows.yml | 2 +- .../org/apache/tuweni/eth/EthJsonModule.java | 19 +++++++------------ .../jsonrpc/downloader/DownloaderTest.kt | 1 + 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65c1d310d..389db6c25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ on: jobs: assemble: timeout-minutes: 30 - runs-on: [ self-hosted, Linux ] + runs-on: ubuntu-latest container: image: tmio/tuweni-build:1.2 steps: @@ -62,7 +62,7 @@ jobs: key: ${{ runner.os }}-build-${{ github.sha }} test: timeout-minutes: 30 - runs-on: [ self-hosted, Linux ] + runs-on: ubuntu-latest needs: assemble container: image: tmio/tuweni-build:1.2 @@ -94,7 +94,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [Linux, Windows] + os: [ubuntu-latest, windows-latest] needs: assemble steps: - name: Download distsrc @@ -103,10 +103,10 @@ jobs: with: name: distsrc - name: Unzip source - if: ${{ matrix.os == 'Linux' }} + if: ${{ matrix.os == 'ubuntu-latest' }} run: unzip -q -o - tuweni-src-*.zip -d distunzipped - name: Unzip source - if: ${{ matrix.os == 'Windows' }} + if: ${{ matrix.os == 'windows-latest' }} run: Expand-Archive -Force -Path tuweni-src-*.zip -DestinationPath distunzipped - name: Rename folder run: mv distunzipped/tuweni-src-* distunzipped/tuweni @@ -124,7 +124,7 @@ jobs: run: cd distunzipped/tuweni && ./gradlew.bat assemble integration-tests: timeout-minutes: 30 - runs-on: [ self-hosted, Linux ] + runs-on: ubuntu-latest needs: assemble container: image: tmio/tuweni-build:1.2 @@ -155,7 +155,7 @@ jobs: referenceTests: timeout-minutes: 30 needs: assemble - runs-on: [ self-hosted, Linux ] + runs-on: ubuntu-latest container: image: tmio/tuweni-build:1.2 steps: diff --git a/.github/workflows/ssb-integration-tests.yml b/.github/workflows/ssb-integration-tests.yml index 14aa6d41e..351803ec8 100644 --- a/.github/workflows/ssb-integration-tests.yml +++ b/.github/workflows/ssb-integration-tests.yml @@ -32,7 +32,7 @@ on: jobs: integration-tests: timeout-minutes: 30 - runs-on: [self-hosted, Linux] + runs-on: ubuntu-latest services: ssb: image: tmio/ssb-server-docker:latest diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 1493cf19d..7ca238a39 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -27,7 +27,7 @@ on: jobs: test-windows: timeout-minutes: 30 - runs-on: [self-hosted, Windows] + runs-on: windows-latest if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push') }} steps: - uses: actions/checkout@v3 diff --git a/eth/src/main/java/org/apache/tuweni/eth/EthJsonModule.java b/eth/src/main/java/org/apache/tuweni/eth/EthJsonModule.java index 39cb27b7b..22f9a652b 100644 --- a/eth/src/main/java/org/apache/tuweni/eth/EthJsonModule.java +++ b/eth/src/main/java/org/apache/tuweni/eth/EthJsonModule.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import org.jetbrains.annotations.Nullable; public class EthJsonModule extends SimpleModule { @@ -216,20 +215,16 @@ static class TransactionDeserializer extends StdDeserializer { } @Override - public Transaction deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JacksonException { + public Transaction deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException, JacksonException { JsonTransaction jt = p.readValueAs(JsonTransaction.class); - SECP256K1.Signature signature = SECP256K1.Signature.create(jt.v.get(0), jt.r.toUnsignedBigInteger(), jt.s.toUnsignedBigInteger()); + SECP256K1.Signature signature = + SECP256K1.Signature.create( + jt.v.get(0), jt.r.toUnsignedBigInteger(), jt.s.toUnsignedBigInteger()); - return new Transaction(jt.nonce, - jt.gasPrice, - jt.gas, - jt.to, - jt.value, - jt.input, - jt.chainId, - signature); + return new Transaction( + jt.nonce, jt.gasPrice, jt.gas, jt.to, jt.value, jt.input, jt.chainId, signature); } - } static class UInt256Serializer extends StdSerializer { diff --git a/jsonrpc-downloader/src/test/kotlin/org/apache/tuweni/jsonrpc/downloader/DownloaderTest.kt b/jsonrpc-downloader/src/test/kotlin/org/apache/tuweni/jsonrpc/downloader/DownloaderTest.kt index 13c96036c..6e8564d1b 100644 --- a/jsonrpc-downloader/src/test/kotlin/org/apache/tuweni/jsonrpc/downloader/DownloaderTest.kt +++ b/jsonrpc-downloader/src/test/kotlin/org/apache/tuweni/jsonrpc/downloader/DownloaderTest.kt @@ -19,6 +19,7 @@ class DownloaderTest { start=10 end=20 url="example.com" + numberOfThreads=2 """.trimIndent(), ) val downloader = Downloader(vertx, config, Dispatchers.Default)