uktrade/directory-components

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
version: 2
jobs:
  test:
    docker:
      - image: cimg/python:3.9.13
    steps:
      - checkout
      - restore_cache:
          key: v1-deps-{{ checksum "setup.py" }}
      - run:
          command: |
            python3 -m venv .venv
            . .venv/bin/activate
            make install_requirements
      - run:
          command: |
            pip install pytest==6.2.1
      - save_cache:
          key: v1-deps-{{ checksum "setup.py" }}
          paths:
            - "venv"
      - run:
          command: |
            . .venv/bin/activate
            make pytest_codecov -- --codecov-token=${CODECOV_TOKEN}
            codecov
            
  flake8:
    docker:
      - image: cimg/python:3.9.13
    steps:
      - checkout
      - run:
          name: Run flake8
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install flake8
            make flake8

  sasslint:
    docker:
      - image: circleci/node:8.5.0
    steps:
      - checkout
      - restore_cache:
          key: v1-deps-{{ checksum "package.json" }}
      - run:
          name: Install node modules
          command: npm install
      - save_cache:
          key: v1-deps-{{ checksum "package.json" }}
          paths:
            - "node_modules"
      - run:
          name: Run sass lint
          command: |
            npm rebuild node-sass
            node_modules/.bin/gulp lint:sass

  deploy_to_dev:
    docker:
      - image: cimg/python:3.9.13
    steps:
      - checkout
      - run:
          command: |
            python3 -m venv .venv
            . .venv/bin/activate
            make install_requirements
            make publish

  test_javascript:
    docker:
      - image: circleci/node:8.5.0
    steps:
      - checkout
      - restore_cache:
          key: v1-deps-{{ checksum "package.json" }}
      - run:
          name: Install node modules
          command: npm install
      - save_cache:
          key: v1-deps-{{ checksum "package.json" }}
          paths:
            - "node_modules"
      - run:
          name: Run Javascript tests
          command: |
            npm rebuild node-sass
            npm test

workflows:
  version: 2
  test_and_deploy_to_dev:
    jobs:
      - flake8
      - sasslint
      - test
      - test_javascript
      - deploy_to_dev:
          requires:
            - flake8
            - sasslint
            - test
            - test_javascript
          filters:
            branches:
              only: master