Skip to content

Commit

Permalink
JOOQ dialects module and actions (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex268 authored Feb 13, 2024
2 parents 8422c2e + f03e640 commit c7a918e
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-hibernate-dialect-v5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
java: [ '8', '11', '17' ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'temurin'
Expand All @@ -50,7 +50,7 @@ jobs:
working-directory: ./hibernate-dialect-v5
run: mvn $MAVEN_ARGS install

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ydb-platform/ydb-java-examples
ref: master
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-hibernate-dialect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
java: [ '17' ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'temurin'
Expand All @@ -50,7 +50,7 @@ jobs:
working-directory: ./hibernate-dialect
run: mvn $MAVEN_ARGS install

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ydb-platform/ydb-java-examples
ref: master
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/ci-jooq-dialect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: YDB JOOQ Dialect CI with Maven

on:
push:
paths:
- 'jooq-dialect/**'
branches:
- main
pull_request:
paths:
- 'jooq-dialect/**'
types:
- opened
- reopened
- edited

env:
MAVEN_ARGS: --batch-mode --update-snapshots -Dstyle.color=always

jobs:
build:
name: YDB Java JOOQ Dialect
runs-on: ubuntu-latest

strategy:
matrix:
java: [ '11', '17' ]

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'temurin'
cache: maven

- name: Extract JOOQ Dialect version
working-directory: ./jooq-dialect
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "JOOQ_DIALECT_VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Download JOOQ Dialect dependencies
working-directory: ./jooq-dialect
run: mvn $MAVEN_ARGS dependency:go-offline

- name: Build JOOQ Dialect
working-directory: ./jooq-dialect
run: mvn $MAVEN_ARGS install

# - uses: actions/checkout@v4
# with:
# repository: ydb-platform/ydb-java-examples
# ref: master
# path: examples
#
# - name: Download dependencies
# working-directory: ./examples/jdbc/spring-data-jpa
# run: mvn $MAVEN_ARGS -Dhibernate.ydb.dialect.version=$HIBERNATE_DIALECT_VERSION dependency:go-offline
#
# - name: Test examples with Maven
# working-directory: ./examples/jdbc/spring-data-jpa
# run: mvn $MAVEN_ARGS -Dhibernate.ydb.dialect.version=$HIBERNATE_DIALECT_VERSION test
8 changes: 4 additions & 4 deletions .github/workflows/publish-hibernate-dialect-v5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Extract hibernate dialect version
run: |
Expand All @@ -35,7 +35,7 @@ jobs:
script: core.setFailed('Release name must be equal to project version')

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
Expand Down Expand Up @@ -64,10 +64,10 @@ jobs:
# Verify gpg secret key
gpg --list-secret-keys --keyid-format LONG
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Maven Central Repository
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-hibernate-dialect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Extract hibernate dialect version
run: |
Expand All @@ -35,7 +35,7 @@ jobs:
script: core.setFailed('Release name must be equal to project version')

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
Expand Down Expand Up @@ -64,10 +64,10 @@ jobs:
# Verify gpg secret key
gpg --list-secret-keys --keyid-format LONG
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Maven Central Repository
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/publish-jooq-dialect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Publish YDB JOOQ Dialect

on:
push:
tags:
- 'jooq-ydb/v[0-9]+.[0-9]+.[0-9]+'

env:
MAVEN_ARGS: --batch-mode --no-transfer-progress -Dstyle.color=always

jobs:
validate:
name: Validate YDB JOOQ Dialect
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Extract JOOQ dialect version
run: |
cd jooq-dialect
JOOQ_DIALECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "JOOQ_DIALECT_VERSION=$JOOQ_DIALECT_VERSION" >> "$GITHUB_ENV"
- name: Fail workflow if version is snapshot
if: endsWith(env.JOOQ_DIALECT_VERSION, 'SNAPSHOT')
uses: actions/github-script@v6
with:
script: core.setFailed('SNAPSHOT version cannot be published')

- name: Fail workflow if version is not equal to tag name
if: format('jooq-ydb/v{0}', env.JOOQ_DIALECT_VERSION) != github.ref_name
uses: actions/github-script@v6
with:
script: core.setFailed('Release name must be equal to project version')

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'

- name: Download dependencies
run: |
cd jooq-dialect
mvn $MAVEN_ARGS dependency:go-offline
- name: Build with Maven
run: |
cd jooq-dialect
mvn $MAVEN_ARGS package
publish:
name: Publish YDB JOOQ Dialect
runs-on: ubuntu-latest
needs: validate

steps:
- name: Install gpg secret key
run: |
# Install gpg secret key
cat <(echo -e "${{ secrets.MAVEN_OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
# Verify gpg secret key
gpg --list-secret-keys --keyid-format LONG
- uses: actions/checkout@v4

- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
server-id: ossrh-s01
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Publish package
run: |
cd jooq-dialect
mvn $MAVEN_ARGS -Possrh-s01 -Dgpg.passphrase=${{ secrets.MAVEN_OSSRH_GPG_PASSWORD }} clean deploy
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_OSSRH_TOKEN }}
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@ libraries such as Hibernate, Spring Data and JOOQ.
## Supports ORM Frameworks

- *Hibernate 5*:
Hibernate Dialect for YDB, for earlier versions (5.*).
Designed to use YDB features while providing a
familiar experience for Hibernate users.
Hibernate Dialect for YDB, for earlier versions (5.*).
Designed to use YDB features while providing a
familiar experience for Hibernate users.
For more information, please visit the appropriate [module](./hibernate-dialect-v5).
- *Hibernate 6+*:
Hibernate Dialect for YDB is designed to leverage features of YDB while
providing a familiar experience to Hibernate users.
For more information, please visit the appropriate [module](./hibernate-dialect).
- *JOOQ*:
Small JOOQ dialect is designed to be used for [code generation](https://www.jooq.org/doc/3.19/manual/code-generation/)
For more information, please visit the appropriate [module](./jooq-dialect).

Each module is developed independently,
and the release process is separate from the others.
Each module is developed independently,
and the release process is separate from the others.

Each module has its own README.md file,
which describes the integration process and various limitations,
Each module has its own README.md file,
which describes the integration process and various limitations,
as well as CHANGELOG.md, which describes the releases.

## Contributing
Expand Down
5 changes: 5 additions & 0 deletions jooq-dialect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-java-dialects/blob/main/LICENSE.md)
[![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Ftech%2Fydb%2Fdialects%2Fhibernate-ydb-dialect-v5%2Fmaven-metadata.xml)](https://mvnrepository.com/artifact/tech.ydb.dialects/jooq-ydb-dialect)
[![CI](https://img.shields.io/github/actions/workflow/status/ydb-platform/ydb-java-dialects/ci-jooq-dialect.yaml?branch=main&label=CI)](https://github.com/ydb-platform/ydb-java-dialects/actions/workflows/ci-jooq-dialect.yaml)

# YDB JOOQ Dialect
6 changes: 4 additions & 2 deletions jooq-support-module/pom.xml → jooq-dialect/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

<groupId>tech.ydb.dialects</groupId>
<artifactId>jooq-ydb-dialect</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.9.0</version>

<name>YDB JOOQ Support module</name>
<name>YDB JOOQ Dialect module</name>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>

<!--Last opensource JOOQ version for JDK 11-->
<jooq.version>3.14.16</jooq.version>
Expand Down

0 comments on commit c7a918e

Please sign in to comment.