From 1440045fb82898b1f9b40b36c99eee82d1454bab Mon Sep 17 00:00:00 2001 From: xiangzihao <460888207@qq.com> Date: Tue, 19 Mar 2024 10:26:20 +0800 Subject: [PATCH] [CI] Frontend ci require passed before merge (#15735) * frontend ci require passed before merge --- .asf.yaml | 1 + .github/workflows/frontend.yml | 38 ++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.asf.yaml b/.asf.yaml index af70489cb2b2..cf409dc6a353 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -45,6 +45,7 @@ github: - Unit Test - E2E - Docs + - Frontend Build - "Mergeable: milestone-label-check" required_pull_request_reviews: dismiss_stale_reviews: true diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 5d64b5f1d65b..2352d6ea25ac 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -38,10 +38,25 @@ concurrency: cancel-in-progress: true jobs: + paths-filter: + name: Frontend-Path-Filter + runs-on: ubuntu-latest + outputs: + not-ignore: ${{ steps.filter.outputs.not-ignore }} + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@b2feaf19c27470162a626bd6fa8438ae5b263721 + id: filter + with: + filters: | + not-ignore: + - '!(docs/**)' build: name: Build + needs: paths-filter + if: ${{ (needs.paths-filter.outputs.not-ignore == 'true') || (github.event_name == 'push') }} runs-on: ${{ matrix.os }} - timeout-minutes: 20 + timeout-minutes: 30 strategy: matrix: os: [ ubuntu-latest, macos-latest ] @@ -56,9 +71,28 @@ jobs: uses: actions/setup-node@v2 with: node-version: 16 - - name: Compile and Build + - name: Compile and Build on ${{ matrix.os }} run: | + set -x npm install pnpm@7 -g pnpm install pnpm run lint pnpm run build:prod + result: + name: Frontend Build + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: [ build, paths-filter ] + if: always() + steps: + - uses: actions/checkout@v2 + - name: Status + run: | + if [[ ${{ needs.paths-filter.outputs.not-ignore }} == 'false' && ${{ github.event_name }} == 'pull_request' ]]; then + echo "Skip Frontend Build!" + exit 0 + fi + if [[ ${{ needs.build.result }} != 'success' ]]; then + echo "Frontend Build Failed!" + exit -1 + fi