Skip to content

Handle zero-bytecode coverage stats #2131

Handle zero-bytecode coverage stats

Handle zero-bytecode coverage stats #2131

Workflow file for this run

name: "Check code style"
on:
pull_request:
permissions:
contents: read
concurrency:
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
cancel-in-progress: true
jobs:
detect-relevant-changes:
name: "📋 Detect relevant file changes"
runs-on: "ubuntu-22.04"
timeout-minutes: 5
outputs:
relevant-files-changed: ${{ steps.filter.outputs.changed }}
changed-matrix: ${{ steps.changed-matrix.outputs.matrix }}
changed-empty: ${{ steps.changed-matrix.outputs.none-found }}
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: "🔎 Detect relevant file changes"
id: filter
uses: ./.github/actions/detect-file-changes
with:
file-patterns: |
- '!docs/**'
- '!**.md'
- '!library-and-framework-list*.json'
- name: "🔧 Setup java"
if: steps.filter.outputs.changed == 'true'
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: 'graalvm'
java-version: '21'
- name: "Build changed matrix"
id: changed-matrix
if: steps.filter.outputs.changed == 'true'
run: |
./gradlew generateChangedCoordinatesOnlyMatrix \
-PbaseCommit=${{ github.event.pull_request.base.sha }} \
-PnewCommit=${{ github.event.pull_request.head.sha }}
spotless:
name: "✨ Spotless"
if: needs.detect-relevant-changes.outputs.relevant-files-changed == 'true'
needs: detect-relevant-changes
runs-on: "ubuntu-22.04"
timeout-minutes: 10
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: "🔧 Setup java"
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: 'graalvm'
java-version: '21'
- name: "Run Spotless"
run: ./gradlew spotlessCheck --console=plain
checkstyle-coordinates:
name: "📋 Checkstyle ${{ matrix.coordinates }}"
if: needs.detect-relevant-changes.outputs.relevant-files-changed == 'true' && needs.detect-relevant-changes.outputs.changed-empty != 'true'
needs: detect-relevant-changes
runs-on: "ubuntu-22.04"
timeout-minutes: 20
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.detect-relevant-changes.outputs.changed-matrix) }}
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: "🔧 Setup java"
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: 'graalvm'
java-version: '21'
- name: "Run Checkstyle"
run: ./gradlew checkstyle -Pcoordinates=${{ matrix.coordinates }} --console=plain
checkstyle:
name: "📋 Check style according to checkstyle.xml"
if: always()
needs:
- detect-relevant-changes
- spotless
- checkstyle-coordinates
runs-on: "ubuntu-22.04"
timeout-minutes: 1
steps:
- name: "Style checks passed"
if: |
needs.detect-relevant-changes.result == 'success' &&
(needs.spotless.result == 'success' || needs.spotless.result == 'skipped') &&
(needs.checkstyle-coordinates.result == 'success' || needs.checkstyle-coordinates.result == 'skipped')
run: exit 0
- name: "Style checks failed"
if: |
needs.detect-relevant-changes.result == 'failure' ||
needs.detect-relevant-changes.result == 'cancelled' ||
needs.spotless.result == 'failure' || needs.spotless.result == 'cancelled' ||
needs.checkstyle-coordinates.result == 'failure' || needs.checkstyle-coordinates.result == 'cancelled'
run: exit 1