Skip to content

Commit

Permalink
Ensure GraalVM Native Build Compatibility (#239)
Browse files Browse the repository at this point in the history
Motivation:
Ensure GraalVM Native Build Compatibility

Modifications:
Add Native build test

Result:
Ensured GraalVM Native Build Compatibility
Resolves #194
  • Loading branch information
jchrys authored Feb 19, 2024
1 parent 26aa227 commit 98741f2
Show file tree
Hide file tree
Showing 361 changed files with 319 additions and 145 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cd-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ jobs:
working-directory: ./prepare-workspace/
run: |
cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import
./mvnw -B -ntp -am clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://s01.oss.sonatype.org -DserverId=ossrh-staging -DaltStagingDirectory=/home/runner/local-staging -DskipRemoteStaging=true -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -Dgpg.keyname="${{ secrets.GPG_KEY_NAME }}"
./mvnw -B -ntp -am -pl r2dbc-mysql clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://s01.oss.sonatype.org -DserverId=ossrh-staging -DaltStagingDirectory=/home/runner/local-staging -DskipRemoteStaging=true -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -Dgpg.keyname="${{ secrets.GPG_KEY_NAME }}"
- name: Deploy Local Staged Artifacts
working-directory: ./prepare-workspace/
run: ./mvnw -B -ntp --file pom.xml org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -DnexusUrl=https://s01.oss.sonatype.org -DserverId=ossrh-staging -DaltStagingDirectory=/home/runner/local-staging -DskipStagingRepositoryClose=true
run: ./mvnw -B -ntp -pl r2dbc-mysql --file pom.xml org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -DnexusUrl=https://s01.oss.sonatype.org -DserverId=ossrh-staging -DaltStagingDirectory=/home/runner/local-staging -DskipStagingRepositoryClose=true


- name: Rollback Release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
}]
- name: Deploy Local Staging
run: ./mvnw -B -ntp clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/home/runner/local-staging -DskipRemoteStaging=true -DskipTests=true
run: ./mvnw -B -ntp -pl r2dbc-mysql clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/home/runner/local-staging -DskipRemoteStaging=true -DskipTests=true

- name: Deploy Local Staged Artifacts
run: ./mvnw -B --file pom.xml org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -DaltStagingDirectory=/home/runner/local-staging
run: ./mvnw -B -pl r2dbc-mysql --file pom.xml org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -DaltStagingDirectory=/home/runner/local-staging
53 changes: 53 additions & 0 deletions .github/workflows/ci-graalvm-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2024 asyncer.io proejcts
#
# Licensed 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: Native Image Build Test

on:
pull_request:
branches: [ "trunk", "0.9.x" ]

jobs:
graalvm-build-pr:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- name: Set up MySQL
env:
MYSQL_DATABASE: r2dbc
MYSQL_ROOT_PASSWORD: r2dbc-password!@
MYSQL_VERSION: 8.1
run: docker-compose -f ${{ github.workspace }}/containers/mysql-compose.yml up -d

- uses: graalvm/setup-graalvm@v1
with:
java-version: 21
distribution: 'graalvm'
native-image-job-reports: true
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Cache & Load Local Maven Repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-prepare-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-prepare-

- name: Build and run native image
run: |
echo "JAVA_HOME=$JAVA_HOME"
echo "./mvnw -Pgraalvm package"
./mvnw -Pgraalvm package
./test-native-image/target/test-native-image -Dtest.mysql.password=r2dbc-password!@
160 changes: 19 additions & 141 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.asyncer</groupId>
<artifactId>r2dbc-mysql</artifactId>
<artifactId>r2dbc-mysql-parent</artifactId>
<version>1.1.2-SNAPSHOT</version>
<packaging>jar</packaging>
<packaging>pom</packaging>

<name>Reactive Relational Database Connectivity - MySQL</name>
<url>https://github.com/asyncer-io/r2dbc-mysql</url>
<modules>
<module>r2dbc-mysql</module>
<module>test-native-image</module>
</modules>
<description>R2DBC MySQL Implementation</description>

<licenses>
Expand Down Expand Up @@ -63,6 +67,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven.surefire.skip>false</maven.surefire.skip>
<skipNativeImage>true</skipNativeImage>

<r2dbc-spi.version>1.0.0.RELEASE</r2dbc-spi.version>
<reactor.version>2022.0.9</reactor.version>
Expand All @@ -81,6 +86,7 @@
<zstd-jni.version>1.5.5-11</zstd-jni.version>
<java-annotations.version>24.1.0</java-annotations.version>
<bouncy-castle.version>1.77</bouncy-castle.version>
<graalvm.version>21.2.0</graalvm.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -128,140 +134,6 @@
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty</artifactId>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-spi</artifactId>
<version>${r2dbc-spi.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${jsr305.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>${zstd-jni.version}</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-spi-test</artifactId>
<version>${r2dbc-spi.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${mysql.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${hikari-cp.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring-framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -293,11 +165,6 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down Expand Up @@ -387,6 +254,17 @@
</build>

<profiles>
<profile>
<id>graalvm</id>
<activation>
<file>
<exists>${java.home}/bin/gu</exists>
</file>
</activation>
<properties>
<skipNativeImage>false</skipNativeImage>
</properties>
</profile>
<profile>
<id>jmh</id>
<dependencies>
Expand Down
Loading

0 comments on commit 98741f2

Please sign in to comment.