From cef4a0c0e01a458b534dc253e55bc22ae1fa9928 Mon Sep 17 00:00:00 2001 From: andyziye <108652123+andyziye@users.noreply.github.com> Date: Wed, 23 Aug 2023 18:01:55 +0800 Subject: [PATCH] [Tool] Upload both BE/FE coverage of PR after merged (#29812) Signed-off-by: AndyZiYe --- .github/workflows/ci-doc-checker.yml | 29 +++++++++++----------------- .github/workflows/ci-merged.yml | 2 +- .github/workflows/ci-pipeline.yml | 13 +++++++++++-- .github/workflows/ci-report.yml | 3 +++ codecov.yml | 1 + 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-doc-checker.yml b/.github/workflows/ci-doc-checker.yml index bbec1b692fad7..655497d60ba49 100644 --- a/.github/workflows/ci-doc-checker.yml +++ b/.github/workflows/ci-doc-checker.yml @@ -87,24 +87,17 @@ jobs: ignore: node_modules version: 0.28.1 - behavior-change-unset: - runs-on: ubuntu-latest - needs: add-doc-label - steps: - - name: Replace Pull Request Body - uses: ivangabriele/find-and-replace-pull-request-body@v1.1.5 - with: - githubToken: ${{ secrets.PAT }} - find: '[x] Yes, this PR will result in a change in behavior.' - replace: '[ ] Yes, this PR will result in a change in behavior.' - - behavior-unchange-set: + behavior-unchange: runs-on: ubuntu-latest needs: add-doc-label + env: + PR_NUMBER: ${{ github.event.number }} + REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.PAT }} steps: - - name: Replace Pull Request Body - uses: ivangabriele/find-and-replace-pull-request-body@v1.1.5 - with: - githubToken: ${{ secrets.PAT }} - find: '[ ] No, this PR will not result in a change in behavior.' - replace: '[x] No, this PR will not result in a change in behavior.' + - name: Set Body + run: | + body=$(gh pr view ${PR_NUMBER} -R ${REPO} --json body -q .body) + body=${body//"[x] Yes, this PR will result in a change in behavior."/"[ ] Yes, this PR will result in a change in behavior."} + body=${body//"[ ] No, this PR will not result in a change in behavior."/"[x] No, this PR will not result in a change in behavior."} + gh pr edit ${PR_NUMBER} -R ${REPO} -b "$body" diff --git a/.github/workflows/ci-merged.yml b/.github/workflows/ci-merged.yml index 958d960f6fc60..a3d5ddbea718e 100644 --- a/.github/workflows/ci-merged.yml +++ b/.github/workflows/ci-merged.yml @@ -132,7 +132,7 @@ jobs: - name: update merged coverage env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PAT }} run: | rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh ./bin/upload_cov_after_merge.sh --pr ${PR_NUMBER} --commit ${{ steps.commit_sha.outputs.commit_sha }} diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 21d7c46d49975..086abe712a2ca 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -735,7 +735,7 @@ jobs: Teardown: runs-on: [self-hosted, normal] name: Teardown - needs: [ deploy, admit ] + needs: [ deploy, SQL-Tester, admit ] if: always() && needs.deploy.outputs.deploy_conf_file != '' env: PR_NUMBER: ${{ github.event.number }} @@ -743,14 +743,23 @@ jobs: CONF_FILE: ${{ needs.deploy.outputs.deploy_conf_file }} steps: - name: Backup SR Info + id: backup run: | rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh ./bin/backup_log_cores.sh --branch $BRANCH --pr $PR_NUMBER --build Release --conf $CONF_FILE --repository ${{ github.repository }} - name: Clean ECS + if: steps.backup.outcome == 'success' + env: + SQL_TESTER_RESULT: ${{ needs.SQL-Tester.outcome }} + ADMIT_RESULT: ${{ needs.admit.outcome }} run: | cd ci-tool && source lib/init.sh - ./bin/elastic-cluster.sh --delete + if [[ "${SQL_TESTER_RESULT}" == 'success' && "${ADMIT_RESULT}" == 'success' ]]; then + ./bin/elastic-cluster.sh --delete + else + ./bin/elastic-cluster.sh --renew 0.25 + fi - name: Clean run: | diff --git a/.github/workflows/ci-report.yml b/.github/workflows/ci-report.yml index 6d4580d3d705d..cb17a11b1c13e 100644 --- a/.github/workflows/ci-report.yml +++ b/.github/workflows/ci-report.yml @@ -31,6 +31,9 @@ jobs: HEAD_SHA: ${{ steps.pr_details.outputs.HEAD_SHA }} BASE_REF: ${{ steps.pr_details.outputs.BASE_REF }} steps: + - run: | + sleep 30 + - name: Download workflow artifact - PR uses: dawidd6/action-download-artifact@v2 with: diff --git a/codecov.yml b/codecov.yml index 08fa6dd125f21..879b1fb17b5dd 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,6 +1,7 @@ comment: false codecov: allow_coverage_offsets: true + max_report_age: off github_checks: annotations: false coverage: