Skip to content

Commit

Permalink
ci: updated pipeline to filter src, tests and tests_aws folders
Browse files Browse the repository at this point in the history
Signed-off-by: Cagri Yonca <[email protected]>
  • Loading branch information
CagriYonca committed Dec 12, 2024
1 parent e1b8d7c commit d4f444e
Showing 1 changed file with 104 additions and 10 deletions.
114 changes: 104 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ version: 2.1
# ruby: circleci/[email protected]

commands:
check-if-tests-needed:
steps:
- run:
name: Check if tests need to run
command: |
# Fetch all the branches
git fetch origin
# Get list of changed files between current branch and main
CHANGED_FILES=$(git diff --name-only origin/main...HEAD)
# Check if any relevant files changed
echo "$CHANGED_FILES" | grep -q -E "^(src/|tests/|tests_aws/)" || {
echo "No changes in src/, tests/, or tests_aws/ directories. Skipping tests."
circleci step halt
}
pip-install-deps:
parameters:
requirements:
Expand Down Expand Up @@ -116,6 +133,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps
- run-tests-with-coverage-report
- store-pytest-results
Expand Down Expand Up @@ -143,6 +161,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps
- run-tests-with-coverage-report
- store-pytest-results
Expand Down Expand Up @@ -170,6 +189,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run-tests-with-coverage-report
Expand Down Expand Up @@ -198,6 +218,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run-tests-with-coverage-report
Expand Down Expand Up @@ -226,6 +247,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run-tests-with-coverage-report
Expand All @@ -238,6 +260,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run-tests-with-coverage-report:
Expand Down Expand Up @@ -267,6 +290,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run-tests-with-coverage-report
Expand Down Expand Up @@ -295,6 +319,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements-pre314.txt"
- run-tests-with-coverage-report
Expand All @@ -311,6 +336,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements-cassandra.txt"
- run-tests-with-coverage-report:
Expand All @@ -325,6 +351,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- store-pytest-results
Expand All @@ -336,6 +363,7 @@ jobs:
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements-gevent-starlette.txt"
- run-tests-with-coverage-report:
Expand All @@ -350,16 +378,76 @@ workflows:
version: 2
build:
jobs:
- python38
- python39
- python310
- python311
- python312
- python313
- python314
- py39cassandra
- py39gevent_starlette
- py312aws
- python38:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- python39:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- python310:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- python311:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- python312:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- python313:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- python314:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- py39cassandra:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- py39gevent_starlette:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- py312aws:
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/
- final_job:
requires:
- python38
Expand All @@ -373,3 +461,9 @@ workflows:
- py39cassandra
- py39gevent_starlette
- py312aws
filters:
branches:
only: /.*/
ignore: []
tags:
only: /.*/

0 comments on commit d4f444e

Please sign in to comment.