Skip to content

Commit aa43f75

Browse files
committed
migrate groupId to io.zenwave360 and refactor GH actions
1 parent 47ef981 commit aa43f75

File tree

7 files changed

+290
-106
lines changed

7 files changed

+290
-106
lines changed

.github/workflows/build.yml

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

.github/workflows/main.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Verify Main and Publish Coverage
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
# pull_request:
7+
# branches: [ '**' ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Set up the Java JDK
19+
uses: actions/setup-java@v2
20+
with:
21+
java-version: '17'
22+
distribution: 'adopt'
23+
24+
- name: Verify and Publish Coverage
25+
run: mvn verify
26+
27+
- name: Checkout badges branch to a badges directory nested inside first checkout
28+
uses: actions/checkout@v2
29+
with:
30+
ref: badges
31+
path: badges
32+
33+
- name: Generate JaCoCo Badge
34+
id: jacoco
35+
uses: cicirello/jacoco-badge-generator@v2
36+
with:
37+
badges-directory: badges
38+
generate-branches-badge: true
39+
generate-summary: true
40+
41+
- name: Log coverage percentage
42+
run: |
43+
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
44+
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
45+
46+
- name: Packs Jacoco Reports
47+
run: |
48+
rm -rf badges/jacoco
49+
mkdir -p badges/jacoco
50+
echo "GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,COMPLEXITY_MISSED,COMPLEXITY_COVERED,METHOD_MISSED,METHOD_COVERED" > badges/jacoco-report.csv
51+
find -name 'jacoco.csv' -exec sed '1d' {} \; >> badges/jacoco-report.csv
52+
tar -c `find -name jacoco.csv` `find -name jacoco.exec` `find -name jacoco.xml` | tar -C badges/jacoco -x
53+
54+
55+
- name: Commit and push the coverage badges and summary file
56+
if: ${{ github.event_name != 'pull_request' }}
57+
run: |
58+
echo $(ls -l)
59+
cd badges
60+
if [[ `git status --porcelain` ]]; then
61+
git config --global user.name 'github-agit pctions'
62+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
63+
git add *.svg *.json jacoco-report.csv jacoco/*
64+
git commit -m "coverage = ${{ steps.jacoco.outputs.coverage }} branches = ${{ steps.jacoco.outputs.branches }}" *.svg *.json jacoco-report.csv jacoco/*
65+
git push
66+
fi
67+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Create Maven Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
releaseVersion:
6+
description: "Release Version:"
7+
required: true
8+
developmentVersion:
9+
description: "Next Development Version:"
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Set up Java for publishing to Maven Central Repository
19+
uses: actions/setup-java@v2
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
24+
- name: Configure Git User
25+
run: |
26+
git config user.email ${{ github.actor }}@users.noreply.github.com
27+
git config user.name ${{ github.actor }}
28+
29+
- name: Prepare Release
30+
run: |
31+
mvn -B release:prepare -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }}
32+
mvn -B release:clean
33+
env:
34+
GITHUB_ACTOR: ${{ github.actor }}
35+
GITHUB_TOKEN: ${{ github.token }}
36+
37+
- name: Create Pull Request (Main)
38+
id: cpr
39+
uses: peter-evans/create-pull-request@v5
40+
with:
41+
commit-message: 'Release ${{ github.event.inputs.releaseVersion }}'
42+
branch: release/${{ github.event.inputs.releaseVersion }}
43+
title: 'Release ${{ github.event.inputs.releaseVersion }}'
44+
body: 'Release ${{ github.event.inputs.releaseVersion }}'
45+
labels: 'release'
46+
47+
- name: Enable Pull Request Automerge (Main)
48+
run: gh pr merge --merge --auto --delete-branch "${{ steps.cpr.outputs.pull-request-number }}"
49+
env:
50+
GH_TOKEN: ${{ github.token }}
51+
52+
- name: Push Release Tag
53+
run: git push --tags
Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,81 @@
1-
name: Publish package to the Maven Central Repository
1+
name: Publish to Maven Central
22
on:
33
release:
44
types: [created]
5+
workflow_dispatch:
6+
inputs:
7+
tag:
8+
description: 'Tag to check out'
9+
required: true
10+
default: 'main'
511
jobs:
612
publish:
713
runs-on: ubuntu-latest
814
steps:
915
- uses: actions/checkout@v2
10-
- name: Set up Maven Central Repository
16+
with:
17+
ref: ${{ github.event.inputs.tag || github.event.release.tag_name }}
18+
19+
- name: Set up Java for publishing to Maven Central Repository
1120
uses: actions/setup-java@v2
1221
with:
13-
java-version: '11'
14-
distribution: 'adopt'
15-
server-id: ossrh
22+
java-version: '17'
23+
distribution: 'temurin'
24+
server-id: central
1625
server-username: MAVEN_USERNAME
1726
server-password: MAVEN_PASSWORD
1827

19-
- name: Publish package
20-
run: mvn --batch-mode deploy
28+
# - name: Enforce Release Version
29+
# run: mvn enforcer:enforce@enforce-release-version
30+
31+
- name: Publish to the Maven Central Repository
32+
run: mvn --batch-mode deploy -DdeployAtEnd=true -Dmaven.javadoc.skip=false
2133
env:
22-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
23-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
34+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
35+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
2436
SIGN_KEY: ${{ secrets.SIGN_KEY }}
25-
# SIGN_KEY_ID: ${{ secrets.SIGN_KEY_ID }}
26-
SIGN_KEY_PASS: ${{ secrets.SIGN_KEY_PASS }}
37+
SIGN_KEY_PASS: ${{ secrets.SIGN_KEY_PASS }}
38+
39+
- name: Checkout badges branch to a badges directory nested inside first checkout
40+
uses: actions/checkout@v2
41+
with:
42+
ref: badges
43+
path: badges
44+
45+
- name: Generate JaCoCo Badge
46+
id: jacoco
47+
uses: cicirello/jacoco-badge-generator@v2
48+
with:
49+
badges-directory: badges
50+
generate-branches-badge: true
51+
generate-summary: true
52+
53+
- name: Log coverage percentage
54+
run: |
55+
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
56+
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
57+
58+
- name: Packs Jacoco Reports
59+
run: |
60+
rm -rf badges/jacoco
61+
mkdir -p badges/jacoco
62+
echo "GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,COMPLEXITY_MISSED,COMPLEXITY_COVERED,METHOD_MISSED,METHOD_COVERED" > badges/jacoco-report.csv
63+
find -name 'jacoco.csv' -exec sed '1d' {} \; >> badges/jacoco-report.csv
64+
tar -c `find -name jacoco.csv` `find -name jacoco.exec` `find -name jacoco.xml` | tar -C badges/jacoco -x
65+
66+
67+
- name: Commit and push the coverage badges and summary file
68+
if: ${{ github.event_name != 'pull_request' }}
69+
run: |
70+
echo $(ls -l)
71+
TAG_NAME=${{ github.event.release.tag_name || github.run_id }}
72+
cd badges
73+
if [[ `git status --porcelain` ]]; then
74+
git config --global user.name 'github-agit pctions'
75+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
76+
git add *.svg *.json jacoco-report.csv jacoco/*
77+
git commit -m "coverage = ${{ steps.jacoco.outputs.coverage }} branches = ${{ steps.jacoco.outputs.branches }}" *.svg *.json jacoco-report.csv jacoco/*
78+
git push
79+
git tag coverage_badges_${TAG_NAME}
80+
git push --tags
81+
fi
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build and Publish Maven Snapshots
2+
3+
on:
4+
push:
5+
branches: [ develop, next ]
6+
# pull_request:
7+
# branches: [ '**' ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Java for publishing to Maven Central Repository
19+
uses: actions/setup-java@v2
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
server-id: central
24+
server-username: MAVEN_USERNAME
25+
server-password: MAVEN_PASSWORD
26+
27+
- name: Enforce Snapshot Version
28+
run: mvn enforcer:enforce@enforce-snapshot-version
29+
30+
- name: Publish to the Maven Central Repository
31+
run: mvn --batch-mode deploy -DdeployAtEnd=true -Dmaven.javadoc.skip=false
32+
env:
33+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
34+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
35+
SIGN_KEY: ${{ secrets.SIGN_KEY }}
36+
SIGN_KEY_PASS: ${{ secrets.SIGN_KEY_PASS }}
37+
38+
- name: Generate JaCoCo Badge
39+
id: jacoco
40+
uses: cicirello/jacoco-badge-generator@v2
41+
with:
42+
badges-directory: badges
43+
generate-branches-badge: true
44+
generate-summary: true
45+
46+
- name: Log coverage percentage
47+
run: |
48+
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
49+
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
50+
51+
- name: Comment on PR with coverage percentages
52+
if: ${{ github.event_name == 'pull_request' }}
53+
run: |
54+
REPORT=$(<badges/zenwave-sdk-cli/coverage-summary.json)
55+
COVERAGE=$(jq -r '.coverage' <<< "$REPORT")%
56+
BRANCHES=$(jq -r '.branches' <<< "$REPORT")%
57+
NEWLINE=$'\n'
58+
BODY="## JaCoCo Test Coverage Summary Statistics (zenwave-sdk-cli)${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}"
59+
gh pr comment ${{github.event.pull_request.number}} -b "${BODY}"
60+
continue-on-error: true
61+
env:
62+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
63+

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
JSON Schema $Ref Parser for the JVM
22
=====================================
33

4-
[![Maven Central](https://img.shields.io/maven-central/v/io.github.zenwave360/json-schema-ref-parser-jvm.svg?label=Maven%20Central&logo=apachemaven)](https://search.maven.org/artifact/io.github.zenwave360/json-schema-ref-parser-jvm)
5-
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/ZenWave360/json-schema-ref-parser-jvm?logo=GitHub)](https://github.com/ZenWave360/json-schema-ref-parser-jvm/releases)
6-
[![build](https://github.com/ZenWave360/json-schema-ref-parser-jvm/workflows/build/badge.svg)](https://github.com/ZenWave360/json-schema-ref-parser-jvm/actions/workflows/build.yml)
4+
[![Maven Central](https://img.shields.io/maven-central/v/io.zenwave360/json-schema-ref-parser-jvm.svg?label=Maven%20Central&logo=apachemaven)](https://search.maven.org/artifact/io.github.zenwave360/json-schema-ref-parser-jvm)
5+
[![build](https://github.com/ZenWave360/json-schema-ref-parser-jvm/workflows/Build%20and%20Publish%20Maven%20Snapshots/badge.svg)](https://github.com/ZenWave360/json-schema-ref-parser-jvm/actions/workflows/publish-maven-snapshots.yml)
76
[![coverage](https://raw.githubusercontent.com/ZenWave360/json-schema-ref-parser-jvm/badges/jacoco.svg)](https://github.com/ZenWave360/json-schema-ref-parser-jvm/actions/workflows/build.yml)
87
[![branches coverage](https://raw.githubusercontent.com/ZenWave360/json-schema-ref-parser-jvm/badges/branches.svg)](https://github.com/ZenWave360/json-schema-ref-parser-jvm/actions/workflows/build.yml)
98
[![GitHub](https://img.shields.io/github/license/ZenWave360/json-schema-ref-parser-jvm)](https://github.com/ZenWave360/json-schema-ref-parser-jvm/blob/main/LICENSE)

0 commit comments

Comments
 (0)