diff --git a/.circleci/config.yml b/.circleci/config.yml index 48a0973..e74646a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,114 +1,49 @@ version: 2.1 -# Define executors -executors: - node-executor: - docker: - - image: cimg/node:18.17 - working_directory: ~/project -# Define jobs -jobs: - # Job that always runs - test: - executor: node-executor - steps: - - checkout - - run: - name: Run tests - command: echo "run test" - - run: - name: Run linting - command: echo "run linting" - - # Job that always runs - build: - executor: node-executor - steps: - - checkout - - - run: - name: Run tests - command: echo "run test" - - run: - name: Run linting - command: echo "run linting" - - # Conditional job - only runs on main branch - deploy: - executor: node-executor - steps: - - run: - name: Deploy to production - command: | - echo "Deploying to production..." - # Add your deployment commands here - # e.g., aws s3 sync dist/ s3://my-bucket/ - # e.g., kubectl apply -f k8s/ - echo "Deployment completed!" +orbs: + slack: circleci/slack@4.12.5 - # Another conditional job - only runs on feature branches - integration-test: - executor: node-executor - steps: - - run: - name: Run integration tests - command: | - echo "Running integration tests..." - # Add integration test commands here - - -# Define workflows workflows: - version: 2 - build-test-deploy: + my-workflow: jobs: - # These jobs run on every commit - - test - - build: - requires: - - test - - # Conditional job: Deploy only runs on main branch - - deploy: - requires: - - build - filters: - branches: - only: main - - # Conditional job: Integration tests only run on feature branches - - integration-test: + - build + - test: requires: - build - filters: - branches: - ignore: - - main - - develop - - # Alternative workflow that runs only on tags - release: - jobs: - - test: - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ - - build: + - deploy: requires: - test - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ - - deploy: + # This job runs if any upstream job fails + - notify-on-failure: requires: - - build - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ - + - build: failed + + +jobs: + build: + docker: + - image: cimg/base:stable + steps: + - run: echo "Building..." + # Uncomment to test failure behavior: + - run: wqr + + test: + docker: + - image: cimg/base:stable + steps: + - run: echo "Testing..." + + deploy: + docker: + - image: cimg/base:stable + steps: + - run: echo "Deploying..." + + notify-on-failure: + docker: + - image: cimg/base:stable + steps: + - slack/notify: + event: always + template: basic_fail_1