Hideout/.github/workflows/pull-request-merge-check.yml

129 lines
3.1 KiB
YAML

name: PullRequest Merge Check
on:
pull_request:
paths-ignore:
- 'owl/**'
branches:
- "develop"
types:
- opened # default
- reopened # default
- synchronize # default
- ready_for_review # 必要
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
checks: write
id-token: write
pull-requests: write
jobs:
setup:
name: Setup
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Build
run: ./gradlew classes --no-daemon
unit-test:
name: Unit Test
needs: [ setup ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Unit Test
run: ./hideout-core/gradlew :hideout-core:koverXmlReport
- name: Add coverage report to PR
if: always()
id: kover
uses: madrapps/jacoco-report@v1.6.1
with:
paths: |
${{ github.workspace }}/hideout-core/build/reports/kover/report.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: Code Coverage
update-comment: true
min-coverage-overall: 80
min-coverage-changed-files: 80
coverage-counter-type: LINE
- name: JUnit Test Report
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/TEST-*.xml'
lint:
name: Lint
needs: [ setup ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: '${{ secrets.PAT }}'
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Build with Gradle
run: ./gradlew :hideout-core:detektMain :hideout-mastodon:detektMain
- name: Auto Commit
if: ${{ always() }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: fix lint (CI)"