Skip to content

Commit c55a7e9

Browse files
dmytroyeCopilot
andauthored
[ITEP-71370] Remove Coverity on PRs + Improve BAT workflow (#234)
## 📝 Description Remove Coverity on PRs + Improve BAT workflow This PR removes Coverity static analysis from pull request triggers and enhances the BAT (Basic Acceptance Tests) workflow with draft PR detection. The changes focus on optimizing CI/CD pipeline execution by preventing certain workflows from running on draft PRs and reducing unnecessary analysis on PRs. - Remove Coverity static analysis trigger on pull requests while keeping it for main branch pushes - Add draft PR detection logic to skip BAT workflow execution for draft PRs - Remove push triggers from BAT and CodeQL workflows to focus on PR-based execution <!-- If the PR addresses a specific GitHub issue, include one of the following lines to enable auto-closing: Fixes #<issue_number> Closes #<issue_number> If referencing an internal ticket (e.g. JIRA), include the ticket number instead: JIRA: <project-key>-<ticket-number> If there’s no related issue or ticket, you can skip this section. --> ## ✨ Type of Change Select the type of change your PR introduces: - [ ] 🐞 **Bug fix** – Non-breaking change which fixes an issue - [ ] 🚀 **New feature** – Non-breaking change which adds functionality - [ ] 🔨 **Refactor** – Non-breaking change which refactors the code base - [ ] 💥 **Breaking change** – Changes that break existing functionality - [ ] 📚 **Documentation update** - [ ] 🔒 **Security update** - [x] 🧪 **Tests** - [x] 🚂 **CI** ## 🧪 Testing Scenarios Describe how the changes were tested and how reviewers can test them too: - [ ] ✅ Tested manually - [ ] 🤖 Ran automated end-to-end tests ## ✅ Checklist Before submitting the PR, ensure the following: - [ ] 🔍 PR title is clear and descriptive - [ ] 📝 For internal contributors: If applicable, include the JIRA ticket number (e.g., ITEP-123456) in the PR **title**. Do **not** include full URLs - [ ] 💬 I have commented my code, especially in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ✅ I have added tests that prove my fix is effective or my feature works --------- Co-authored-by: Copilot <[email protected]>
1 parent f13e499 commit c55a7e9

File tree

3 files changed

+54
-8
lines changed

3 files changed

+54
-8
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
push:
2121
branches:
2222
- main
23+
2324
permissions: {}
2425

2526
jobs:

.github/workflows/coverity.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ run-name: "[Code Analysis] Coverity (C/C++)"
88
on:
99
workflow_call: {}
1010
workflow_dispatch: {}
11-
pull_request:
12-
branches:
13-
- main
14-
- release-*
15-
types:
16-
- opened
17-
- synchronize
18-
- reopened
1911
push:
2012
branches:
2113
- main

.github/workflows/tests-bat.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,68 @@ permissions:
4747
contents: read
4848

4949
jobs:
50+
check-pr-state:
51+
name: "Check PR State"
52+
runs-on: ubuntu-latest
53+
outputs:
54+
pr_state: ${{ steps.check_pr.outputs.pr_state }}
55+
steps:
56+
- name: Checkout code
57+
if: ${{ github.event_name == 'pull_request' }}
58+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
with:
60+
fetch-depth: 0
61+
persist-credentials: false
62+
63+
- name: "Set up GitHub CLI"
64+
if: ${{ github.event_name == 'pull_request' }}
65+
run: |
66+
sudo apt-get update && sudo apt-get install gh
67+
68+
- name: "Check PR state"
69+
id: check_pr
70+
if: ${{ github.event_name == 'pull_request' }}
71+
env:
72+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
run: |
74+
PR_NUMBER=${{ github.event.number }}
75+
PR_STATE=$(gh pr view $PR_NUMBER --json isDraft --jq '.isDraft')
76+
echo "pr_state=$PR_STATE" >> $GITHUB_OUTPUT
77+
echo "PR State \"isDraft\": $PR_STATE"
78+
79+
- name: "Return success if triggered manually"
80+
if: ${{ github.event_name == 'workflow_dispatch' }}
81+
run: |
82+
echo "Triggered manually."
83+
exit 0
84+
5085
run-basic-acceptance-tests:
5186
name: "Run Basic Acceptance Tests"
5287
runs-on: [self-hosted]
5388
timeout-minutes: ${{ fromJSON(inputs.timeout || '40') }}
89+
needs: check-pr-state
5490
steps:
91+
- name: "Fail if PR is in draft state"
92+
if: ${{ github.event_name == 'pull_request' && needs.check-pr-state.outputs.pr_state == 'true' }}
93+
run: |
94+
echo "Tests are skipped because the PR is in draft state."
95+
echo "Please mark the PR as ready for review to run the Basic Acceptance Tests."
96+
echo "If you want to run the tests manually, you can use the 'workflow_dispatch' event."
97+
exit 1
98+
99+
- name: Fail if PR has no 'run-bat' label
100+
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'run-bat') }}
101+
run: |
102+
echo "Tests are skipped because the PR does not have the 'run-bat' label."
103+
echo "Please add the 'run-bat' label to run the Basic Acceptance Tests."
104+
echo "If you want to run the tests manually, you can use the 'workflow_dispatch' event."
105+
exit 1
106+
55107
- name: "Checkout Repository"
56108
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57109
with:
58110
fetch-depth: 0
111+
persist-credentials: false
59112

60113
- name: "Remove all Docker images"
61114
if: ${{ github.event.inputs.cleanup == 'true' }}

0 commit comments

Comments
 (0)