Skip to content

Commit

Permalink
Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
szeiger committed Nov 21, 2024
1 parent d122ad4 commit e760423
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 36 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 13 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
62 changes: 31 additions & 31 deletions test/src/test/scala/perfio/AbstractLineTokenizerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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 =
Expand All @@ -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 =
Expand All @@ -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),
)


Expand Down

0 comments on commit e760423

Please sign in to comment.