Skip to content

Commit b5d1971

Browse files
author
Abhijit Sarkar
committed
Preparing for 2.0.0 release
1 parent f861bd7 commit b5d1971

38 files changed

+1021
-605
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
11
name: CI Pipeline
2-
on:
3-
push:
4-
branches:
5-
- master
6-
pull_request:
2+
on: [push, workflow_dispatch]
73

84
jobs:
95
Build:
106
runs-on: ubuntu-latest
117
steps:
12-
- uses: actions/checkout@v2
8+
- uses: actions/checkout@v4
139

1410
- name: Set up JDK
15-
uses: actions/setup-java@v2
11+
uses: actions/setup-java@v4
1612
with:
17-
distribution: 'zulu'
18-
java-version: 8
13+
distribution: "temurin"
14+
java-version-file: ".java-version"
1915

2016
- name: Build and test
21-
run: ./gradlew clean build -x ktlintCheck -x ktlintFormat
17+
run: ./gradlew clean test
2218
continue-on-error: true
2319

24-
- name: Test report
25-
uses: asadmansr/[email protected]
26-
2720
- name: Lint
28-
run: ./gradlew ktlintCheck ktlintFormat
21+
run: ./gradlew check -x test

.github/workflows/publish.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ jobs:
1111
Publish:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515

1616
- name: Inject slug/short variables
17-
uses: rlespinasse/github-slug-action@v3.x
17+
uses: rlespinasse/github-slug-action@v5
1818

1919
- name: Check CI status
20-
run: |
21-
output=$(curl -sSL -X GET -G -H "Accept: application/vnd.github.v3+json" -d "branch=${{ env.GITHUB_REF_SLUG }}" -d "event=push" https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ github.event.inputs.ci }}/runs | jq -r '.workflow_runs[0] | "\(.conclusion)"')
22-
echo "::set-output name=status::$output"
2320
id: check
21+
run: |
22+
output=$(curl -sSL -X GET -G -H "Accept: application/vnd.github.v3+json" -d "branch=${{ env.GITHUB_REF_NAME_SLUG }}" -d "event=push" https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ github.event.inputs.ci }}/runs | jq -r '.workflow_runs[0] | "\(.conclusion)"')
23+
echo "status=$output" >> "$GITHUB_OUTPUT"
2424
2525
- name: Abort if CI not successful
2626
if: steps.check.outputs.status != 'success'
@@ -29,15 +29,16 @@ jobs:
2929
exit 1
3030
3131
- name: Set up JDK
32-
uses: actions/setup-java@v2
32+
uses: actions/setup-java@v4
3333
with:
34-
distribution: 'zulu'
35-
java-version: 8
34+
distribution: "temurin"
35+
java-version-file: ".java-version"
3636

3737
- name: Publish to Maven Central
38+
env:
39+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
40+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSPHRASE }}
41+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
42+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
3843
run: |
39-
./gradlew -P signingKey=${{ secrets.SIGNING_KEY }} \
40-
-P signingPassword=${{ secrets.SIGNING_PASSWORD }} \
41-
-P sonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \
42-
-P sonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \
43-
publishToSonatype closeAndReleaseSonatypeStagingRepository
44+
./gradlew publishToMavenCentral --no-configuration-cache

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ bin/
1313
# IntelliJ
1414
.idea/
1515
*.iml
16+
.kotlin
1617

1718
# Maven
1819
target/
@@ -22,3 +23,6 @@ build/
2223
.gradle/
2324
userHome/
2425
out/
26+
27+
# GPG
28+
.gnupg

.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
17

README.md

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
# grpc-test
22

