Skip to content

[maven-release-plugin] prepare release pom-editor-maven-plugin-1.0.0 #120

[maven-release-plugin] prepare release pom-editor-maven-plugin-1.0.0

[maven-release-plugin] prepare release pom-editor-maven-plugin-1.0.0 #120

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 11 CI with Maven
on:
push:
branches: [ main ]
# Each pull request is important to us, doesn't matter from which branch.
# Furthermore, we do not want to build on just the default GitHub Action
# events, we also want to react onto `labeled` events for our extended
# build execution
pull_request:
types: [ labeled, opened, synchronize, reopened ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
cache: maven
- name: Build with Maven
run: mvn -B verify -P run-its
- name: Generate JaCoCo badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
badges-directory: .github/badges
generate-branches-badge: true
generate-summary: true
summary-filename: coverage-summary_java-11.json
coverage-badge-filename: jacoco_java-11.svg
branches-badge-filename: branches_java-11.svg
coverage-endpoint-filename: jacoco_java-11.json
branches-endpoint-filename: branches_java-11.json
- name: Log coverage percentages to workflow output
run: |
echo "(java-11) coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "(java-11) branches = ${{ steps.jacoco.outputs.branches }}"
- name: Upload JaCoCo coverage report
uses: actions/upload-artifact@v3
with:
name: jacoco-report-java-11
path: target/site/jacoco/
- name: Deploy to Coverage Branch
if: ${{ github.event_name != 'pull_request' }}
uses: crazy-max/ghaction-github-pages@v3
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-11.json)
COVERAGE=$(jq -r '.coverage' <<< "$REPORT")%
BRANCHES=$(jq -r '.branches' <<< "$REPORT")%
NEWLINE=$'\n'
BODY="## JaCoCo Test Coverage Summary Statistics (java-11) ${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 }}