diff --git a/.github/workflows/cancel-running-workflows.yaml b/.github/workflows/cancel-running-workflows.yaml new file mode 100644 index 0000000000..c5abef40a6 --- /dev/null +++ b/.github/workflows/cancel-running-workflows.yaml @@ -0,0 +1,42 @@ +name: Cancel Workflow Runs + +on: + pull_request: + types: [ synchronize ] + +jobs: + cancel-runs: + runs-on: ubuntu-latest + steps: + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + - name: Get Workflow Runs + id: get_runs + uses: actions/github-script@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { data: runs } = await github.actions.listRepoWorkflowRuns({ + owner: context.repo.owner, + repo: context.repo.repo, + branch: ${{ steps.extract_branch.outputs.branch }} + per_page: 100, + status: 'in_progress' // Filter for in-progress runs + }); + return runs; + + - name: Cancel Workflow Runs + if: ${{ always() }} + run: | + for run in "${{ steps.get_runs.outputs.runtimes }}"; do + # Cancel runs based on conditions + # Example: cancel runs triggered by the main branch + if [[ $run.branch == ${{ steps.extract_branch.outputs.branch }} ]]; then + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/actions/runs/${run.id}/cancel + fi + done diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9c2fb4cf74..eae10acc4d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -26,19 +26,19 @@ jobs: - name: Run unit tests run: make unit-test -# integration-tests: -# strategy: -# fail-fast: false -# matrix: -# # Due to Scylla issue #16349 it is expected that restore-schema -# # jobs with the following config will fail (4 jobs total): -# # - scylla-version: scylla:5.2.X, raft-enabled: true -# # - scylla-version: scylla-enterprise:2024.1.X, raft-enabled: true -# scylla-version: [ 'scylla:5.2.13', 'scylla:5.4.1', 'scylla-enterprise:2023.1.3', 'scylla-enterprise:2024.1.0-rc3' ] -# ip-family: [ IPV4, IPV6 ] -# raft-enabled: [ true, false ] -# uses: ./.github/workflows/integration-tests.yaml -# with: -# scylla-version: ${{ matrix.scylla-version }} -# ip-family: ${{ matrix.ip-family }} -# raft-enabled: ${{ matrix.raft-enabled }} \ No newline at end of file + integration-tests: + strategy: + fail-fast: false + matrix: + # Due to Scylla issue #16349 it is expected that restore-schema + # jobs with the following config will fail (4 jobs total): + # - scylla-version: scylla:5.2.X, raft-enabled: true + # - scylla-version: scylla-enterprise:2024.1.X, raft-enabled: true + scylla-version: [ 'scylla:5.2.13' ] #, 'scylla:5.4.1', 'scylla-enterprise:2023.1.3', 'scylla-enterprise:2024.1.0-rc3' ] + ip-family: [ IPV4 ] #, IPV6 ] + raft-enabled: [false] # [ true, false ] + uses: ./.github/workflows/integration-tests.yaml + with: + scylla-version: ${{ matrix.scylla-version }} + ip-family: ${{ matrix.ip-family }} + raft-enabled: ${{ matrix.raft-enabled }} \ No newline at end of file diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index bf40ca15ac..df3cc00fb8 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -1,4 +1,4 @@ -run-name: Integration tests +name: Integration tests on: workflow_call: