From 71c3bf2d6d995cd1ba8f402faa4b3593d0031fe6 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 | 41 ++++++++++++++++++++++++++++++++++++ .jvmopts | 1 + build.sbt | 13 ++++++++---- 3 files changed, 51 insertions(+), 4 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..09a35dd --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,41 @@ +name: PerfIO CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + build: + strategy: + 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 + (cd ~/protobuf && curl -Lo pb.zip https://github.com/protocolbuffers/protobuf/releases/download/v29.0-rc3/protoc-29.0-rc-3-linux-x86_64.zip && unzip pb.zip) + - name: Run tests + run: sbt test bootstrapProto proto/test diff --git a/.jvmopts b/.jvmopts index 35ecb2e..e4b7821 100644 --- a/.jvmopts +++ b/.jvmopts @@ -1,3 +1,4 @@ --add-modules jdk.incubator.vector --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED +--enable-preview diff --git a/build.sbt b/build.sbt index b804933..8d5339a 100644 --- a/build.sbt +++ b/build.sbt @@ -9,7 +9,8 @@ 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", @@ -18,12 +19,16 @@ val runtimeOpts = Seq( ) 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"