Skip to content

Commit d0eee25

Browse files
Merge pull request #28 from cashfree/3.1.0-test
[ADD] test cases
2 parents 12b20ee + 13df434 commit d0eee25

File tree

7 files changed

+634
-3
lines changed

7 files changed

+634
-3
lines changed

.github/workflows/maven.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Trigger Tests on Pull Request.
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v2
20+
with:
21+
distribution: 'temurin'
22+
java-version: '11'
23+
24+
- name: Gradlew permission
25+
run: chmod +x gradlew
26+
27+
- name: Run Tests and Send code coverage report to coveralls.io
28+
run: CLIENT_ID=$PG_CLIENT_ID SECRET_KEY=$PG_CLIENT_SECRET && ./gradlew test jacocoTestReport coveralls
29+
env:
30+
PG_CLIENT_ID: ${{ secrets.XCLIENTIDSANDBOX }}
31+
PG_CLIENT_SECRET: ${{ secrets.XCLIENTSECRETSANDBOX }}
32+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
33+

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ target
2020
.gradle
2121
build
2222
api/
23-
src/main/java/com/cashfree/client/
24-
src/test/
23+
src/main/java/com/cashfree/client/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Cashfree PG Java SDK
2-
![GitHub](https://img.shields.io/github/license/cashfree/cashfree-pg-sdk-java) ![Discord](https://img.shields.io/discord/931125665669972018?label=discord) ![GitHub last commit (branch)](https://img.shields.io/github/last-commit/cashfree/cashfree-pg-sdk-java/main) ![GitHub release (with filter)](https://img.shields.io/github/v/release/cashfree/cashfree-pg-sdk-java?label=latest) ![GitHub forks](https://img.shields.io/github/forks/cashfree/cashfree-pg-sdk-java)
2+
![GitHub](https://img.shields.io/github/license/cashfree/cashfree-pg-sdk-java) ![Discord](https://img.shields.io/discord/931125665669972018?label=discord) ![GitHub last commit (branch)](https://img.shields.io/github/last-commit/cashfree/cashfree-pg-sdk-java/main) ![GitHub release (with filter)](https://img.shields.io/github/v/release/cashfree/cashfree-pg-sdk-java?label=latest) ![GitHub forks](https://img.shields.io/github/forks/cashfree/cashfree-pg-sdk-java) [![Coverage Status](https://coveralls.io/repos/github/cashfree/cashfree-pg-sdk-java/badge.svg?branch=main)](https://coveralls.io/github/cashfree/cashfree-pg-sdk-java?branch=main)
33

44
The Cashfree PG Java SDK offers a convenient solution to access [Cashfree PG APIs](https://docs.cashfree.com/reference/pg-new-apis-endpoint) from a server-side Java applications.
55

build.gradle

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ apply plugin: 'java'
44
apply plugin: 'com.diffplug.spotless'
55
apply plugin: 'maven-publish'
66
apply plugin: 'signing'
7+
apply plugin: 'jacoco'
8+
apply plugin: 'com.github.kt3k.coveralls'
79

810
group = 'com.cashfree.pg.java'
911
version = '3.1.4'
@@ -20,6 +22,7 @@ buildscript {
2022
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
2123
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0'
2224
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
25+
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.2'
2326
}
2427
}
2528
apply plugin: 'io.github.gradle-nexus.publish-plugin'
@@ -90,6 +93,8 @@ if(hasProperty('target') && target == 'android') {
9093
apply plugin: 'java'
9194
apply plugin: 'maven-publish'
9295
apply plugin: 'signing'
96+
apply plugin: 'jacoco'
97+
apply plugin: 'com.github.kt3k.coveralls'
9398

9499
sourceCompatibility = JavaVersion.VERSION_1_8
95100
targetCompatibility = JavaVersion.VERSION_1_8
@@ -179,6 +184,22 @@ if(hasProperty('target') && target == 'android') {
179184
main = System.getProperty('mainClass')
180185
classpath = sourceSets.main.runtimeClasspath
181186
}
187+
188+
jacocoTestReport {
189+
reports {
190+
xml.required = true // coveralls plugin depends on xml format report
191+
html.required = true
192+
}
193+
}
194+
195+
coveralls {
196+
jacocoReportPath 'build/reports/jacoco/test/jacocoTestReport.xml'
197+
}
198+
199+
jacoco {
200+
// test code instrumentation for Java 18
201+
toolVersion = '0.8.8'
202+
}
182203
}
183204

184205
ext {

gradlew

100644100755
File mode changed.

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,26 @@
237237
</java>
238238
</configuration>
239239
</plugin>
240+
<!-- Add JaCoCo Maven Plugin -->
241+
<plugin>
242+
<groupId>org.jacoco</groupId>
243+
<artifactId>jacoco-maven-plugin</artifactId>
244+
<version>0.8.7</version>
245+
<executions>
246+
<execution>
247+
<goals>
248+
<goal>prepare-agent</goal>
249+
</goals>
250+
</execution>
251+
<execution>
252+
<id>report</id>
253+
<phase>prepare-package</phase>
254+
<goals>
255+
<goal>report</goal>
256+
</goals>
257+
</execution>
258+
</executions>
259+
</plugin>
240260
</plugins>
241261
</build>
242262

0 commit comments

Comments
 (0)