Skip to content

Commit 1195075

Browse files
authored
Merge pull request #28 from GoodforGod/dev
[2.1.0]
2 parents 0e1dccc + 3a252b4 commit 1195075

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+638
-204
lines changed

.github/workflows/publish-release.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI Master
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
publish-release:
9+
runs-on: ubuntu-latest
10+
name: Publish Release
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up JDK
15+
uses: actions/setup-java@v3
16+
with:
17+
java-version: '17'
18+
distribution: 'adopt'
19+
20+
- name: Build
21+
run: './gradlew classes'
22+
23+
- name: Test
24+
run: './gradlew test jacocoTestReport'
25+
env:
26+
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}
27+
28+
- name: SonarQube
29+
run: './gradlew sonar --info'
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
33+
34+
- name: Publish Release to GitHub Packages
35+
run: './gradlew publishMavenJavaPublicationToGitHubPackagesRepository'
36+
env:
37+
RELEASE_VERSION: ${{ github.ref_name }}
38+
GITHUB_TOKEN: ${{ secrets.OSS_GITHUB_TOKEN }}
39+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSS_SIGNING_KEY }}
40+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSS_SIGNING_PASSWORD }}
41+
42+
- name: Publish Release to OSSRH
43+
run: './gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository'
44+
env:
45+
RELEASE_VERSION: ${{ github.ref_name }}
46+
OSS_USERNAME: ${{ secrets.OSS_USERNAME }}
47+
OSS_PASSWORD: ${{ secrets.OSS_PASSWORD }}
48+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSS_SIGNING_KEY }}
49+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSS_SIGNING_PASSWORD }}
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI Dev
2+
3+
on:
4+
push:
5+
paths:
6+
- '**/workflows/*.yml'
7+
- '**/java/**'
8+
- '*.java'
9+
- '*.gradle'
10+
- '*.properties'
11+
branches:
12+
- dev
13+
14+
jobs:
15+
publish-snapshot:
16+
runs-on: ubuntu-latest
17+
name: Publish Snapshot
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Set up JDK
22+
uses: actions/setup-java@v3
23+
with:
24+
java-version: '17'
25+
distribution: 'adopt'
26+
27+
- name: Code Style
28+
run: './gradlew spotlessCheck'
29+
30+
- name: Build
31+
run: './gradlew classes'
32+
33+
- name: Test
34+
run: './gradlew test jacocoTestReport'
35+
env:
36+
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}
37+
38+
- name: Publish Snapshot
39+
run: './gradlew publish'
40+
env:
41+
OSS_USERNAME: ${{ secrets.OSS_USERNAME }}
42+
OSS_PASSWORD: ${{ secrets.OSS_PASSWORD }}
43+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSS_SIGNING_KEY }}
44+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSS_SIGNING_PASSWORD }}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
name: Java CI
1+
name: CI Pull Request
22

33
on:
4-
push:
5-
branches:
6-
- master
74
pull_request:
85
branches:
96
- master
@@ -15,37 +12,44 @@ jobs:
1512
strategy:
1613
matrix:
1714
java: [ '11', '17' ]
18-
name: Java ${{ matrix.java }} setup
15+
name: Java ${{ matrix.java }} Pull Request setup
1916

2017
steps:
21-
- uses: actions/checkout@v1
18+
- uses: actions/checkout@v3
2219
- name: Set up JDK
23-
uses: actions/setup-java@v1
24-
20+
uses: actions/setup-java@v3
2521
with:
2622
java-version: ${{ matrix.java }}
23+
distribution: 'adopt'
2724

28-
- name: Build
29-
run: ./gradlew classes
25+
- name: Code Style
26+
run: './gradlew spotlessCheck'
3027

31-
- name: Codestyle
32-
run: ./gradlew spotlessCheck
28+
- name: Build
29+
run: './gradlew classes'
3330

3431
- name: Test
3532
if: matrix.java == '11'
36-
run: ./gradlew test jacocoTestReport
33+
run: './gradlew test jacocoTestReport'
3734
env:
3835
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_1 }}
3936

4037
- name: Test
4138
if: matrix.java == '17'
42-
run: ./gradlew test jacocoTestReport
39+
run: './gradlew test jacocoTestReport'
4340
env:
4441
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}
4542

43+
- name: Test Report
44+
if: matrix.java == '17'
45+
uses: EnricoMi/publish-unit-test-result-action@v2
46+
with:
47+
files: |
48+
**/test-results/**/*.xml
49+
4650
- name: SonarQube
4751
if: matrix.java == '17'
48-
run: ./gradlew sonarqube
52+
run: './gradlew sonar --info'
4953
env:
5054
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5155
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

