Merge branch 'develop' of https://github.com/sonatype-nexus-community… #153
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Develop branch workflow | |
on: | |
push: | |
branches: [develop] | |
pull_request: | |
branches: [develop] | |
jobs: | |
enforce-commit-standards: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Print Python version | |
run: python -V | |
- name: Install pre-commit-checks | |
run: pip install pre-commit==2.16.0 | |
- name: Run pre-commit on all files | |
run: pre-commit run --all-files | |
continue-on-error: true | |
- name: Print git changes | |
run: git status | |
- uses: EndBug/add-and-commit@v7 | |
continue-on-error: true | |
with: | |
default_author: github_actions | |
message: "Pipeline pre-commit update" | |
check-test-coverage: | |
needs: enforce-commit-standards | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up the Java JDK | |
uses: actions/setup-java@v2 | |
with: | |
java-version: "8" | |
distribution: "adopt" | |
- name: Build with Gradle | |
run: | | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
./gradlew -Prelversion=$VERSION clean build test codeCoverageReport --info --stacktrace | |
- name: Generate JaCoCo Badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
generate-branches-badge: true | |
jacoco-csv-file: build/reports/jacoco/codeCoverageReport/codeCoverageReport.csv | |
- name: Log coverage percentage | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | |
- name: Commit and push the badge (if it changed) | |
uses: EndBug/add-and-commit@v7 | |
with: | |
default_author: github_actions | |
message: "commit badge" | |
add: "*.svg" | |
if: github.ref == 'refs/heads/main' | |
- name: Upload JaCoCo coverage report | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jacoco-report | |
path: build/reports/jacoco/codeCoverageReport/codeCoverageReport.csv |