-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: AndyZiYe <[email protected]> Co-authored-by: andyziye <[email protected]> Co-authored-by: AndyZiYe <[email protected]>
- Loading branch information
1 parent
d6c537b
commit 92d458f
Showing
6 changed files
with
887 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,14 +16,14 @@ concurrency: | |
|
||
jobs: | ||
|
||
sync-checker: | ||
basic-checker: | ||
runs-on: [ self-hosted, normal ] | ||
name: RUN CHECKER | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
GH_TOKEN: ${{ github.token }} | ||
outputs: | ||
PASS: ${{ steps.check.outputs.pass }} | ||
THIRDPARTY: ${{ steps.thirdparty-checker.outputs.thirdparty }} | ||
steps: | ||
- name: upload info | ||
env: | ||
|
@@ -56,25 +56,25 @@ jobs: | |
run: | | ||
echo "pass=true" >> $GITHUB_OUTPUT | ||
- uses: dorny/paths-filter@v2 | ||
id: thirdparty-checker | ||
if: always() | ||
with: | ||
filters: | | ||
thirdparty: | ||
- 'thirdparty/**' | ||
- 'docker/dockerfiles/dev-env/dev-env.Dockerfile' | ||
- name: Check Blacklist | ||
id: check_blacklist | ||
env: | ||
NO_SYNC: ${{ steps.check.outputs.pass }} | ||
AUTHOR: ${{ github.event.pull_request.user.login }} | ||
run: | | ||
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null | ||
./scripts/check-blacklist.sh | ||
be-checker: | ||
runs-on: ubuntu-latest | ||
needs: sync-checker | ||
needs: basic-checker | ||
name: BE FILTER | ||
if: needs.sync-checker.outputs.PASS == 'true' || needs.sync-checker.outputs.THIRDPARTY == 'true' | ||
if: needs.basic-checker.outputs.PASS == 'true' | ||
outputs: | ||
output1: ${{ steps.be-changes-info.outputs.be }} | ||
output2: ${{ steps.be-changes-info.outputs.thirdparty }} | ||
steps: | ||
- uses: dorny/paths-filter@v2 | ||
- uses: dorny/paths-filter@v3 | ||
id: changes | ||
with: | ||
filters: | | ||
|
@@ -109,7 +109,7 @@ jobs: | |
mkdir -p ${{ github.workspace }} | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
|
@@ -130,7 +130,7 @@ jobs: | |
git fetch origin pull/${PR_NUMBER}/head:${BRANCH_NAME}; | ||
git checkout $BRANCH_NAME; | ||
git checkout -b merge_pr; | ||
git merge --squash --no-edit ${BRANCH} || (echo "Merge conflict, please check." && exit -1); | ||
git merge --squash --no-edit ${BRANCH} || (echo "::error::Merge conflict, please check." && exit -1); | ||
- name: Run Clang-Format | ||
run: | | ||
|
@@ -150,28 +150,33 @@ jobs: | |
PR_NUMBER: ${{ github.event.number }} | ||
BRANCH: ${{ github.base_ref }} | ||
REPO: ${{ github.repository }} | ||
outputs: | ||
ip: ${{ steps.update-image.outputs.ip }} | ||
instance_id: ${{ steps.update-image.outputs.instance_id }} | ||
image_cache_id: ${{ steps.update-image.outputs.image_cache_id }} | ||
continue-on-error: true | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build_type: [ Release, ASAN ] | ||
steps: | ||
- name: clean | ||
run: | | ||
rm -rf ${{ github.workspace }} | ||
mkdir -p ${{ github.workspace }} | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update Image | ||
- name: Update Image (${{ matrix.build_type }}) | ||
id: update-image | ||
if: needs.be-checker.outputs.output2 == 'true' | ||
env: | ||
linux_distro: ${{ matrix.build_type }} | ||
run: | | ||
if [[ "${{ needs.be-checker.outputs.output2 }}" == 'true' ]]; then | ||
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh | ||
./bin/run-pr-update-image.sh | ||
fi | ||
cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh | ||
./bin/run-pr-update-image.sh | ||
- name: Upload Thirdparty Result | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: THIRDPARTY-RESULT-${{ matrix.build_type }} | ||
path: image_cache.info | ||
retention-days: 1 | ||
overwrite: true | ||
|
||
- name: Clean ENV | ||
if: always() | ||
|
@@ -182,10 +187,41 @@ jobs: | |
fi | ||
rm -rf ${{ github.workspace }}/* | ||
thirdparty-info: | ||
runs-on: [ self-hosted, normal ] | ||
needs: | ||
- thirdparty-update | ||
name: Thirdparty Info | ||
outputs: | ||
centos7_image_cache_id: ${{ steps.info.outputs.centos7_image_cache_id }} | ||
ubuntu_image_cache_id: ${{ steps.info.outputs.ubuntu_image_cache_id }} | ||
steps: | ||
- name: Check Result | ||
run: | | ||
if [[ "${{ needs.thirdparty-update.result }}" == 'failure' ]]; then | ||
echo "::error:: Thirdparty Update Error!" | ||
exit 1 | ||
fi | ||
- name: Download Thirdparty Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: THIRDPARTY-RESULT-* | ||
path: outputs | ||
|
||
- name: Read Info | ||
id: info | ||
if: needs.thirdparty-update.result == 'success' | ||
run: | | ||
image_cache_id=$(cat "./outputs/THIRDPARTY-RESULT-centos7/image_cache.info" || echo "") | ||
echo "centos7_image_cache_id=${image_cache_id}" >> $GITHUB_OUTPUT | ||
image_cache_id=$(cat "./outputs/THIRDPARTY-RESULT-ubuntu/image_cache.info" || echo "") | ||
echo "ubuntu_image_cache_id=${image_cache_id}" >> $GITHUB_OUTPUT | ||
be-ut: | ||
runs-on: [self-hosted, normal] | ||
needs: [ be-checker, thirdparty-update ] | ||
timeout-minutes: 90 | ||
needs: [ be-checker, thirdparty-info ] | ||
timeout-minutes: 180 | ||
name: BE UT | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
|
@@ -204,7 +240,7 @@ jobs: | |
run: | | ||
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh | ||
if [[ "${{ needs.be-checker.outputs.output2 }}" == 'true' ]]; then | ||
export image_cache_id=${{ needs.thirdparty-update.outputs.image_cache_id }} | ||
export image_cache_id=${{ needs.thirdparty-info.outputs.centos7_image_cache_id }} | ||
export image_tag=$BRANCH-$PR_NUMBER | ||
fi | ||
./bin/elastic-ut.sh --pr ${PR_NUMBER} --module be --branch ${{ steps.branch.outputs.branch }} --repository ${{ github.repository }} | ||
|
@@ -216,29 +252,31 @@ jobs: | |
eci rm ${{ steps.run_ut.outputs.ECI_ID }} | ||
- name: Upload log | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: BE UT LOG | ||
path: ${{ steps.run_ut.outputs.RES_LOG }} | ||
path: ${{ steps.run_ut.outputs.BE_LOG }} | ||
retention-days: 1 | ||
overwrite: true | ||
|
||
- name: Clean ENV | ||
if: always() | ||
run: | | ||
rm -f ${{ steps.run_ut.outputs.RES_FILE }} | ||
rm -f ${{ steps.run_ut.outputs.RES_LOG }} | ||
rm -rf ${{ steps.run_ut.outputs.BE_LOG }} | ||
rm -rf ${{ github.workspace }}/* | ||
fe-checker: | ||
runs-on: ubuntu-latest | ||
needs: sync-checker | ||
needs: basic-checker | ||
name: FE FILTER | ||
if: needs.sync-checker.outputs.PASS == 'true' || needs.sync-checker.outputs.THIRDPARTY == 'true' | ||
if: needs.basic-checker.outputs.PASS == 'true' | ||
outputs: | ||
output1: ${{ steps.fe-changes-info.outputs.fe }} | ||
steps: | ||
- uses: dorny/paths-filter@v2 | ||
- uses: dorny/paths-filter@v3 | ||
id: changes | ||
with: | ||
filters: | | ||
|
@@ -269,7 +307,7 @@ jobs: | |
rm -rf ${{ github.workspace }} | ||
mkdir -p ${{ github.workspace }} | ||
- uses: dorny/paths-filter@v2 | ||
- uses: dorny/paths-filter@v3 | ||
id: java-file | ||
name: JAVA FILE | ||
with: | ||
|
@@ -285,7 +323,7 @@ jobs: | |
echo ${{github.base_ref}} | ||
echo "branch=${{github.base_ref}}" >> $GITHUB_OUTPUT | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
|
@@ -300,7 +338,7 @@ jobs: | |
git fetch origin pull/${PR_NUMBER}/head:${BRANCH_NAME}; | ||
git checkout $BRANCH_NAME; | ||
git checkout -b merge_pr; | ||
git merge --squash --no-edit ${BRANCH} || (echo "Merge conflict, please check." && exit -1); | ||
git merge --squash --no-edit ${BRANCH} || (echo "::error::Merge conflict, please check." && exit -1); | ||
- name: Copy checkstyle files | ||
if: ${{ steps.java-file.outputs.java == 'true' }} | ||
|
@@ -329,7 +367,7 @@ jobs: | |
BRANCH: ${{ github.base_ref }} | ||
GH_TOKEN: ${{ github.token }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
|
@@ -411,23 +449,6 @@ jobs: | |
bucket_prefix=`echo ${repo%/*} | tr '[:upper:]' '[:lower:]'` | ||
echo "bucket_prefix=${bucket_prefix}" >> $GITHUB_OUTPUT | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout PR | ||
run: | | ||
BRANCH=${{steps.branch.outputs.branch}} | ||
git config --global user.name "wanpengfei-git"; | ||
git config --global user.email "[email protected]"; | ||
git checkout $BRANCH; | ||
git pull; | ||
BRANCH_NAME="${BRANCH}-${PR_NUMBER}"; | ||
git fetch origin pull/${PR_NUMBER}/head:${BRANCH_NAME}; | ||
git checkout $BRANCH_NAME; | ||
git checkout -b merge_pr; | ||
git merge --squash --no-edit ${BRANCH} || (echo "Merge conflict, please check." && exit -1); | ||
- name: UPDATE ECI & RUN UT | ||
id: run_ut | ||
shell: bash | ||
|
@@ -446,11 +467,12 @@ jobs: | |
- name: Upload log | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: FE UT LOG | ||
path: ${{ steps.run_ut.outputs.RES_LOG }} | ||
retention-days: 1 | ||
overwrite: true | ||
|
||
- name: Clean ENV | ||
if: always() | ||
|
@@ -460,3 +482,38 @@ jobs: | |
rm -f ${{ steps.run_ut.outputs.RES_LOG }} | ||
rm -rf ${{ steps.run_ut.outputs.COV_DIR }} | ||
rm -rf ${{ github.workspace }}/* | ||
Teardown: | ||
runs-on: [self-hosted, normal] | ||
name: Teardown | ||
needs: [ fe-ut, be-ut ] | ||
if: always() | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
BRANCH: ${{ github.base_ref }} | ||
steps: | ||
- name: upload info | ||
if: always() | ||
run: | | ||
echo $PR_NUMBER > pr_num.txt | ||
GITHUB_SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha) | ||
echo ${GITHUB_SHA} > head_sha.txt | ||
- name: Upload the PR number | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pr_num | ||
path: ./pr_num.txt | ||
retention-days: 3 | ||
overwrite: true | ||
|
||
- name: Upload the PR HEAD REF | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: head_sha | ||
path: ./head_sha.txt | ||
retention-days: 3 | ||
|
||
- name: Clean | ||
run: | | ||
rm -rf ${{ github.workspace }}/* |
Oops, something went wrong.