3-
Includes a JUnit
4-
5 [Extension](https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/extension/Extension.html)
3+
Includes a JUnit 5 [Extension](https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/extension/Extension.html)
54
that can automatically release gRPC resources at the end of the test.
65
Like [GrpcCleanupRule](https://grpc.github.io/grpc-java/javadoc/io/grpc/testing/GrpcCleanupRule.html), but built for
76
JUnit 5 and actively maintained.
87

9-
If you like it, consider becoming a
10-
[![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/asarkar).
11-
12-
[![](https://github.com/asarkar/grpc-test/workflows/CI%20Pipeline/badge.svg)](https://github.com/asarkar/grpc-test/actions?query=workflow%3A%22CI+Pipeline%22)
13-
14-
## Installation
15-
16-
You can find the latest version
17-
on [Maven Central](https://search.maven.org/search?q=g:com.asarkar.grpc%20AND%20a:grpc-test).
8+
[![Sponsor](https://img.shields.io/static/v1?style=for-the-badge&label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/asarkar)
9+
[![CI](<https://img.shields.io/github/actions/workflow/status/asarkar/grpc-test/ci.yml?branch=main&logo=GitHub&style=for-the-badge>)](https://github.com/asarkar/grpc-test/actions?query=workflow%3A%22CI+Pipeline%22)
10+
[![Maven](https://img.shields.io/maven-central/v/com.asarkar.grpc/grpc-test?style=for-the-badge&logo=apache-maven)](https://central.sonatype.com/artifact/com.asarkar.grpc/grpc-test?smo=true)
11+
[![Javadoc](https://javadoc.io/badge2/com.asarkar.grpc/grpc-test/javadoc.svg?style=for-the-badge)](https://javadoc.io/doc/com.asarkar.grpc/grpc-test)
12+
[![License](https://img.shields.io/github/license/asarkar/grpc-test?style=for-the-badge&logo=apache&color=blue)](https://www.apache.org/licenses/LICENSE-2.0)
13+
[![COC](https://img.shields.io/static/v1?style=for-the-badge&label=COC&message=Code+Of+Conduct&color=brightgreen)](https://github.com/asarkar/.github/blob/main/CODE_OF_CONDUCT.md)
1814

1915
## Usage
2016

@@ -50,18 +46,7 @@ extension will not reinitialize it.
5046

5147
:information_source: If you're writing `@Nested` tests, see [issues/8](https://github.com/asarkar/grpc-test/issues/8).
5248

53-
## Minimum Requirements
54-
- Java 8
55-
56-
## Contributing
49+
The test class in [client](client/src/test) project uses the `GrpcCleanupExtension` from Java code.
5750

58-
This project is a volunteer effort. You are welcome to send pull requests, ask questions, or create issues.
59-
60-
## Code of Conduct
61-
62-
This project adheres to the Contributor Covenant [code of conduct](https://github.com/asarkar/.github/blob/main/CODE_OF_CONDUCT.md).
63-
By participating, you are expected to uphold this code.
64-
65-
## License
66-
67-
Copyright 2022 Abhijit Sarkar - Released under [Apache License v2.0](LICENSE).
51+
## Minimum Requirements
52+
- See [.java-version](.java-version). See releases for previous versions supporting older Java versions.

build.gradle.kts

Lines changed: 0 additions & 148 deletions
This file was deleted.

client/build.gradle.kts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import com.github.spotbugs.snom.SpotBugsTask
2+
3+
plugins {
4+
`java-library`
5+
alias(libs.plugins.spotbugs)
6+
alias(libs.plugins.spotless)
7+
alias(libs.plugins.errorprone)
8+
9+
}
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
testImplementation(platform(libs.grpc.bom))
17+
testImplementation(platform(libs.junit.bom))
18+
testImplementation(platform(libs.mockito.bom))
19+
testImplementation("org.junit.jupiter:junit-jupiter")
20+
testImplementation("io.grpc:grpc-api")
21+
testImplementation("org.mockito:mockito-core")
22+
testImplementation(project(":lib"))
23+
testRuntimeOnly("io.grpc:grpc-core")
24+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
25+
errorprone(libs.errorprone)
26+
}
27+
28+
val javaVersion = JavaLanguageVersion.of(rootDir.resolve(".java-version").readText(Charsets.UTF_8).trim())
29+
30+
java {
31+
toolchain {
32+
languageVersion = javaVersion
33+
}
34+
}
35+
36+
spotbugs {
37+
toolVersion = libs.versions.spotbugs.get()
38+
}
39+
40+
spotless {
41+
java {
42+
palantirJavaFormat(libs.versions.palantirJavaFmt.get()).style("GOOGLE")
43+
toggleOffOn()
44+
}
45+
}
46+
47+
val ci: Boolean by lazy { listOf("CI").any { System.getenv(it) != null } }
48+
val spotlessTasks = arrayOf("spotlessApply", "spotlessCheck")
49+
val spotlessTask = spotlessTasks[true.compareTo(ci)] // true > false
50+
51+
tasks.named(spotlessTask) {
52+
enabled = false
53+
}
54+
55+
tasks.named("check") {
56+
dependsOn(spotlessTasks[0])
57+
}
58+
59+
tasks.withType<Test> {
60+
useJUnitPlatform()
61+
testLogging {
62+
showStandardStreams = true
63+
}
64+
// Suppress warning: Sharing is only supported for boot loader classes...
65+
// https://stackoverflow.com/q/54205486/839733
66+
jvmArgs("-Xshare:off")
67+
}
68+
69+
tasks.withType<SpotBugsTask> {
70+
reports.create("html") {
71+
required = !ci
72+
}
73+
}

0 commit comments

Comments
 (0)