Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ydb shaded lock #143

Merged
merged 7 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/ci-shedlock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: YDB ShedLock CI with Maven

on:
push:
paths:
- 'shedlock-ydb/**'
branches:
- main
pull_request:
paths:
- 'shedlock-ydb/**'

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

jobs:
build:
name: YDB ShedLock Lock Provider
runs-on: ubuntu-latest

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

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 YDB ShedLock Lock Provider version
working-directory: ./shedlock-ydb
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "SHEDLOCK_VERSION=$VERSION" >> "$GITHUB_ENV"

- name: Download ShedLock Lock Provider dependencies
working-directory: ./shedlock-ydb
run: mvn $MAVEN_ARGS dependency:go-offline

- name: Build ShedLock Lock Provider
working-directory: ./shedlock-ydb
run: mvn $MAVEN_ARGS clean test
85 changes: 85 additions & 0 deletions .github/workflows/publish-shedlock-ydb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Publish YDB ShedLock

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

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

jobs:
validate:
name: Validate YDB ShedLock
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Extract shedlock ydb version
run: |
cd shedlock-ydb
SHEDLOCK_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "SHEDLOCK_VERSION=$SHEDLOCK_VERSION" >> "$GITHUB_ENV"

- name: Fail workflow if version is snapshot
if: endsWith(env.SHEDLOCK_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('shedlock-ydb/v{0}', env.SHEDLOCK_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 shedlock-ydb
mvn $MAVEN_ARGS dependency:go-offline

- name: Build with Maven
run: |
cd shedlock-ydb
mvn $MAVEN_ARGS package

publish:
name: Publish YDB ShedLock
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 shedlock-ydb
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 }}
2 changes: 1 addition & 1 deletion hibernate-dialect/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>tech.ydb.dialects</groupId>
<artifactId>hibernate-ydb-dialect</artifactId>
<version>0.9.4</version>
<version>0.9.5</version>

<packaging>jar</packaging>

Expand Down
201 changes: 201 additions & 0 deletions shedlock-ydb/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>tech.ydb.dialects</groupId>
<artifactId>shedlock-ydb</artifactId>
<version>0.1.0</version>

<packaging>jar</packaging>

<name>ShedLock Service YDB</name>
<description>Lock Service YDB Spring Starter</description>
<url>https://github.com/ydb-platform/ydb-java-dialects</url>

<developers>
<developer>
<name>Kirill Kurdyukov</name>
<email>[email protected]</email>
<organization>YDB</organization>
<organizationUrl>https://ydb.tech/</organizationUrl>
</developer>
</developers>

<scm>
<url>https://github.com/ydb-platform/ydb-java-dialects</url>
<connection>scm:git:https://github.com/ydb-platform/ydb-java-dialects.git</connection>
<developerConnection>scm:git:https://github.com/ydb-platform/ydb-java-dialects.git</developerConnection>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>

<junit5.version>5.9.3</junit5.version>
<log4j2.version>2.17.2</log4j2.version>
<ydb.sdk.version>2.2.6</ydb.sdk.version>
<ydb.jdbc.version>2.2.2</ydb.jdbc.version>
<spring.boot.version>3.2.3</spring.boot.version>
<shedlock-spring.version>5.15.0</shedlock-spring.version>
</properties>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
</license>
</licenses>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>tech.ydb</groupId>
<artifactId>ydb-sdk-bom</artifactId>
<version>${ydb.sdk.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>tech.ydb</groupId>
<artifactId>ydb-sdk-coordination</artifactId>
</dependency>
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-spring</artifactId>
<version>${shedlock-spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>tech.ydb.jdbc</groupId>
<artifactId>ydb-jdbc-driver</artifactId>
<version>${ydb.jdbc.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>tech.ydb.test</groupId>
<artifactId>ydb-junit5-support</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<source>17</source>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<environmentVariables>
<TESTCONTAINERS_REUSE_ENABLE>true</TESTCONTAINERS_REUSE_ENABLE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>ossrh-s01</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh-s01</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading