[Tool] Optimize unnecessary CI build steps (#50126)

This commit is contained in:
andyziye 2024-08-22 11:35:50 +08:00 committed by GitHub
parent ddc9efceab
commit bdba1bb4af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 2 deletions

View File

@ -599,6 +599,7 @@ jobs:
BRANCH: ${{ github.base_ref }}
IMAGE_CACHE_ID: ${{ needs.thirdparty-info.outputs.ubuntu_image_cache_id }}
LINUX_DISTRO: ubuntu
GH_TOKEN: ${{ github.token }}
outputs:
build_output_tar: ${{ steps.run_build.outputs.OUTPUT_TAR }}
base_version: ${{ steps.run_build.outputs.BASE_VERSION }}
@ -610,9 +611,19 @@ jobs:
- name: CLEAN
run: |
rm -rf ${{ github.workspace }} && mkdir -p ${{ github.workspace }}
- name: check sync
id: check-sync
run: |
labels=`gh pr view ${PR_NUMBER} -R ${GITHUB_REPOSITORY} --json labels -q '.labels[].name'`
echo "${labels}"
if [[ "${labels}" =~ sync ]]; then
echo "IS_SYNC=true" >> $GITHUB_OUTPUT
fi
- name: Download BE Path Filter Artifact
uses: dawidd6/action-download-artifact@v6
if: steps.check-sync.outputs.IS_SYNC != 'true'
with:
name: be-path-filter
path: be-path-filter
@ -621,6 +632,7 @@ jobs:
- name: Download FE Path Filter Artifact
uses: dawidd6/action-download-artifact@v6
if: steps.check-sync.outputs.IS_SYNC != 'true'
with:
name: fe-path-filter
path: fe-path-filter
@ -629,6 +641,7 @@ jobs:
- name: Parsing BE path-filter file
id: parsing-be-path-filter
if: steps.check-sync.outputs.IS_SYNC != 'true'
run: |
if [[ -e be-path-filter ]]; then
cd be-path-filter/; ls;
@ -639,6 +652,7 @@ jobs:
- name: Parsing FE path-filter file
id: parsing-fe-path-filter
if: steps.check-sync.outputs.IS_SYNC != 'true'
run: |
if [[ -e fe-path-filter ]]; then
cd fe-path-filter/; ls;
@ -661,6 +675,7 @@ jobs:
- name: BRANCH INFO
id: branch
if: steps.check-necessity.outcome == 'success'
run: |
repo="${{ github.repository }}"
bucket_prefix=`echo ${repo%/*} | tr '[:upper:]' '[:lower:]'`
@ -668,6 +683,7 @@ jobs:
- name: Rebuild Checker
id: rebuild-checker
if: steps.check-necessity.outcome == 'success'
env:
be_change: ${{ steps.parsing-be-path-filter.outputs.src_filter }}
fe_change: ${{ steps.parsing-fe-path-filter.outputs.src_filter }}
@ -684,6 +700,7 @@ jobs:
id: run_build
shell: bash
timeout-minutes: 90
if: steps.check-necessity.outcome == 'success'
env:
package: ${{ env.package }}
pom_filter: ${{ steps.parsing-fe-path-filter.outputs.pom_filter }}
@ -706,12 +723,14 @@ jobs:
fi
- name: build result
if: steps.check-necessity.outcome == 'success'
run: |
echo ${{ steps.run_build.outputs.OUTPUT_TAR }}
echo ${{ steps.run_build.outputs.BASE_VERSION }} > ./base_version.txt
- name: Upload the Base Version
uses: actions/upload-artifact@v4
if: steps.check-necessity.outcome == 'success'
with:
name: base_version
path: ./base_version.txt
@ -733,7 +752,7 @@ jobs:
deploy:
runs-on: [self-hosted, normal]
if: always() && needs.build.result == 'success'
if: always() && needs.build.result == 'success' && needs.build.outputs.build_nece == 'true'
needs: build
name: DEPLOY SR
env: