diff --git a/.github/workflows/ci-hibernate-dialect-v5.yaml b/.github/workflows/ci-hibernate-dialect-v5.yaml index a71344a..c12dc33 100644 --- a/.github/workflows/ci-hibernate-dialect-v5.yaml +++ b/.github/workflows/ci-hibernate-dialect-v5.yaml @@ -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' @@ -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 diff --git a/.github/workflows/ci-hibernate-dialect.yaml b/.github/workflows/ci-hibernate-dialect.yaml index f5e52c4..4e4ae36 100644 --- a/.github/workflows/ci-hibernate-dialect.yaml +++ b/.github/workflows/ci-hibernate-dialect.yaml @@ -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' @@ -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 diff --git a/.github/workflows/ci-jooq-dialect.yaml b/.github/workflows/ci-jooq-dialect.yaml new file mode 100644 index 0000000..e0396c1 --- /dev/null +++ b/.github/workflows/ci-jooq-dialect.yaml @@ -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 diff --git a/.github/workflows/publish-hibernate-dialect-v5.yaml b/.github/workflows/publish-hibernate-dialect-v5.yaml index 5ce9255..58320e8 100644 --- a/.github/workflows/publish-hibernate-dialect-v5.yaml +++ b/.github/workflows/publish-hibernate-dialect-v5.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Extract hibernate dialect version run: | @@ -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' @@ -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' diff --git a/.github/workflows/publish-hibernate-dialect.yaml b/.github/workflows/publish-hibernate-dialect.yaml index 8d3b7fd..0b78151 100644 --- a/.github/workflows/publish-hibernate-dialect.yaml +++ b/.github/workflows/publish-hibernate-dialect.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Extract hibernate dialect version run: | @@ -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' @@ -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' diff --git a/.github/workflows/publish-jooq-dialect.yaml b/.github/workflows/publish-jooq-dialect.yaml new file mode 100644 index 0000000..60976f8 --- /dev/null +++ b/.github/workflows/publish-jooq-dialect.yaml @@ -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 }} diff --git a/README.md b/README.md index 7d0e7e2..f6c66c6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/jooq-dialect/README.md b/jooq-dialect/README.md new file mode 100644 index 0000000..06aec5d --- /dev/null +++ b/jooq-dialect/README.md @@ -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 diff --git a/jooq-support-module/pom.xml b/jooq-dialect/pom.xml similarity index 83% rename from jooq-support-module/pom.xml rename to jooq-dialect/pom.xml index 3576b46..f97c49c 100644 --- a/jooq-support-module/pom.xml +++ b/jooq-dialect/pom.xml @@ -4,14 +4,16 @@ tech.ydb.dialects jooq-ydb-dialect - 1.0.0-SNAPSHOT + 0.9.0 - YDB JOOQ Support module + YDB JOOQ Dialect module jar UTF-8 11 + 11 + 11 3.14.16 diff --git a/jooq-support-module/src/main/java/tech/ydb/jooq/YDBDatabase.java b/jooq-dialect/src/main/java/tech/ydb/jooq/YDBDatabase.java similarity index 100% rename from jooq-support-module/src/main/java/tech/ydb/jooq/YDBDatabase.java rename to jooq-dialect/src/main/java/tech/ydb/jooq/YDBDatabase.java