Your IP : 216.73.216.91


Current Path : /var/node/inatote/Inatote-Backend/node_modules/snyk-python-plugin/.circleci/
Upload File :
Current File : /var/node/inatote/Inatote-Backend/node_modules/snyk-python-plugin/.circleci/config.yml

version: 2.1

defaults: &defaults
  docker:
    - image: node:10
  working_directory: ~/snyk-python-plugin

commands:
  checkout_and_merge:
    steps:
      - checkout
      - run:
          name: Checkout master
          command: git checkout origin/master
      - run:
          name: Merge test branch
          command: |
            git config user.name "CircleCI"
            git config user.email "noop"
            git merge --no-edit "$CIRCLE_BRANCH"
      - attach_workspace:
          at: ~/snyk-python-plugin
  test_python:
    parameters:
      pip_version:
        type: string
      python_version:
        type: string
    steps:
      - checkout_and_merge
      - attach_workspace:
          at: ~/snyk-python-plugin
      - run:
          name: Run tests
          command: |
            apt -qq update
            apt -qq install python3-pip python-pip -y &> /dev/null
            curl https://pyenv.run | $SHELL
            export PATH="/root/.pyenv/bin:$PATH"
            eval "$(pyenv init -)"
            eval "$(pyenv virtualenv-init -)"
            export PYTHON_VER_FULL=`pyenv install --list | grep -v 'Available versions' | awk '{$1=$1};1' | grep "^$PYTHON_VER\.[0-9]\+$" | tail -1`
            echo $PYTHON_VER_FULL
            # Install the specific release of Python if it isn't already installed
            pyenv install -s $PYTHON_VER_FULL
            pyenv sh-shell $PYTHON_VER_FULL
            python --version
            export PATH=$HOME/.local/bin:$PATH
            python -m pip install --user --quiet pip==$PIP_VER
            # Call `pyenv rehash` to avoid issues after installing a new version of pip.
            # see: https://github.com/pyenv/pyenv/issues/1141#issuecomment-383092896
            pyenv sh-rehash
            python -m pip --version
            python -m pip install --user --quiet -r dev-requirements.txt --disable-pip-version-check
            npm run test
          environment:
            PIP_VER: << parameters.pip_version >>
            PYTHON_VER: << parameters.python_version >>

jobs:
  install:
    <<: *defaults
    environment:
      NODE_ENV: develop # Required because base image sets it to 'production'
    steps:
      - checkout_and_merge
      - run:
          name: Use snyk-main npmjs user
          command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
      - run:
          name: Install Node dependencies
          command: npm install
      - persist_to_workspace:
          root: .
          paths:
            - node_modules/
  lint:
    <<: *defaults
    steps:
      - checkout_and_merge
      - run:
          name: Run linting tasks
          command: npm run lint
  test:
    <<: *defaults
    parameters:
      node_version:
        type: string
      pip_version:
        type: string
      python_version:
        type: string
    docker:
      - image: node:<< parameters.node_version >>
    steps:
      - test_python:
          pip_version: << parameters.pip_version >>
          python_version: << parameters.python_version >>
  build:
    <<: *defaults
    steps:
      - checkout_and_merge
      - run:
          name: Use snyk-main npmjs user
          command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
      - run:
          name: Install dependencies
          command: npm install
      - run:
          name: Run tests
          command: npm run build
  release:
    <<: *defaults
    docker:
      - image: node:10
    steps:
      - checkout_and_merge
      - run:
          name: Install deps
          command: npm install
      - run:
          name: Build
          command: npm run build
      - run:
          name: Release
          command: npx semantic-release

workflows:
  version: 2
  test_and_release:
    jobs:
      - install:
          name: Install
          filters:
            branches:
              ignore:
                - master
      - lint:
          name: Lint
          requires:
            - Install
          filters:
            branches:
              ignore:
                - master
      - build:
          name: Build
          requires:
            - Install
          filters:
            branches:
              ignore:
                - master
      - test:
          name: Node << matrix.node_version >>, Python << matrix.python_version >>, Pip << matrix.pip_version >>
          requires:
            - Lint
            - Build
          matrix:
            parameters:
              node_version: ['10','12', '14']
              pip_version: ['9.0.3','10.0.0','18.1.0']
              python_version: ['2.7','3.6', '3.7', '3.8', '3.9']
          filters:
            branches:
              ignore:
                - master
      - release:
          name: Release
          context: nodejs-lib-release
          filters:
            branches:
              only:
                - master