diff --git a/.github/workflows/cancel-workflow-on-merge.yml b/.github/workflows/cancel-workflow-on-merge.yml new file mode 100644 index 0000000000..e9a0403fa3 --- /dev/null +++ b/.github/workflows/cancel-workflow-on-merge.yml @@ -0,0 +1,26 @@ +name: Cancel Workflow on Merge or Close +description: Cancels the workflow if the PR is merged or closed to avoid unnecessary runs. + +on: + pull_request: + types: [closed] + +jobs: + cancel-workflow: + runs-on: ubuntu-latest + steps: + - name: Cancel Workflow if Merged or Closed + if: ${{ github.event.pull_request.merged || github.event.pull_request.state == 'closed' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "PR has been merged or closed, cancelling workflow..." + gh auth status + gh run list \ + --repo ${{ github.repository }} \ + --branch ${{ github.event.pull_request.head.ref }} \ + --workflow "TDengine Test" \ + --status in_progress \ + --status queued + --json databaseId --jq '.[].databaseId' | \ + xargs -I {} gh run cancel --repo ${{ github.repository }} {} \ No newline at end of file diff --git a/.github/workflows/taosd-ci-build.yml b/.github/workflows/tdengine-build.yml similarity index 97% rename from .github/workflows/taosd-ci-build.yml rename to .github/workflows/tdengine-build.yml index 2179200bb3..1e89a51c04 100644 --- a/.github/workflows/taosd-ci-build.yml +++ b/.github/workflows/tdengine-build.yml @@ -21,9 +21,10 @@ concurrency: jobs: build: - name: Build and test on ${{ matrix.os }} + name: Run on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: - ubuntu-20.04 diff --git a/.github/workflows/taosd-ci.yml b/.github/workflows/tdengine-ci-test.yml similarity index 96% rename from .github/workflows/taosd-ci.yml rename to .github/workflows/tdengine-ci-test.yml index 23c0e47ebb..08310c91ff 100644 --- a/.github/workflows/taosd-ci.yml +++ b/.github/workflows/tdengine-ci-test.yml @@ -1,4 +1,4 @@ -name: TDengine CI Test +name: TDengine Test on: pull_request: @@ -11,7 +11,7 @@ on: - 'docs/**' concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-TDengine + group: ${{ github.workflow }}-${{ github.event.pull_request.number }}-TDengine cancel-in-progress: true env: @@ -19,6 +19,7 @@ env: jobs: fetch-parameters: + name: Prepare Test runs-on: group: CI labels: [self-hosted, Linux, X64, testing] @@ -101,4 +102,4 @@ jobs: needs: fetch-parameters if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }} with: - tdinternal: false + tdinternal: false \ No newline at end of file diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 9872a9dc55..56c8248aff 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -5,4 +5,4 @@ ADD_SUBDIRECTORY(test/c) # ADD_SUBDIRECTORY(comparisonTest/tdengine) IF(NOT "${TSZ_ENABLED}" MATCHES "false") ADD_SUBDIRECTORY(TSZ) -ENDIF() \ No newline at end of file +ENDIF()