Skip to content

Commit 2b76665

Browse files
committed
ci: updated pipeline to filter src, tests and tests_aws folders
Signed-off-by: Cagri Yonca <cagri@ibm.com>
1 parent e1b8d7c commit 2b76665

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.circleci/config.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ version: 2.1
55
# ruby: circleci/ruby@1.1.2
66

77
commands:
8+
check-if-tests-needed:
9+
steps:
10+
- run:
11+
name: Check if tests need to run
12+
command: |
13+
# If we're on main branch, always run tests
14+
if [ "${CIRCLE_BRANCH}" = "main" ]; then
15+
echo "On main branch - running all tests"
16+
exit 0
17+
fi
18+
19+
# Fetch all the branches
20+
git fetch origin
21+
22+
# Get list of changed files between current branch and main
23+
CHANGED_FILES=$(git diff --name-only origin/main...HEAD)
24+
25+
# Check if any relevant files changed
26+
echo "$CHANGED_FILES" | grep -q -E "^(src/|tests/|tests_aws/)" || {
27+
echo "No changes in src/, tests/, or tests_aws/ directories. Skipping tests."
28+
circleci step halt
29+
}
30+
831
pip-install-deps:
932
parameters:
1033
requirements:
@@ -116,6 +139,7 @@ jobs:
116139
working_directory: ~/repo
117140
steps:
118141
- checkout
142+
- check-if-tests-needed
119143
- pip-install-deps
120144
- run-tests-with-coverage-report
121145
- store-pytest-results
@@ -143,6 +167,7 @@ jobs:
143167
working_directory: ~/repo
144168
steps:
145169
- checkout
170+
- check-if-tests-needed
146171
- pip-install-deps
147172
- run-tests-with-coverage-report
148173
- store-pytest-results
@@ -170,6 +195,7 @@ jobs:
170195
working_directory: ~/repo
171196
steps:
172197
- checkout
198+
- check-if-tests-needed
173199
- pip-install-deps:
174200
requirements: "tests/requirements.txt"
175201
- run-tests-with-coverage-report
@@ -198,6 +224,7 @@ jobs:
198224
working_directory: ~/repo
199225
steps:
200226
- checkout
227+
- check-if-tests-needed
201228
- pip-install-deps:
202229
requirements: "tests/requirements.txt"
203230
- run-tests-with-coverage-report
@@ -226,6 +253,7 @@ jobs:
226253
working_directory: ~/repo
227254
steps:
228255
- checkout
256+
- check-if-tests-needed
229257
- pip-install-deps:
230258
requirements: "tests/requirements.txt"
231259
- run-tests-with-coverage-report
@@ -238,6 +266,7 @@ jobs:
238266
working_directory: ~/repo
239267
steps:
240268
- checkout
269+
- check-if-tests-needed
241270
- pip-install-deps:
242271
requirements: "tests/requirements.txt"
243272
- run-tests-with-coverage-report:
@@ -267,6 +296,7 @@ jobs:
267296
working_directory: ~/repo
268297
steps:
269298
- checkout
299+
- check-if-tests-needed
270300
- pip-install-deps:
271301
requirements: "tests/requirements.txt"
272302
- run-tests-with-coverage-report
@@ -295,6 +325,7 @@ jobs:
295325
working_directory: ~/repo
296326
steps:
297327
- checkout
328+
- check-if-tests-needed
298329
- pip-install-deps:
299330
requirements: "tests/requirements-pre314.txt"
300331
- run-tests-with-coverage-report
@@ -311,6 +342,7 @@ jobs:
311342
working_directory: ~/repo
312343
steps:
313344
- checkout
345+
- check-if-tests-needed
314346
- pip-install-deps:
315347
requirements: "tests/requirements-cassandra.txt"
316348
- run-tests-with-coverage-report:
@@ -325,6 +357,7 @@ jobs:
325357
working_directory: ~/repo
326358
steps:
327359
- checkout
360+
- check-if-tests-needed
328361
- pip-install-deps:
329362
requirements: "tests/requirements.txt"
330363
- store-pytest-results
@@ -336,6 +369,7 @@ jobs:
336369
working_directory: ~/repo
337370
steps:
338371
- checkout
372+
- check-if-tests-needed
339373
- pip-install-deps:
340374
requirements: "tests/requirements-gevent-starlette.txt"
341375
- run-tests-with-coverage-report:

0 commit comments

Comments
 (0)