Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix Ci #117

Merged
merged 16 commits into from
Aug 30, 2023
54 changes: 19 additions & 35 deletions .github/workflows/ci_checker_on_main_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,28 @@ permissions:
contents: read

jobs:
build:
ci:
uses: ./.github/workflows/gradle-task.yml
with:
tasks : '["checkstyleMain", "checkstyleTest", "build -x test", "test"]'
secrets: inherit

publish-test-result:
needs:
- ci
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_TOKEN }}
submodules: true

- name: Gradle cache
uses: actions/cache@v2
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: load github submodule
run: ./gradlew copyConfig

- name: Checkstyle Check
run: ./gradlew checkstyleMain checkstyleTest

- name: Build with Gradle
run: ./gradlew clean build
files: build/test-results/**/*.xml

result-failure:
needs:
- ci
if: failure()
runs-on: ubuntu-latest
steps:
- name: On Failed, Notify in Slack
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
Expand All @@ -56,4 +40,4 @@ jobs:
SLACK_ICON: ${{ github.event.org.avatar_url }}
MSG_MINIMAL: event,actions url, commit
SLACK_USERNAME: Uni-server
SLACK_MESSAGE: '${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}'
SLACK_MESSAGE: '${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number}}'
44 changes: 44 additions & 0 deletions .github/workflows/gradle-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
on:
workflow_call:
inputs:
tasks:
description: gradle execute option
type: string

jobs:
gradle-task:
strategy:
matrix:
gradle: ${{ fromJSON(inputs.tasks) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_TOKEN }}
submodules: true

- name: Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Load GitHub submodule
run: ./gradlew copyConfig

- name: Run Gradle Task
run: ./gradlew ${{matrix.gradle}}
60 changes: 22 additions & 38 deletions .github/workflows/pr_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,30 @@ permissions:
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
ci:
uses: ./.github/workflows/gradle-task.yml
with:
tasks : '["checkstyleMain", "checkstyleTest", "build -x test", "test"]'
secrets: inherit

publish-test-result:
needs:
- ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_TOKEN }}
submodules: true

- name: Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: load github submodule
run: ./gradlew copyConfig

- name: Checkstyle Check
run: ./gradlew checkstyleMain checkstyleTest

- name: Build with Gradle
run: ./gradlew clean build

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: build/test-results/**/*.xml


result-success:
needs:
- ci
if: success()
runs-on: ubuntu-latest
steps:
- name: On Success!! Congratulations
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: '#53A551'
Expand All @@ -67,6 +45,12 @@ jobs:
SLACK_USERNAME: Uni-server
SLACK_MESSAGE: '${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number}}'

result-failure:
needs:
- ci
if: failure()
runs-on: ubuntu-latest
steps:
- name: On Failed, Notify in Slack
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
Expand Down
Loading