Skip to content

Commit 41a1127

Browse files
feat: ydb shaded lock (#143)
1 parent 4ab81ad commit 41a1127

File tree

12 files changed

+553
-0
lines changed

12 files changed

+553
-0
lines changed

.github/workflows/ci-shedlock.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: YDB ShedLock CI with Maven
2+
3+
on:
4+
push:
5+
paths:
6+
- 'shedlock-ydb/**'
7+
branches:
8+
- main
9+
pull_request:
10+
paths:
11+
- 'shedlock-ydb/**'
12+
13+
env:
14+
MAVEN_ARGS: --batch-mode --update-snapshots -Dstyle.color=always
15+
16+
jobs:
17+
build:
18+
name: YDB ShedLock Lock Provider
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
matrix:
23+
java: [ '17', '21' ]
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up JDK ${{matrix.java}}
29+
uses: actions/setup-java@v4
30+
with:
31+
java-version: ${{matrix.java}}
32+
distribution: 'temurin'
33+
cache: maven
34+
35+
- name: Extract YDB ShedLock Lock Provider version
36+
working-directory: ./shedlock-ydb
37+
run: |
38+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
39+
echo "SHEDLOCK_VERSION=$VERSION" >> "$GITHUB_ENV"
40+
41+
- name: Download ShedLock Lock Provider dependencies
42+
working-directory: ./shedlock-ydb
43+
run: mvn $MAVEN_ARGS dependency:go-offline
44+
45+
- name: Build ShedLock Lock Provider
46+
working-directory: ./shedlock-ydb
47+
run: mvn $MAVEN_ARGS clean test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Publish YDB ShedLock
2+
3+
on:
4+
push:
5+
tags:
6+
- 'shedlock-ydb/v[0-9]+.[0-9]+.[0-9]+'
7+
8+
env:
9+
MAVEN_ARGS: --batch-mode --no-transfer-progress -Dstyle.color=always
10+
11+
jobs:
12+
validate:
13+
name: Validate YDB ShedLock
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Extract shedlock ydb version
20+
run: |
21+
cd shedlock-ydb
22+
SHEDLOCK_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
23+
echo "SHEDLOCK_VERSION=$SHEDLOCK_VERSION" >> "$GITHUB_ENV"
24+
25+
- name: Fail workflow if version is snapshot
26+
if: endsWith(env.SHEDLOCK_VERSION, 'SNAPSHOT')
27+
uses: actions/github-script@v6
28+
with:
29+
script: core.setFailed('SNAPSHOT version cannot be published')
30+
31+
- name: Fail workflow if version is not equal to tag name
32+
if: format('shedlock-ydb/v{0}', env.SHEDLOCK_VERSION) != github.ref_name
33+
uses: actions/github-script@v6
34+
with:
35+
script: core.setFailed('Release name must be equal to project version')
36+
37+
- name: Set up JDK
38+
uses: actions/setup-java@v4
39+
with:
40+
java-version: 17
41+
distribution: 'temurin'
42+
cache: 'maven'
43+
44+
- name: Download dependencies
45+
run: |
46+
cd shedlock-ydb
47+
mvn $MAVEN_ARGS dependency:go-offline
48+
49+
- name: Build with Maven
50+
run: |
51+
cd shedlock-ydb
52+
mvn $MAVEN_ARGS package
53+
54+
publish:
55+
name: Publish YDB ShedLock
56+
runs-on: ubuntu-latest
57+
needs: validate
58+
59+
steps:
60+
- name: Install gpg secret key
61+
run: |
62+
# Install gpg secret key
63+
cat <(echo -e "${{ secrets.MAVEN_OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
64+
# Verify gpg secret key
65+
gpg --list-secret-keys --keyid-format LONG
66+
67+
- uses: actions/checkout@v4
68+
69+
- name: Set up Maven Central Repository
70+
uses: actions/setup-java@v4
71+
with:
72+
java-version: 17
73+
distribution: 'temurin'
74+
cache: 'maven'
75+
server-id: ossrh-s01
76+
server-username: MAVEN_USERNAME
77+
server-password: MAVEN_PASSWORD
78+
79+
- name: Publish package
80+
run: |
81+
cd shedlock-ydb
82+
mvn $MAVEN_ARGS -Possrh-s01 -Dgpg.passphrase=${{ secrets.MAVEN_OSSRH_GPG_PASSWORD }} clean deploy
83+
env:
84+
MAVEN_USERNAME: ${{ secrets.MAVEN_OSSRH_USERNAME }}
85+
MAVEN_PASSWORD: ${{ secrets.MAVEN_OSSRH_TOKEN }}

shedlock-ydb/pom.xml

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>tech.ydb.dialects</groupId>
8+
<artifactId>shedlock-ydb</artifactId>
9+
<version>0.1.0</version>
10+
11+
<packaging>jar</packaging>
12+
13+
<name>ShedLock Service YDB</name>
14+
<description>Lock Service YDB Spring Starter</description>
15+
<url>https://github.com/ydb-platform/ydb-java-dialects</url>
16+
17+
<developers>
18+
<developer>
19+
<name>Kirill Kurdyukov</name>
20+
<email>[email protected]</email>
21+
<organization>YDB</organization>
22+
<organizationUrl>https://ydb.tech/</organizationUrl>
23+
</developer>
24+
</developers>
25+
26+
<scm>
27+
<url>https://github.com/ydb-platform/ydb-java-dialects</url>
28+
<connection>scm:git:https://github.com/ydb-platform/ydb-java-dialects.git</connection>
29+
<developerConnection>scm:git:https://github.com/ydb-platform/ydb-java-dialects.git</developerConnection>
30+
</scm>
31+
32+
<properties>
33+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
34+
35+
<maven.compiler.release>17</maven.compiler.release>
36+
<maven.compiler.target>17</maven.compiler.target>
37+
<maven.compiler.source>17</maven.compiler.source>
38+
39+
<junit5.version>5.9.3</junit5.version>
40+
<log4j2.version>2.17.2</log4j2.version>
41+
<ydb.sdk.version>2.2.6</ydb.sdk.version>
42+
<ydb.jdbc.version>2.2.2</ydb.jdbc.version>
43+
<spring.boot.version>3.2.3</spring.boot.version>
44+
<shedlock-spring.version>5.15.0</shedlock-spring.version>
45+
</properties>
46+
47+
<licenses>
48+
<license>
49+
<name>Apache License, Version 2.0</name>
50+
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
51+
</license>
52+
</licenses>
53+
54+
<dependencyManagement>
55+
<dependencies>
56+
<dependency>
57+
<groupId>tech.ydb</groupId>
58+
<artifactId>ydb-sdk-bom</artifactId>
59+
<version>${ydb.sdk.version}</version>
60+
<type>pom</type>
61+
<scope>import</scope>
62+
</dependency>
63+
<dependency>
64+
<groupId>org.springframework.boot</groupId>
65+
<artifactId>spring-boot-dependencies</artifactId>
66+
<version>${spring.boot.version}</version>
67+
<scope>import</scope>
68+
<type>pom</type>
69+
</dependency>
70+
</dependencies>
71+
</dependencyManagement>
72+
73+
<dependencies>
74+
<dependency>
75+
<groupId>tech.ydb</groupId>
76+
<artifactId>ydb-sdk-coordination</artifactId>
77+
</dependency>
78+
<dependency>
79+
<groupId>net.javacrumbs.shedlock</groupId>
80+
<artifactId>shedlock-spring</artifactId>
81+
<version>${shedlock-spring.version}</version>
82+
<scope>provided</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>tech.ydb.jdbc</groupId>
86+
<artifactId>ydb-jdbc-driver</artifactId>
87+
<version>${ydb.jdbc.version}</version>
88+
<scope>provided</scope>
89+
</dependency>
90+
<dependency>
91+
<groupId>org.springframework.boot</groupId>
92+
<artifactId>spring-boot-autoconfigure</artifactId>
93+
<scope>provided</scope>
94+
</dependency>
95+
96+
<dependency>
97+
<groupId>org.springframework.boot</groupId>
98+
<artifactId>spring-boot-starter-test</artifactId>
99+
<scope>test</scope>
100+
</dependency>
101+
<dependency>
102+
<groupId>tech.ydb.test</groupId>
103+
<artifactId>ydb-junit5-support</artifactId>
104+
<scope>test</scope>
105+
</dependency>
106+
<dependency>
107+
<groupId>org.springframework.boot</groupId>
108+
<artifactId>spring-boot-starter-jdbc</artifactId>
109+
<scope>test</scope>
110+
</dependency>
111+
</dependencies>
112+
113+
<build>
114+
<plugins>
115+
<plugin>
116+
<groupId>org.apache.maven.plugins</groupId>
117+
<artifactId>maven-javadoc-plugin</artifactId>
118+
<version>3.5.0</version>
119+
<configuration>
120+
<source>17</source>
121+
</configuration>
122+
<executions>
123+
<execution>
124+
<id>attach-javadocs</id>
125+
<goals>
126+
<goal>jar</goal>
127+
</goals>
128+
</execution>
129+
</executions>
130+
</plugin>
131+
<plugin>
132+
<groupId>org.apache.maven.plugins</groupId>
133+
<artifactId>maven-source-plugin</artifactId>
134+
<version>3.2.1</version>
135+
<executions>
136+
<execution>
137+
<id>attach-sources</id>
138+
<goals>
139+
<goal>jar-no-fork</goal>
140+
</goals>
141+
</execution>
142+
</executions>
143+
</plugin>
144+
<plugin>
145+
<groupId>org.apache.maven.plugins</groupId>
146+
<artifactId>maven-surefire-plugin</artifactId>
147+
<version>3.1.0</version>
148+
<configuration>
149+
<environmentVariables>
150+
<TESTCONTAINERS_REUSE_ENABLE>true</TESTCONTAINERS_REUSE_ENABLE>
151+
</environmentVariables>
152+
</configuration>
153+
</plugin>
154+
</plugins>
155+
</build>
156+
157+
<profiles>
158+
<profile>
159+
<id>ossrh-s01</id>
160+
<activation>
161+
<activeByDefault>false</activeByDefault>
162+
</activation>
163+
164+
<build>
165+
<plugins>
166+
<plugin>
167+
<groupId>org.apache.maven.plugins</groupId>
168+
<artifactId>maven-gpg-plugin</artifactId>
169+
<version>3.1.0</version>
170+
<executions>
171+
<execution>
172+
<id>sign-artifacts</id>
173+
<phase>verify</phase>
174+
<goals>
175+
<goal>sign</goal>
176+
</goals>
177+
</execution>
178+
</executions>
179+
<configuration>
180+
<gpgArguments>
181+
<arg>--pinentry-mode</arg>
182+
<arg>loopback</arg>
183+
</gpgArguments>
184+
</configuration>
185+
</plugin>
186+
<plugin>
187+
<groupId>org.sonatype.plugins</groupId>
188+
<artifactId>nexus-staging-maven-plugin</artifactId>
189+
<version>1.6.13</version>
190+
<extensions>true</extensions>
191+
<configuration>
192+
<serverId>ossrh-s01</serverId>
193+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
194+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
195+
</configuration>
196+
</plugin>
197+
</plugins>
198+
</build>
199+
</profile>
200+
</profiles>
201+
</project>

0 commit comments

Comments
 (0)