From 7da92eb9eba63ce3f5757b86fdd151a2602cced0 Mon Sep 17 00:00:00 2001 From: tison Date: Sun, 19 May 2024 15:10:59 +0800 Subject: [PATCH] ci: check-status for nightly-ci (#3984) Signed-off-by: tison --- .github/workflows/dev-build.yml | 6 +-- .github/workflows/nightly-build.yml | 4 +- .github/workflows/nightly-ci.yml | 65 ++++++++++++++++++----------- .github/workflows/release.yml | 4 +- 4 files changed, 48 insertions(+), 31 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index f88202e14460..036f029f3a56 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -324,7 +324,7 @@ jobs: github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} notification: - if: ${{ always() }} # Not requiring successful dependent jobs, always run. + if: ${{ github.repository == 'GreptimeTeam/greptimedb' && always() }} # Not requiring successful dependent jobs, always run. name: Send notification to Greptime team needs: [ release-images-to-dockerhub @@ -342,14 +342,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CI_REPORT_STATUS: ${{ needs.release-images-to-dockerhub.outputs.build-result == 'success' }} - - name: Notifiy dev build successful result + - name: Notify dev build successful result uses: slackapi/slack-github-action@v1.23.0 if: ${{ needs.release-images-to-dockerhub.outputs.build-result == 'success' }} with: payload: | {"text": "GreptimeDB's ${{ env.NEXT_RELEASE_VERSION }} build has completed successfully."} - - name: Notifiy dev build failed result + - name: Notify dev build failed result uses: slackapi/slack-github-action@v1.23.0 if: ${{ needs.release-images-to-dockerhub.outputs.build-result != 'success' }} with: diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 46c472f211c9..05ddf232c345 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -306,14 +306,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CI_REPORT_STATUS: ${{ needs.release-images-to-dockerhub.outputs.build-result == 'success' }} - - name: Notifiy nightly build successful result + - name: Notify nightly build successful result uses: slackapi/slack-github-action@v1.23.0 if: ${{ needs.release-images-to-dockerhub.outputs.nightly-build-result == 'success' }} with: payload: | {"text": "GreptimeDB's ${{ env.NEXT_RELEASE_VERSION }} build has completed successfully."} - - name: Notifiy nightly build failed result + - name: Notify nightly build failed result uses: slackapi/slack-github-action@v1.23.0 if: ${{ needs.release-images-to-dockerhub.outputs.nightly-build-result != 'success' }} with: diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml index c15822f73d88..f7b6301e0c0b 100644 --- a/.github/workflows/nightly-ci.yml +++ b/.github/workflows/nightly-ci.yml @@ -25,7 +25,6 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Run sqlness test uses: ./.github/actions/sqlness-test with: @@ -53,22 +52,6 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Run sqlness run: cargo sqlness - - name: Report CI status - if: always() - id: report-ci-status - working-directory: cyborg - run: pnpm tsx bin/report-ci-failure.ts - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CI_REPORT_STATUS: ${{ success() }} - - name: Notify slack if failed - if: failure() - uses: slackapi/slack-github-action@v1.23.0 - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_DEVELOP_CHANNEL }} - with: - payload: | - {"text": "Nightly CI failed for sqlness tests, please check ${{ steps.report-ci-status.outputs.html_url }}"} - name: Upload sqlness logs if: always() uses: actions/upload-artifact@v4 @@ -123,19 +106,53 @@ jobs: GT_S3_ACCESS_KEY: ${{ secrets.AWS_CI_TEST_SECRET_ACCESS_KEY }} GT_S3_REGION: ${{ vars.AWS_CI_TEST_BUCKET_REGION }} UNITTEST_LOG_DIR: "__unittest_logs" + + check-status: + name: Check status + needs: [ + sqlness-test, + sqlness-windows, + test-on-windows, + ] + if: ${{ github.repository == 'GreptimeTeam/greptimedb' }} + runs-on: ubuntu-20.04 + outputs: + check-result: ${{ steps.set-check-result.outputs.check-result }} + steps: + - name: Set check result + id: set-check-result + run: | + echo "check-result=success" >> $GITHUB_OUTPUT + + notification: + if: ${{ github.repository == 'GreptimeTeam/greptimedb' && always() }} # Not requiring successful dependent jobs, always run. + name: Send notification to Greptime team + needs: [ + check-status + ] + runs-on: ubuntu-20.04 + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_DEVELOP_CHANNEL }} + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-cyborg - name: Report CI status - if: always() id: report-ci-status working-directory: cyborg run: pnpm tsx bin/report-ci-failure.ts env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CI_REPORT_STATUS: ${{ success() }} - - name: Notify slack if failed - if: failure() + CI_REPORT_STATUS: ${{ needs.check-status.outputs.check-result == 'success' }} + - name: Notify dev build successful result uses: slackapi/slack-github-action@v1.23.0 - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_DEVELOP_CHANNEL }} + if: ${{ needs.check-status.outputs.check-result == 'success' }} + with: + payload: | + {"text": "Nightly CI has completed successfully."} + + - name: Notify dev build failed result + uses: slackapi/slack-github-action@v1.23.0 + if: ${{ needs.check-status.outputs.check-result != 'success' }} with: payload: | - {"text": "Nightly CI failed for cargo test, please check ${{ steps.report-ci-status.outputs.html_url }}"} + {"text": "Nightly CI failed has failed, please check ${{ steps.report-ci-status.outputs.html_url }}."} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 309f76d08c5f..ef0f0df97884 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -459,14 +459,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CI_REPORT_STATUS: ${{ needs.release-images-to-dockerhub.outputs.build-image-result == 'success' && needs.build-windows-artifacts.outputs.build-windows-result == 'success' && needs.build-macos-artifacts.outputs.build-macos-result == 'success' }} - - name: Notifiy release successful result + - name: Notify release successful result uses: slackapi/slack-github-action@v1.25.0 if: ${{ needs.release-images-to-dockerhub.outputs.build-image-result == 'success' && needs.build-windows-artifacts.outputs.build-windows-result == 'success' && needs.build-macos-artifacts.outputs.build-macos-result == 'success' }} with: payload: | {"text": "GreptimeDB's release version has completed successfully."} - - name: Notifiy release failed result + - name: Notify release failed result uses: slackapi/slack-github-action@v1.25.0 if: ${{ needs.release-images-to-dockerhub.outputs.build-image-result != 'success' || needs.build-windows-artifacts.outputs.build-windows-result != 'success' || needs.build-macos-artifacts.outputs.build-macos-result != 'success' }} with: