Skip to content

Commit c7dfb8f

Browse files
authored
improve github action (#279)
* improve testing * fix maven-resources-plugin version to 3.3.1 * patch on github ations * patch versions * fix version * rollback versions * downgrade * add condition for github workflows * patch action * test patch action * edd exta test in action * add jacoco * patch coverage * patch coverage
1 parent 32967d5 commit c7dfb8f

File tree

9 files changed

+247
-7
lines changed

9 files changed

+247
-7
lines changed

.github/workflows/coverage.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [ master, upgrade ]
6+
paths:
7+
- 'accessors-smart/**'
8+
- 'json-smart/**'
9+
- '.github/workflows/coverage.yml'
10+
pull_request:
11+
branches: [ master ]
12+
paths:
13+
- 'accessors-smart/**'
14+
- 'json-smart/**'
15+
- '.github/workflows/coverage.yml'
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
coverage:
22+
name: Code Coverage
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up JDK 11
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: 11
33+
distribution: 'temurin'
34+
cache: 'maven'
35+
36+
- name: Build and test accessors-smart with coverage
37+
run: cd accessors-smart && ./mvnw -q clean install
38+
39+
- name: Build and test json-smart with coverage
40+
run: cd json-smart && ./mvnw -q clean test
41+
42+
- name: Upload accessors-smart coverage to Coveralls
43+
uses: coverallsapp/github-action@v2
44+
with:
45+
github-token: ${{ secrets.GITHUB_TOKEN }}
46+
file: accessors-smart/target/site/jacoco/jacoco.xml
47+
format: jacoco
48+
flag-name: accessors-smart
49+
parallel: true
50+
51+
- name: Upload json-smart coverage to Coveralls
52+
uses: coverallsapp/github-action@v2
53+
with:
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
file: json-smart/target/site/jacoco/jacoco.xml
56+
format: jacoco
57+
flag-name: json-smart
58+
parallel: true
59+
60+
- name: Finish parallel build
61+
uses: coverallsapp/github-action@v2
62+
with:
63+
github-token: ${{ secrets.GITHUB_TOKEN }}
64+
parallel-finished: true

.github/workflows/json-smart-formatting.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,23 @@ on:
44
push:
55
branches:
66
- master
7+
- upgrade
8+
paths:
9+
- 'accessors-smart/**'
10+
- 'json-smart/**'
11+
- 'json-smart-action/**'
12+
- '.github/workflows/json-smart-formatting.yml'
713
pull_request:
814
branches:
915
- master
16+
paths:
17+
- 'accessors-smart/**'
18+
- 'json-smart/**'
19+
- 'json-smart-action/**'
20+
- '.github/workflows/json-smart-formatting.yml'
21+
22+
permissions:
23+
contents: read
1024

1125
jobs:
1226
formatting:
@@ -21,6 +35,14 @@ jobs:
2135
distribution: 'temurin'
2236
cache: 'maven'
2337

38+
- name: Cache local Maven repository
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.m2/repository
42+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
43+
restore-keys: |
44+
${{ runner.os }}-maven-
45+
2446
- name: Check formatting accessors-smart
2547
run: cd accessors-smart; ./mvnw spotless:check
2648

.github/workflows/json-smart-unit-tests.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,30 @@ on:
55
branches:
66
- master
77
- update2024
8+
- upgrade
9+
paths:
10+
- 'accessors-smart/**'
11+
- 'json-smart/**'
12+
- 'json-smart-action/**'
13+
- '.github/workflows/json-smart-unit-tests.yml'
814
pull_request:
915
branches:
1016
- master
17+
paths:
18+
- 'accessors-smart/**'
19+
- 'json-smart/**'
20+
- 'json-smart-action/**'
21+
- '.github/workflows/json-smart-unit-tests.yml'
22+
23+
permissions:
24+
contents: read
1125

1226
jobs:
1327
publish:
1428
runs-on: ubuntu-latest
1529
strategy:
1630
matrix:
17-
java-version: [8, 11, 16, 17, 21]
31+
java-version: [8, 11, 17, 21, 22, 23]
1832
steps:
1933
- uses: actions/checkout@v4
2034

@@ -25,6 +39,14 @@ jobs:
2539
distribution: 'temurin'
2640
cache: 'maven'
2741

42+
- name: Cache local Maven repository
43+
uses: actions/cache@v4
44+
with:
45+
path: ~/.m2/repository
46+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
47+
restore-keys: |
48+
${{ runner.os }}-maven-
49+
2850
- name: Unit tests accessors-smart
2951
run: cd accessors-smart; ./mvnw -B install; ./mvnw -B clean test
3052

.github/workflows/security.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Security Scanning
2+
3+
on:
4+
push:
5+
branches: [ master, upgrade ]
6+
paths:
7+
- 'accessors-smart/**'
8+
- 'json-smart/**'
9+
- 'json-smart-action/**'
10+
- '.github/workflows/security.yml'
11+
pull_request:
12+
branches: [ master ]
13+
paths:
14+
- 'accessors-smart/**'
15+
- 'json-smart/**'
16+
- 'json-smart-action/**'
17+
- '.github/workflows/security.yml'
18+
schedule:
19+
- cron: '0 6 * * 1' # Weekly on Monday at 6am UTC
20+
21+
permissions:
22+
contents: read
23+
security-events: write
24+
actions: read
25+
26+
jobs:
27+
codeql:
28+
name: CodeQL Analysis
29+
runs-on: ubuntu-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
language: [ 'java' ]
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
39+
- name: Set up JDK 11
40+
uses: actions/setup-java@v4
41+
with:
42+
java-version: 11
43+
distribution: 'temurin'
44+
cache: 'maven'
45+
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@v3
48+
with:
49+
languages: ${{ matrix.language }}
50+
51+
- name: Build project accessors-smart
52+
run: cd accessors-smart && ./mvnw -q clean install
53+
54+
- name: Build project json-smart
55+
run: cd json-smart && ./mvnw -q clean install
56+
57+
- name: Build project json-smart-action
58+
run: cd json-smart-action && ./mvnw -q clean install
59+
60+
- name: Perform CodeQL Analysis
61+
uses: github/codeql-action/analyze@v3
62+
63+
dependency-check:
64+
name: Dependency Vulnerability Scan
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@v4
70+
71+
- name: Set up JDK 11
72+
uses: actions/setup-java@v4
73+
with:
74+
java-version: 11
75+
distribution: 'temurin'
76+
cache: 'maven'
77+
78+
- name: Run OWASP Dependency Check
79+
run: |
80+
cd accessors-smart && ./mvnw -q org.owasp:dependency-check-maven:check -DnvdApiKey=${{ secrets.NVD_API_KEY }}
81+
cd ../json-smart && ./mvnw -q org.owasp:dependency-check-maven:check -DnvdApiKey=${{ secrets.NVD_API_KEY }}
82+
cd ../json-smart-action && ./mvnw -q org.owasp:dependency-check-maven:check -DnvdApiKey=${{ secrets.NVD_API_KEY }}
83+
continue-on-error: true
84+
85+
- name: Upload dependency check results
86+
uses: actions/upload-artifact@v4
87+
if: always()
88+
with:
89+
name: dependency-check-reports
90+
path: '**/target/dependency-check-report.html'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
**/bin
1010
**/target
1111
**/.vscode/
12+
.env

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# json-smart-v2
2-
[![Build Status](https://travis-ci.org/netplex/json-smart-v2.svg?branch=master)](https://travis-ci.org/netplex/json-smart-v2)
2+
[![CI](https://github.com/netplex/json-smart-v2/actions/workflows/json-smart-unit-tests.yml/badge.svg)](https://github.com/netplex/json-smart-v2/actions/workflows/json-smart-unit-tests.yml)
3+
[![Security](https://github.com/netplex/json-smart-v2/actions/workflows/security.yml/badge.svg)](https://github.com/netplex/json-smart-v2/actions/workflows/security.yml)
34
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.minidev/json-smart/badge.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/net.minidev/json-smart/)
45
[![Coverage Status](https://coveralls.io/repos/github/netplex/json-smart-v2/badge.svg?branch=master)](https://coveralls.io/github/netplex/json-smart-v2?branch=master)
6+
[![Java 8+](https://img.shields.io/badge/Java-8%2B-blue.svg)](https://openjdk.java.net/)
57

68

79
Json-smart development started in 2010, when SQL servers did not support native JSON fields, NoSQL databases were slowly emerging, and all the existing JSON APIs were bogus. I wrote lots of tests to benchmark and compare JSON java parsers.

accessors-smart/pom.xml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ limitations under the License.
9292
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
9393
<groupId>org.apache.maven.plugins</groupId>
9494
<artifactId>maven-gpg-plugin</artifactId>
95-
<version>3.2.7</version>
95+
<version>3.2.8</version>
9696
<executions>
9797
<execution>
9898
<id>sign-artifacts</id>
@@ -178,7 +178,7 @@ limitations under the License.
178178
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
179179
<groupId>org.apache.maven.plugins</groupId>
180180
<artifactId>maven-compiler-plugin</artifactId>
181-
<version>3.13.0</version>
181+
<version>3.14.0</version>
182182
<configuration>
183183
<encoding>UTF-8</encoding>
184184
<source>${maven.compiler.source}</source>
@@ -204,7 +204,7 @@ limitations under the License.
204204
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
205205
<groupId>org.apache.maven.plugins</groupId>
206206
<artifactId>maven-javadoc-plugin</artifactId>
207-
<version>3.10.1</version>
207+
<version>3.11.2</version>
208208
<!-- ONLY NEEDED With jdk 1.7+ -->
209209
<configuration>
210210
<source>8</source>
@@ -243,7 +243,7 @@ limitations under the License.
243243
<plugin>
244244
<groupId>com.diffplug.spotless</groupId>
245245
<artifactId>spotless-maven-plugin</artifactId>
246-
<version>2.44.2</version>
246+
<version>2.46.1</version>
247247
<configuration>
248248
<java>
249249
<includes>
@@ -259,14 +259,33 @@ limitations under the License.
259259
</java>
260260
</configuration>
261261
</plugin>
262+
<plugin>
263+
<groupId>org.jacoco</groupId>
264+
<artifactId>jacoco-maven-plugin</artifactId>
265+
<version>0.8.13</version>
266+
<executions>
267+
<execution>
268+
<goals>
269+
<goal>prepare-agent</goal>
270+
</goals>
271+
</execution>
272+
<execution>
273+
<id>report</id>
274+
<phase>test</phase>
275+
<goals>
276+
<goal>report</goal>
277+
</goals>
278+
</execution>
279+
</executions>
280+
</plugin>
262281
</plugins>
263282
</build>
264283
<dependencies>
265284
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
266285
<dependency>
267286
<groupId>org.junit.jupiter</groupId>
268287
<artifactId>junit-jupiter-api</artifactId>
269-
<version>5.11.2</version>
288+
<version>5.13.4</version>
270289
<scope>test</scope>
271290
</dependency>
272291
<!-- https://mvnrepository.com/artifact/org.ow2.asm/asm -->

json-smart-action/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
</executions>
213213
</plugin>
214214
<plugin>
215+
<!-- https://mvnrepository.com/artifact/org.apache.felix/maven-bundle-plugin -->
215216
<groupId>org.apache.felix</groupId>
216217
<artifactId>maven-bundle-plugin</artifactId>
217218
<version>5.1.9</version>

json-smart/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,25 @@ limitations under the License.
270270
</java>
271271
</configuration>
272272
</plugin>
273+
<plugin>
274+
<groupId>org.jacoco</groupId>
275+
<artifactId>jacoco-maven-plugin</artifactId>
276+
<version>0.8.13</version>
277+
<executions>
278+
<execution>
279+
<goals>
280+
<goal>prepare-agent</goal>
281+
</goals>
282+
</execution>
283+
<execution>
284+
<id>report</id>
285+
<phase>test</phase>
286+
<goals>
287+
<goal>report</goal>
288+
</goals>
289+
</execution>
290+
</executions>
291+
</plugin>
273292
</plugins>
274293
</build>
275294
<dependencies>

0 commit comments

Comments
 (0)