|
| 1 | +version: 2 |
| 2 | + |
| 3 | +jobs: |
| 4 | + build_and_test_python27: |
| 5 | + docker: |
| 6 | + - image: circleci/python:2.7 |
| 7 | + - image: rabbitmq:3 |
| 8 | + - image: mongo:3.4 |
| 9 | + |
| 10 | + working_directory: ~/repo |
| 11 | + |
| 12 | + environment: |
| 13 | + VIRTUALENV_DIR: "~/virtualenv" |
| 14 | + # Don't install various StackStorm dependencies which are already |
| 15 | + # installed by CI again in the various check scripts |
| 16 | + ST2_INSTALL_DEPS: "0" |
| 17 | + |
| 18 | + steps: |
| 19 | + - checkout |
| 20 | + - restore_cache: |
| 21 | + key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} |
| 22 | + - run: |
| 23 | + name: Download dependencies |
| 24 | + command: | |
| 25 | + git clone -b master git://github.com/stackstorm-exchange/ci.git ~/ci |
| 26 | + ~/ci/.circle/dependencies |
| 27 | + - run: |
| 28 | + name: Run tests (Python 2.7) |
| 29 | + command: ~/ci/.circle/test |
| 30 | + - save_cache: |
| 31 | + key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} |
| 32 | + paths: |
| 33 | + - ~/.cache/pip |
| 34 | + - ~/.apt-cache |
| 35 | + # NOTE: We use virtualenv files from Python 2.7 step in "deploy" job so we |
| 36 | + # only persist paths from this job |
| 37 | + - persist_to_workspace: |
| 38 | + root: / |
| 39 | + paths: |
| 40 | + - home/circleci/ci |
| 41 | + - home/circleci/virtualenv |
| 42 | + - tmp/st2 |
| 43 | + - home/circleci/repo |
| 44 | + - home/circleci/.gitconfig |
| 45 | + |
| 46 | + # NOTE: Until we add "python_version" metadata attribute to pack.yaml and |
| 47 | + # explicitly call which packs work with Python 3.x, Python 3.x failures are |
| 48 | + # not considered fatal |
| 49 | + build_and_test_python36: |
| 50 | + docker: |
| 51 | + - image: circleci/python:3.6 |
| 52 | + - image: rabbitmq:3 |
| 53 | + - image: mongo:3.4 |
| 54 | + |
| 55 | + working_directory: ~/repo |
| 56 | + |
| 57 | + environment: |
| 58 | + VIRTUALENV_DIR: "~/virtualenv" |
| 59 | + # Don't install various StackStorm dependencies which are already |
| 60 | + # installed by CI again in the various check scripts |
| 61 | + ST2_INSTALL_DEPS: "0" |
| 62 | + |
| 63 | + steps: |
| 64 | + - checkout |
| 65 | + - restore_cache: |
| 66 | + key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }} |
| 67 | + - run: |
| 68 | + name: Download dependencies |
| 69 | + # NOTE: We don't want to use default "-e" option because this means |
| 70 | + # step will fail immediately on one of the commands failures and we |
| 71 | + # can't intercept the error and cause non-fatal exit in case pack |
| 72 | + # doesn't declare support for Python 3 |
| 73 | + shell: /bin/bash |
| 74 | + command: | |
| 75 | + git clone -b master git://github.com/stackstorm-exchange/ci.git ~/ci |
| 76 | + ~/ci/.circle/dependencies ; ~/ci/.circle/exit_on_py3_checks $? |
| 77 | + - run: |
| 78 | + name: Run tests (Python 3.6) |
| 79 | + # NOTE: We don't want to use default "-e" option because this means |
| 80 | + # step will fail immediately on one of the commands failures and we |
| 81 | + # can't intercept the error and cause non-fatal exit in case pack |
| 82 | + # doesn't declare support for Python 3 |
| 83 | + shell: /bin/bash |
| 84 | + command: ~/ci/.circle/test ; ~/ci/.circle/exit_on_py3_checks $? |
| 85 | + - save_cache: |
| 86 | + key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }} |
| 87 | + paths: |
| 88 | + - ~/.cache/pip |
| 89 | + - ~/.apt-cache |
| 90 | + |
| 91 | + deploy: |
| 92 | + docker: |
| 93 | + - image: circleci/python:2.7 |
| 94 | + |
| 95 | + working_directory: ~/repo |
| 96 | + |
| 97 | + environment: |
| 98 | + VIRTUALENV_DIR: "~/virtualenv" |
| 99 | + |
| 100 | + steps: |
| 101 | + - checkout |
| 102 | + - restore_cache: |
| 103 | + key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} |
| 104 | + - attach_workspace: |
| 105 | + at: / |
| 106 | + - run: |
| 107 | + name: Install dependencies |
| 108 | + command: sudo apt -y install gmic optipng |
| 109 | + - run: |
| 110 | + # NOTE: We try to retry the script up to 5 times if it fails. The command could fail due |
| 111 | + # to the race (e.g. we try to push changes to index, but index has been updated by some |
| 112 | + # other pack in the mean time) |
| 113 | + name: Update exchange.stackstorm.org |
| 114 | + command: ~/ci/.circle/retry_on_failure.sh ~/ci/.circle/deployment |
| 115 | + |
| 116 | +workflows: |
| 117 | + version: 2 |
| 118 | + # Workflow which runs on each push |
| 119 | + build_test_deploy_on_push: |
| 120 | + jobs: |
| 121 | + - build_and_test_python27 |
| 122 | + - build_and_test_python36 |
| 123 | + - deploy: |
| 124 | + requires: |
| 125 | + - build_and_test_python27 |
| 126 | + filters: |
| 127 | + branches: |
| 128 | + only: master |
| 129 | + build_test_weekly: |
| 130 | + jobs: |
| 131 | + - build_and_test_python27 |
| 132 | + - build_and_test_python36 |
| 133 | + # Workflow which runs nightly - note we don't perform deploy job on nightly |
| 134 | + # build |
| 135 | + triggers: |
| 136 | + # Run nightly build for the pack |
| 137 | + - schedule: |
| 138 | + # NOTE: We run it at 1 am UTC on every Sunday |
| 139 | + cron: "0 1 * * 0" |
| 140 | + filters: |
| 141 | + branches: |
| 142 | + only: |
| 143 | + - master |
0 commit comments