From e7604238a482e51fc0e1fbdb7df392b629358019 Mon Sep 17 00:00:00 2001 From: Stefan Zeiger Date: Fri, 22 Nov 2024 00:24:34 +0100 Subject: [PATCH] Github Actions --- .github/workflows/build.yaml | 51 +++++++++++++++ build.sbt | 18 ++++-- .../perfio/AbstractLineTokenizerSpec.scala | 62 +++++++++---------- 3 files changed, 95 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..b9c21fb --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,51 @@ +name: PerfIO CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + java: [ '21', '23' ] + runs-on: ${{matrix.os}} + name: Test + steps: + - uses: actions/checkout@v4 + - name: Set up Java + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: 'sbt' + - name: Set up sbt + uses: sbt/setup-sbt@v1 + - name: Set up protobuf + run: | + env + mkdir ~/protobuf + if [[ "$RUNNER_OS" = "macOS" ]]; then + PB_URL=https://github.com/protocolbuffers/protobuf/releases/download/v29.0-rc3/protoc-29.0-rc-3-osx-aarch_64.zip + else + PB_URL=https://github.com/protocolbuffers/protobuf/releases/download/v29.0-rc3/protoc-29.0-rc-3-linux-x86_64.zip + fi + (cd ~/protobuf && curl -Lo pb.zip $PB_URL && unzip pb.zip) + - name: Run tests + run: | + if [[ "${{ matrix.java }}" = "21" ]]; then + export JAVA_OPTS=--enable-preview + fi + sbt test bootstrapProto proto/test diff --git a/build.sbt b/build.sbt index b804933..a93caff 100644 --- a/build.sbt +++ b/build.sbt @@ -9,21 +9,29 @@ Global / version := "0.1-SNAPSHOT" //cancelable in Global := false -val release = "22" +val javaVersion = sys.props("java.specification.version").toInt +val release = if(javaVersion >= 22) 22 else javaVersion val runtimeOpts = Seq( "--add-modules", "jdk.incubator.vector", "--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED", -) +) ++ (if(release >= 22) Nil else Seq( + "--enable-preview", +)) + val compileOpts = Seq( "--add-modules", "jdk.incubator.vector", - "--release", release, -) +) ++ (if(release >= 22) Seq( + "--release", release.toString, +) else Seq( + "--release", javaVersion.toString, + "--enable-preview", +)) javaOptions in Global ++= runtimeOpts javacOptions in Global ++= compileOpts -scalacOptions in Global ++= Seq("-java-output-version", release) +scalacOptions in Global ++= Seq("-java-output-version", release.toString) // javaOptions in Global += "-Djmh.blackhole.autoDetect=false" diff --git a/test/src/test/scala/perfio/AbstractLineTokenizerSpec.scala b/test/src/test/scala/perfio/AbstractLineTokenizerSpec.scala index 3a6123d..bc2f73d 100644 --- a/test/src/test/scala/perfio/AbstractLineTokenizerSpec.scala +++ b/test/src/test/scala/perfio/AbstractLineTokenizerSpec.scala @@ -82,11 +82,11 @@ abstract class SimpleLineTokenizerSpec[T] extends AbstractLineTokenizerSpec[T]: object HeapScalarLineTokenizerSpec extends SimpleLineTokenizerSpec[Int]: val base: List[(String, Int, Int, Int, Int)] = List( - ("small.aligned", 64, 64, 4096, 2000), - ("large.aligned", 128, 128, 64, 2000), - ("small.unligned", 0, 63, 4096, 2000), - ("large.unaligned", 65, 127, 64, 2000), - ("mixed", 0, 513, 128, 10000), + ("small.aligned", 64, 64, 4096, 200), + ("large.aligned", 128, 128, 64, 200), + ("small.unligned", 0, 63, 4096, 200), + ("large.unaligned", 65, 127, 64, 200), + ("mixed", 0, 513, 128, 1000), ) def createBI(s: String, cs: Charset, ib: Int): BufferedInput = @@ -96,19 +96,19 @@ object HeapScalarLineTokenizerSpec extends SimpleLineTokenizerSpec[Int]: object HeapVectorizedLineTokenizerSpec extends SimpleLineTokenizerSpec[(Int, Int)]: val base: List[(String, Int, Int, (Int, Int), Int)] = List( - ("small.aligned", 64, 64, (4096, Int.MaxValue), 2000), - ("large.aligned", 128, 128, (64, Int.MaxValue), 2000), - ("small.unaligned", 0, 63, (4096, Int.MaxValue), 2000), - ("large.unaligned", 65, 127, (64, Int.MaxValue), 2000), - ("small.aligned.limited1", 64, 64, (4096, 1), 2000), - ("large.aligned.limited1", 128, 128, (64, 1), 2000), - ("small.unaligned.limited1", 0, 63, (4096, 1), 2000), - ("large.unaligned.limited1", 65, 127, (64, 1), 2000), - ("small.aligned.limited16", 64, 64, (4096, 16), 2000), - ("large.aligned.limited16", 128, 128, (64, 16), 2000), - ("small.unaligned.limited16", 0, 63, (4096, 16), 2000), - ("large.unaligned.limited16", 65, 127, (64, 16), 2000), - ("mixed", 0, 513, (128, Int.MaxValue), 10000), + ("small.aligned", 64, 64, (4096, Int.MaxValue), 200), + ("large.aligned", 128, 128, (64, Int.MaxValue), 200), + ("small.unaligned", 0, 63, (4096, Int.MaxValue), 200), + ("large.unaligned", 65, 127, (64, Int.MaxValue), 200), + ("small.aligned.limited1", 64, 64, (4096, 1), 200), + ("large.aligned.limited1", 128, 128, (64, 1), 200), + ("small.unaligned.limited1", 0, 63, (4096, 1), 200), + ("large.unaligned.limited1", 65, 127, (64, 1), 200), + ("small.aligned.limited16", 64, 64, (4096, 16), 200), + ("large.aligned.limited16", 128, 128, (64, 16), 200), + ("small.unaligned.limited16", 0, 63, (4096, 16), 200), + ("large.unaligned.limited16", 65, 127, (64, 16), 200), + ("mixed", 0, 513, (128, Int.MaxValue), 1000), ) def createBI(s: String, cs: Charset, params: (Int, Int)): BufferedInput = @@ -119,14 +119,14 @@ object HeapVectorizedLineTokenizerSpec extends SimpleLineTokenizerSpec[(Int, Int abstract class FromArraySpec extends AbstractLineTokenizerSpec[(Int, Int)]: val base: List[(String, Int, Int, (Int, Int), Int)] = List( - ("small.aligned", 64, 64, (0, 0), 2000), - ("large.aligned", 128, 128, (0, 0), 2000), - ("small.unligned", 0, 63, (0, 0), 2000), - ("large.unaligned", 65, 127, (0, 0), 2000), - ("padRight", 0, 65, (0, 33), 2000), - ("padLeft", 0, 65, (33, 0), 2000), - ("padBoth", 0, 65, (33, 33), 2000), - ("mixed", 0, 513, (0, 0), 2000), + ("small.aligned", 64, 64, (0, 0), 200), + ("large.aligned", 128, 128, (0, 0), 200), + ("small.unligned", 0, 63, (0, 0), 200), + ("large.unaligned", 65, 127, (0, 0), 200), + ("padRight", 0, 65, (0, 33), 200), + ("padLeft", 0, 65, (33, 0), 200), + ("padBoth", 0, 65, (33, 33), 200), + ("mixed", 0, 513, (0, 0), 200), ) def createProp(min: Int, max: Int, cs: Charset, split: Boolean, params: (Int, Int)): Property = @@ -150,11 +150,11 @@ abstract class FromArraySpec extends AbstractLineTokenizerSpec[(Int, Int)]: abstract class ForeignSpec extends FromArraySpec: override val base: List[(String, Int, Int, (Int, Int), Int)] = List( - ("small.aligned", 64, 64, (0, 0), 2000), - ("large.aligned", 128, 128, (0, 0), 2000), - ("small.unligned", 0, 63, (0, 0), 2000), - ("large.unaligned", 65, 127, (0, 0), 2000), - ("mixed", 0, 513, (0, 0), 10000), + ("small.aligned", 64, 64, (0, 0), 200), + ("large.aligned", 128, 128, (0, 0), 200), + ("small.unligned", 0, 63, (0, 0), 200), + ("large.unaligned", 65, 127, (0, 0), 200), + ("mixed", 0, 513, (0, 0), 1000), )