8000 Publishing to Maven repository (#15) · huyu-tom/simdjson-java@d506e94 · GitHub
[go: up one dir, main page]

Skip to content

Commit d506e94

Browse files
authored
Publishing to Maven repository (simdjson#15)
1 parent cd94004 commit d506e94

File tree

4 files changed

+155
-3
lines changed

4 files changed

+155
-3
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v3
11+
1112
- uses: gradle/wrapper-validation-action@v1
13+
1214
- name: Set up JDK 20
1315
uses: actions/setup-java@v3
1416
with:
1517
distribution: temurin
1618
java-version: 20
19+
1720
- name: Setup Gradle
1821
uses: gradle/gradle-build-action@v2
22+
1923
- name: Tests
2024
run: ./gradlew check

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
forceVersion:
7+
description: 'Force version'
8+
required: true
9+
default: ''
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- uses: gradle/wrapper-validation-action@v1
19+
20+
- name: Set up JDK 20
21+
uses: actions/setup-java@v3
22+
with:
23+
distribution: temurin
24+
java-version: 20
25+
26+
- name: Setup Gradle
27+
uses: gradle/gradle-build-action@v2
28+
29+
- name: Release
30+
if: github.ref == 'refs/heads/main'
31+
id: release
32+
run: |
33+
./gradlew release \
34+
-Prelease.customPassword=${{ github.token }} \
35+
-Prelease.customUsername=${{ github.actor }} \
36+
-Prelease.forceVersion=${{ github.event.inputs.forceVersion }}
37+
echo "released_version=`./gradlew -q cV -Prelease.quiet`" >> $GITHUB_OUTPUT
38+
39+
- name: Publish to Maven Central
40+
run: ./gradlew build publish
41+
env:
42+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
43+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
44+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
45+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
46+
GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}
47+
48+
- name: Create GitHub Release
49+
if: github.ref == 'refs/heads/main'
50+
run: gh release create "${{ steps.release.outputs.released_version }}" --generate-notes
51+
env:
52+
GH_TOKEN: ${{ github.token }}

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# simdjson-java
1+
simdjson-java
2+
=============
3+
![Build Status](https://github.com/simdjson/simdjson-java/actions/workflows/ci.yml/badge.svg)
4+
[![](https://maven-badges.herokuapp.com/maven-central/org.simdjson/simdjson-java/badge.svg)](https://central.sonatype.com/search?namespace=org.simdjson)
5+
[![](https://img.shields.io/badge/License-Apache%202-blue.svg)](LICENSE)
26

37
A Java version of [simdjson](https://github.com/simdjson/simdjson) - a JSON parser using SIMD instructions,
48
based on the paper [Parsing Gigabytes of JSON per Second](https://arxiv.org/abs/1902.08318)
@@ -16,7 +20,7 @@ This implementation is still missing several features available in simdsjon. For
1620
byte[] json = loadTwitterJson();
1721

1822
SimdJsonParser parser = new SimdJsonParser();
19-
JsonValue jsonValue = simdJsonParser.parse(json, json.length);
23+
JsonValue jsonValue = parser.parse(json, json.length);
2024
Iterator<JsonValue> tweets = jsonValue.get("statuses").arrayIterator();
2125
while (tweets.hasNext()) {
2226
JsonValue tweet = tweets.next();
@@ -27,6 +31,28 @@ while (tweets.hasNext()) {
2731
}
2832
```
2933

34+
## Installation
35+
36+
The library is available in the [Maven Central Repository](https://mvnrepository.com/artifact/org.simdjson/simdjson-java).
37+
To include it in your project, add the following dependency to the `build.gradle` file:
38+
```groovy
39+
implementation("org.simdjson:simdjson-java:0.1.0")
40+
```
41+
42+
or to the `pom.xml` file:
43+
```xml
44+
<dependency>
45+
<groupId>org.simdjson</groupId>
46+
<artifactId>simdjson-java</artifactId>
< A36C /td>
47+
<version>0.1.0</version>
48+
</dependency>
49+
```
50+
51+
Please remember about specifying the desired version.
52+
53+
Note that simdjson-java follows the [SemVer specification](https://semver.org/), which means, for example, that a major
54+
version of zero indicates initial development, so the library's API should not be considered stable.
55+
3056
## Benchmarks
3157

3258
To run the JMH benchmarks, execute the following command:

build.gradle

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
import me.champeau.jmh.JmhBytecodeGeneratorTask
22
import org.gradle.internal.os.OperatingSystem
33
import org.ajoberstar.grgit.Grgit
4+
import java.time.Duration
45

56
plugins {
67
id 'java'
78
id 'scala'
89
id 'me.champeau.jmh' version '0.7.1'
910
id 'org.ajoberstar.grgit' version '5.2.0'
11+
id 'pl.allegro.tech.build.axion-release' version '1.15.4'
12+
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
13+
id 'maven-publish'
14+
id 'signing'
1015
}
1116

1217
group = 'org.simdjson'
13-
version = '0.0.1-SNAPSHOT'
18+
version = scmVersion.version
19+
20+
scmVersion {
21+
versionCreator('versionWithBranch')
22+
}
1423

1524
repositories {
1625
mavenCentral()
@@ -20,6 +29,8 @@ java {
2029
toolchain {
2130
languageVersion = JavaLanguageVersion.of(20)
2231
}
32+
withJavadocJar()
33+
withSourcesJar()
2334
}
2435

2536
ext {
@@ -105,6 +116,65 @@ jmh {
105116
}
106117
}
107118

119+
publishing {
120+
publications {
121+
mavenJava(MavenPublication) {
122+
pom {
123+
name = project.name
124+
description = 'A Java version of simdjson, a high-performance JSON parser utilizing SIMD instructions.'
125+
url = 'https://github.com/simdjson/simdjson-java'
126+
issueManagement {
127+
system = 'GitHub Issue Tracking'
128+
url = 'https://github.com/simdjson/simdjson-java/issues'
129+
}
130+
licenses {
131+
license {
132+
name = 'The Apache License, Version 2.0'
133+
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
134+
}
135+
}
136+
developers {
137+
developer {
138+
id = 'piotrrzysko'
139+
name = 'Piotr Rżysko'
140+
email = 'piotr.rzysko@gmail.com'
141+
}
142+
}
143+
scm {
144+
url = 'https://github.com/simdjson/simdjson-java'
145+
connection = 'scm:git@github.com:simdjson/simdjson-java.git'
146+
developerConnection = 'scm:git@github.com:simdjson/simdjson-java.git'
147+
}
148+
}
149+
}
150+
}
151+
}
152+
153+
if (System.getenv('GPG_KEY_ID')) {
154+
signing {
155+
useInMemoryPgpKeys(
156+
System.getenv('GPG_KEY_ID'),
157+
System.getenv('GPG_PRIVATE_KEY'),
158+
System.getenv('GPG_PRIVATE_KEY_PASSWORD')
159+
)
160+
sign publishing.publications.mavenJava
161+
}
162+
}
163+
164+
nexusPublishing {
165+
repositories {
166+
sonatype {
167+
nexusUrl = uri('https://s01.oss.sonatype.org/service/local/')
168+
snapshotRepositoryUrl = uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')
169+
stagingProfileId = '3c0bbfe420699e'
170+
username = System.getenv('SONATYPE_USERNAME')
171+
password = System.getenv('SONATYPE_PASSWORD')
172+
}
173+
}
174+
connectTimeout = Duration.ofMinutes(3)
175+
clientTimeout = Duration.ofMinutes(3)
176+
}
177+
108178
def getBooleanProperty(String name, boolean defaultValue) {
109179
Boolean.valueOf((project.findProperty(name) ?: defaultValue) as String)
110180
}

0 commit comments

Comments
 (0)
0