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

271 lines
7.6 KiB
YAML
Raw Normal View History

2023-11-30 11:04:30 +00:00
name: PullRequest Merge Check
on:
pull_request:
branches:
- "develop"
types:
- opened # default
- reopened # default
- synchronize # default
- ready_for_review # 必要
permissions:
contents: read
checks: write
id-token: write
pull-requests: write
jobs:
setup:
2023-11-30 11:04:30 +00:00
name: Setup
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Cache
uses: actions/cache@v4.0.2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Dependencies Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/cache/jars-*
~/.gradle/caches/transforms-*
~/.gradle/caches/modules-*
2023-11-30 11:01:25 +00:00
key: gradle-dependencies-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: gradle-dependencies-
- name: Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/[0-9]*.*
.gradle
2023-11-30 11:01:25 +00:00
key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-
- name: Build Cache
uses: actions/cache@v4.0.2
with:
path: |
build
key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/*.kt') }}-${{ github.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build
uses: gradle/gradle-build-action@v3.4.2
with:
arguments: :hideout-core:testClasses
unit-test:
2023-11-30 11:04:30 +00:00
name: Unit Test
needs: [ setup ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Cache
uses: actions/cache@v4.0.2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Dependencies Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/cache/jars-*
~/.gradle/caches/transforms-*
~/.gradle/caches/modules-*
2023-11-30 11:01:25 +00:00
key: gradle-dependencies-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: gradle-dependencies-
- name: Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/[0-9]*.*
.gradle
2023-11-30 11:01:25 +00:00
key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-
- name: Build Cache
uses: actions/cache@v4.0.2
with:
path: |
build
key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Unit Test
uses: gradle/gradle-build-action@v3.4.2
with:
arguments: :hideout-core:test
2023-11-30 10:51:57 +00:00
- name: Save Test Report
2023-12-03 07:22:06 +00:00
if: always()
uses: actions/cache/save@v4
2023-11-30 10:51:57 +00:00
with:
path: build/test-results
key: unit-test-report-${{ github.sha }}
coverage:
2023-11-30 11:04:30 +00:00
name: Coverage
needs: [ setup ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Cache
uses: actions/cache@v4.0.2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Dependencies Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/cache/jars-*
~/.gradle/caches/transforms-*
~/.gradle/caches/modules-*
2023-11-30 11:01:25 +00:00
key: gradle-dependencies-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: gradle-dependencies-
- name: Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/[0-9]*.*
.gradle
2023-11-30 11:01:25 +00:00
key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-
- name: Build Cache
uses: actions/cache@v4.0.2
with:
path: |
build
key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Run Kover
uses: gradle/gradle-build-action@v3.4.2
with:
2024-06-16 07:38:29 +00:00
arguments: :hideout-core:koverXmlReport --rerun-tasks
- name: Add coverage report to PR
if: always()
id: kover
uses: madrapps/jacoco-report@v1.6.1
with:
paths: |
2024-05-18 07:18:54 +00:00
${{ 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
report-tests:
2023-11-30 11:04:30 +00:00
name: Report Tests
if: success() || failure()
2024-06-16 07:30:29 +00:00
needs: [ unit-test ]
runs-on: ubuntu-latest
steps:
2023-11-30 10:51:57 +00:00
- name: Restore Test Report
uses: actions/cache/restore@v4
2023-11-30 10:28:03 +00:00
with:
2023-11-30 10:51:57 +00:00
path: build/test-results
key: unit-test-report-${{ github.sha }}
- name: JUnit Test Report
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/TEST-*.xml'
lint:
2023-11-30 11:04:30 +00:00
name: Lint
needs: [ setup ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Cache
uses: actions/cache@v4.0.2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Dependencies Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/cache/jars-*
~/.gradle/caches/transforms-*
~/.gradle/caches/modules-*
2023-11-30 11:01:25 +00:00
key: gradle-dependencies-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: gradle-dependencies-
- name: Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/[0-9]*.*
.gradle
2023-11-30 11:01:25 +00:00
key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-
- name: Build Cache
uses: actions/cache@v4.0.2
with:
path: |
build
key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45
with:
arguments: :hideout-core:detektMain
- name: Auto Commit
if: ${{ always() }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: fix lint (CI)"