From 6c3593570156d37137694e0c0a1b7fd4dfad5511 Mon Sep 17 00:00:00 2001 From: Raphael Vullriede Date: Wed, 7 Jun 2023 13:51:35 +0200 Subject: [PATCH] align with other projects --- .github/dependabot.yml | 11 +++ .github/workflows/maven-publish-release.yml | 30 +++++++ .github/workflows/maven.yml | 23 ++++++ .gitignore | 64 ++++++++++----- README.md | 12 +-- pom.xml | 80 +++++++++++++++---- .../net/osslabz/lnd/LnApiClientExample.java | 2 +- 7 files changed, 177 insertions(+), 45 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/maven-publish-release.yml create mode 100644 .github/workflows/maven.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..76e22be --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "maven" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/.github/workflows/maven-publish-release.yml b/.github/workflows/maven-publish-release.yml new file mode 100644 index 0000000..c9fe461 --- /dev/null +++ b/.github/workflows/maven-publish-release.yml @@ -0,0 +1,30 @@ +name: Publish release package to the Maven Central Repository +on: + release: + types: [ created ] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Install gpg secret key + run: | + # Install gpg secret key + cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import + # Verify gpg secret key + gpg --list-secret-keys --keyid-format LONG + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: maven + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + - name: Publish package + run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -P osslabz-release clean deploy + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..34f4391 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,23 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +name: Java CI with Maven + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn --batch-mode --update-snapshots package \ No newline at end of file diff --git a/.gitignore b/.gitignore index 86c1504..d5413b0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,32 +11,28 @@ buildNumber.properties # https://github.com/takari/maven-wrapper#usage-without-binary-jar .mvn/wrapper/maven-wrapper.jar +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +### NetBeans template +**/nbproject/private/ +**/nbproject/Makefile-*.mk +**/nbproject/Package-*.bash +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + ### JetBrains template # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries +.idea # Gradle and Maven with auto-import # When using Gradle or Maven with auto-import, you should exclude module files, @@ -72,6 +68,9 @@ atlassian-ide-plugin.xml # Cursive Clojure plugin .idea/replstate.xml +# SonarLint plugin +.idea/sonarlint/ + # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties @@ -146,4 +145,25 @@ local.properties # Typically, this file would be tracked if it contains build/dependency configurations: #.project -.idea/ \ No newline at end of file +### Gradle template +.gradle +**/build/ +!src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties + +# Cache of project +.gradletasknamecache + +# Eclipse Gradle plugin generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath \ No newline at end of file diff --git a/README.md b/README.md index 80f4dcf..2133a7c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # lnd-rest-client -![GitHub](https://img.shields.io/github/license/osslabz/lnd-http-client) -![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/osslabz/lnd-http-client/maven.yml?branch=main) -[![Maven Central](https://img.shields.io/maven-central/v/net.osslabz/lnd-http-client?label=Maven%20Central)](https://search.maven.org/artifact/net.osslabz/lnd-http-client) +![GitHub](https://img.shields.io/github/license/osslabz/lnd-rest-client) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/osslabz/lnd-rest-client/maven.yml?branch=main) +[![Maven Central](https://img.shields.io/maven-central/v/net.osslabz/lnd-rest-client?label=Maven%20Central)](https://search.maven.org/artifact/net.osslabz/lnd-rest-client) lnd-http-client is a simple client to interact with [Lightning Network Daemon (LND)](https://github.com/lightningnetwork/lnd) via it's REST API. Thanks to the [API's excellent documentation](https://lightning.engineering/api-docs/api/lnd/) the client is simply generated based on it's swagger @@ -12,9 +12,9 @@ If you prefer LND's gRPC API please have a look at [LighntingJ](https://www.ligh ## Why this client? -This library mostly exists because when I needed such a library lighninj was't (yet) supported on Apple Silicon.... +This library mostly exists because when I needed such a library [LighntingJ](https://www.lightningj.org/). wasn't (yet) supported on Apple Silicon.... -Other advantages are +Other advantages are: - it's very easy to review (which you should always do when you handle any valuable assets, crypto or otherwise) - it supports good old HTTP/1.1 while gRPC is build on http/2. In a perfect world we would all have migrated to http/2 already but there might be @@ -31,7 +31,7 @@ Other advantages are net.osslabz lnd-rest-client - 0.0.1 + 0.0.2 ``` diff --git a/pom.xml b/pom.xml index 56a17f3..12ad712 100755 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -7,9 +7,15 @@ lnd-rest-client 1.0.1-SNAPSHOT + ${project.groupId}:${project.artifactId} + This package decouples my bitcoin related libraries from the underlying implementation although it seems unlikely this will ever + change ;-) + + https://github.com/osslabz/bitcoin-commons + UTF-8 - 11 + 17 ${osslabz.encoding} ${osslabz.encoding} @@ -20,13 +26,13 @@ 2023-03-27T00:00:00Z - 4.9.3 + 4.10.0 The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt + https://www.apache.org/licenses/LICENSE-2.0.txt @@ -40,9 +46,9 @@ - scm:git:ssh://git@github.com/osslabz/lnd-http-client.git - scm:git:ssh://git@github.com/osslabz/lnd-http-client.git - https://github.com/osslabz/lnd-http-client + scm:git:ssh://git@github.com/osslabz/lnd-rest-client.git + scm:git:ssh://git@github.com/osslabz/lnd-rest-client.git + https://github.com/osslabz/lnd-rest-client main @@ -59,9 +65,9 @@ - javax.annotation - javax.annotation-api - 1.3.2 + jakarta.annotation + jakarta.annotation-api + 2.1.1 @@ -90,7 +96,7 @@ commons-io commons-io - 2.11.0 + 2.12.0 commons-codec @@ -105,12 +111,20 @@ 2.0.7 + + + org.junit.jupiter + junit-jupiter + 5.9.3 + test + + ch.qos.logback logback-classic - 1.4.6 + 1.4.7 test @@ -124,7 +138,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.0 attach-sources @@ -154,7 +168,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.1.0 sign-artifacts @@ -186,7 +200,7 @@ org.openapitools openapi-generator-maven-plugin - 5.3.1 + 5.4.0 generate-sources-lnd-http-api-lightning @@ -203,6 +217,7 @@ net.osslabz.lnd.api java8 + true ${project.build.directory}/generated-sources/openapi true @@ -226,6 +241,7 @@ net.osslabz.lnd.api java8 + true ${project.build.directory}/generated-sources/openapi true @@ -262,7 +278,39 @@ + + io.github.floverfelt + find-and-replace-maven-plugin + 1.1.0 + + + exec + process-sources + + find-and-replace + + + + file-contents + target/generated-sources + javax.annotation + jakarta.annotation + true + .java + + + + - + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + \ No newline at end of file diff --git a/src/main/java/net/osslabz/lnd/LnApiClientExample.java b/src/main/java/net/osslabz/lnd/LnApiClientExample.java index 98988a8..e1ce661 100644 --- a/src/main/java/net/osslabz/lnd/LnApiClientExample.java +++ b/src/main/java/net/osslabz/lnd/LnApiClientExample.java @@ -23,7 +23,7 @@ public static void main(String[] args) throws Exception { LndApiClient lndApiClient = new LndApiClient(lndHost, lndPort, lndCertPath, lndMacaroonPath, true); LnrpcNetworkInfo lnrpcNetworkInfo = lndApiClient.getLightningApi().getNetworkInfo(); - + log.debug("network info: {}", lnrpcNetworkInfo); } } \ No newline at end of file