10000 :tada: doc: showing Java 21 CI badge · soujava/pom-editor-maven-plugin@d924659 · GitHub
[go: up one dir, main page]

Skip to content

🎉 doc: showing Java 21 CI badge #116

🎉 doc: showing Java 21 CI badge

🎉 doc: showing Java 21 CI badge #116

Workflow file for this run

# Copyright 2023-2023 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
name: Java 17 CI with Maven
on:
push:
branches: [ main ]
pull_request:
types: [ labeled, opened, synchronize, reopened ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: maven
- name: Build with Maven
run: mvn -B verify -P java-17,run-its
- name: Generate JaCoCo badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2.11.0
with:
badges-directory: .github/badges
generate-branches-badge: true
generate-summary: true
summary-filename: coverage-summary_java-17.json
coverage-badge-filename: jacoco_java-17.svg
branches-badge-filename: branches_java-17.svg
coverage-endpoint-filename: jacoco_java-17.json
branches-endpoint-filename: branches_java-17.json
- name: Log coverage percentages to workflow output
run: |
echo "(java-17) coverage = ${{ steps.jacoco.outputs.coverage }}%"
echo "(java-17) branches = ${{ steps.jacoco.outputs.branches }}%"
- name: Upload JaCoCo coverage report
uses: actions/upload-artifact@v4
with:
name: jacoco-report-java-17
path: target/site/jacoco/
- name: Deploy to Coverage Branch
if: ${{ github.event_name != 'pull_request' }}
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: coverage
build_dir: .github/badges
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on PR with coverage percentages
if: ${{ github.event_name == 'pull_request' }}
run: |
REPORT=$(<.github/badges/coverage-summary_java-17.json)
COVERAGE=$(jq -r '.coverage' <<< "$REPORT")%
BRANCHES=$(jq -r '.branches' <<< "$REPORT")%
NEWLINE=$'\n'
BODY="## JaCoCo Test Coverage Summary Statistics (java-17) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}"
gh pr comment ${{github.event.pull_request.number}} -b "${BODY}"
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
0