Skip to content

Commit

Permalink
chore: Fix Ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jinsu4755 committed Aug 25, 2023
1 parent b26708c commit b4b7672
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 108 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/common-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
workflow_call:

jobs:
common:
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
9 changes: 9 additions & 0 deletions .github/workflows/gradle-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
on: workflow_call

jobs:
gradle-task:
needs: common
runs-on: ubuntu-latest
steps:
- name: Run Gradle Task
run: ./gradle ${{matrix.gradle.task}}
201 changes: 93 additions & 108 deletions .github/workflows/pr_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,111 +11,96 @@ permissions:
pull-requests: write

jobs:
common:
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

checkstyle:
needs: common
runs-on: ubuntu-latest
steps:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

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

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

build:
needs: common
runs-on: ubuntu-latest
steps:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

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

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

test:
needs: common
runs-on: ubuntu-latest
steps:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

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

- name: Test with Gradle
run: ./gradlew test

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

result-success:
needs:
- checkstyle
- build
- test
if: success()
runs-on: ubuntu-latest
steps:
- name: On Success!! Congratulations
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: '#53A551'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_TITLE: 'Uni/PR Check S.U.C.C.E.S.S 🎉🎉🎉'
SLACK_ICON: ${{ github.event.org.avatar_url }}
MSG_MINIMAL: event,actions url, commit
SLACK_USERNAME: Uni-server
SLACK_MESSAGE: '${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number}}'

result-failure:
needs:
- checkstyle
- build
- test
if: failure()
runs-on: ubuntu-latest
steps:
- name: On Failed, Notify in Slack
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: '#ff0000'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_TITLE: 'Uni/Server Debug build Fail❌ 에러를 확인해주세요'
SLACK_ICON: ${{ github.event.org.avatar_url }}
MSG_MINIMAL: event,actions url, commit
SLACK_USERNAME: Uni-server
SLACK_MESSAGE: '${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number}}'
strategy:
matrix:
gradle-task: [checkstyleMain, clean build]
include:
- name: Common Setup
uses: ./.github/workflows/common.yml

- name: Run Gradle Tasks
uses: ./.github/workflows/gradle-task.yml

# checkstyle:
# needs: common
# runs-on: ubuntu-latest
# steps:
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
#
# - name: load github submodule
# run: ./gradlew copyConfig
#
# - name: Checkstyle Check
# run: ./gradlew checkstyleMain checkstyleTest
#
# build:
# needs: common
# runs-on: ubuntu-latest
# steps:
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
#
# - name: load github submodule
# run: ./gradlew copyConfig
#
# - name: Build with Gradle
# run: ./gradlew clean build
#
# test:
# needs: common
# runs-on: ubuntu-latest
# steps:
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
#
# - name: load github submodule
# run: ./gradlew copyConfig
#
# - name: Test with Gradle
# run: ./gradlew test
#
# - name: Publish Test Results
# uses: EnricoMi/publish-unit-test-result-action@v1
# if: always()
# with:
# files: build/test-results/**/*.xml
#
# result-success:
# needs:
# - checkstyle
# - build
# - test
# if: success()
# runs-on: ubuntu-latest
# steps:
# - name: On Success!! Congratulations
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_COLOR: '#53A551'
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
# SLACK_TITLE: 'Uni/PR Check S.U.C.C.E.S.S 🎉🎉🎉'
# SLACK_ICON: ${{ github.event.org.avatar_url }}
# MSG_MINIMAL: event,actions url, commit
# SLACK_USERNAME: Uni-server
# SLACK_MESSAGE: '${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number}}'
#
# result-failure:
# needs:
# - checkstyle
# - build
# - test
# if: failure()
# runs-on: ubuntu-latest
# steps:
# - name: On Failed, Notify in Slack
# if: ${{ failure() }}
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_COLOR: '#ff0000'
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
# SLACK_TITLE: 'Uni/Server Debug build Fail❌ 에러를 확인해주세요'
# SLACK_ICON: ${{ github.event.org.avatar_url }}
# MSG_MINIMAL: event,actions url, commit
# SLACK_USERNAME: Uni-server
# SLACK_MESSAGE: '${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number}}'

0 comments on commit b4b7672

Please sign in to comment.