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