CONTRIBUTING.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributing Code or Documentation Guide
2+
3+
## Running Tests
4+
5+
The new code should contain tests that check new behavior.
6+
7+
Run tests `./gradlew test` to check that code works as behavior.
8+
9+
## Code Style
10+
11+
The code base should remain clean, following industry best practices for organization, javadoc and style, as much as possible.
12+
13+
To run the Code Style check use `./gradlew spotlessCheck`.
14+
15+
If check found any errors, you can apply Code Style by running `./gradlew spotlessApply`
16+
17+
## Creating a pull request
18+
19+
Once you are satisfied with your changes:
20+
21+
- Commit changes to the local branch you created.
22+
- Push that branch with changes to the corresponding remote branch on GitHub
23+
- Submit a [pull request](https://help.github.com/articles/creating-a-pull-request) to `dev` branch.

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Java EtherScan API
22

33
[![Minimum required Java version](https://img.shields.io/badge/Java-1.8%2B-blue?logo=openjdk)](https://openjdk.org/projects/jdk8/)
4-
[![GitHub Action](https://github.com/goodforgod/java-etherscan-api/workflows/Java%20CI/badge.svg)](https://github.com/GoodforGod/java-etherscan-api/actions?query=workflow%3A%22Java+CI%22)
4+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.goodforgod/java-etherscan-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.goodforgod/java-etherscan-api)
5+
[![Java CI](https://github.com/GoodforGod/java-etherscan-api/workflows/CI%20Master/badge.svg)](https://github.com/GoodforGod/java-etherscan-api/actions?query=workflow%3ACI+Master)
56
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=coverage)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)
67
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)
78
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=ncloc)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)
@@ -14,15 +15,15 @@ Library supports EtherScan *API* for all available *Ethereum Networks* for *ethe
1415

1516
**Gradle**
1617
```groovy
17-
implementation "com.github.goodforgod:java-etherscan-api:2.0.0"
18+
implementation "com.github.goodforgod:java-etherscan-api:2.1.0"
1819
```
1920

2021
**Maven**
2122
```xml
2223
<dependency>
2324
<groupId>com.github.goodforgod</groupId>
2425
<artifactId>java-etherscan-api</artifactId>
25-
<version>2.0.0</version>
26+
<version>2.1.0</version>
2627
</dependency>
2728
```
2829

_config.yml

-1
This file was deleted.

build.gradle

+40-8
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ plugins {
33
id "java-library"
44
id "maven-publish"
55

6-
id "org.sonarqube" version "3.3"
7-
id "com.diffplug.spotless" version "6.12.0"
6+
id "org.sonarqube" version "4.3.0.3225"
7+
id "com.diffplug.spotless" version "6.19.0"
8+
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
89
}
910

1011
repositories {
@@ -13,7 +14,8 @@ repositories {
1314
}
1415

1516
group = groupId
16-
version = artifactVersion
17+
var ver = System.getenv().getOrDefault("RELEASE_VERSION", artifactVersion)
18+
version = ver.startsWith("v") ? ver.substring(1) : ver
1719

1820
sourceCompatibility = JavaVersion.VERSION_1_8
1921
targetCompatibility = JavaVersion.VERSION_1_8
@@ -28,6 +30,7 @@ dependencies {
2830
}
2931

3032
test {
33+
failFast(false)
3134
useJUnitPlatform()
3235
testLogging {
3336
events("passed", "skipped", "failed")
@@ -36,17 +39,21 @@ test {
3639
}
3740

3841
reports {
39-
html.enabled(false)
40-
junitXml.enabled(false)
42+
html.required = false
43+
junitXml.required = true
4144
}
45+
46+
environment([
47+
"": "",
48+
])
4249
}
4350

4451
spotless {
4552
java {
4653
encoding("UTF-8")
4754
importOrder()
4855
removeUnusedImports()
49-
eclipse("4.21.0").configFile("${rootDir}/config/codestyle.xml")
56+
eclipse("4.21").configFile("${rootDir}/config/codestyle.xml")
5057
}
5158
}
5259

@@ -58,6 +65,18 @@ sonarqube {
5865
}
5966
}
6067

68+
nexusPublishing {
69+
packageGroup = groupId
70+
repositories {
71+
sonatype {
72+
username = System.getenv("OSS_USERNAME")
73+
password = System.getenv("OSS_PASSWORD")
74+
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
75+
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
76+
}
77+
}
78+
}
79+
6180
publishing {
6281
publications {
6382
mavenJava(MavenPublication) {
@@ -99,6 +118,16 @@ publishing {
99118
password System.getenv("OSS_PASSWORD")
100119
}
101120
}
121+
if (!version.endsWith("SNAPSHOT")) {
122+
maven {
123+
name = "GitHubPackages"
124+
url = "https://maven.pkg.github.com/GoodforGod/$artifactId"
125+
credentials {
126+
username = System.getenv("GITHUB_ACTOR")
127+
password = System.getenv("GITHUB_TOKEN")
128+
}
129+
}
130+
}
102131
}
103132
}
104133

@@ -116,7 +145,7 @@ tasks.withType(JavaCompile) {
116145
check.dependsOn jacocoTestReport
117146
jacocoTestReport {
118147
reports {
119-
xml.enabled true
148+
xml.required = true
120149
html.destination file("${buildDir}/jacocoHtml")
121150
}
122151
}
@@ -128,9 +157,12 @@ javadoc {
128157
}
129158
}
130159

131-
if (project.hasProperty("signing.keyId")) {
160+
if (project.hasProperty("signingKey")) {
132161
apply plugin: "signing"
133162
signing {
163+
def signingKey = findProperty("signingKey")
164+
def signingPassword = findProperty("signingPassword")
165+
useInMemoryPgpKeys(signingKey, signingPassword)
134166
sign publishing.publications.mavenJava
135167
}
136168
}

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
groupId=com.github.goodforgod
22
artifactId=java-etherscan-api
3-
artifactVersion=2.0.0
3+
artifactVersion=2.1.0-SNAPSHOT
44

55

66
##### GRADLE #####

gradle/wrapper/gradle-wrapper.jar

1.99 KB
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)