diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100755 index 0000000..9eecffa --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,143 @@ +version: 2 + +jobs: + build_and_test_python27: + docker: + - image: circleci/python:2.7 + - image: rabbitmq:3 + - image: mongo:3.4 + + working_directory: ~/repo + + environment: + VIRTUALENV_DIR: "~/virtualenv" + # Don't install various StackStorm dependencies which are already + # installed by CI again in the various check scripts + ST2_INSTALL_DEPS: "0" + + steps: + - checkout + - restore_cache: + key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} + - run: + name: Download dependencies + command: | + git clone -b master git://github.com/stackstorm-exchange/ci.git ~/ci + ~/ci/.circle/dependencies + - run: + name: Run tests (Python 2.7) + command: ~/ci/.circle/test + - save_cache: + key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} + paths: + - ~/.cache/pip + - ~/.apt-cache + # NOTE: We use virtualenv files from Python 2.7 step in "deploy" job so we + # only persist paths from this job + - persist_to_workspace: + root: / + paths: + - home/circleci/ci + - home/circleci/virtualenv + - tmp/st2 + - home/circleci/repo + - home/circleci/.gitconfig + + # NOTE: Until we add "python_version" metadata attribute to pack.yaml and + # explicitly call which packs work with Python 3.x, Python 3.x failures are + # not considered fatal + build_and_test_python36: + docker: + - image: circleci/python:3.6 + - image: rabbitmq:3 + - image: mongo:3.4 + + working_directory: ~/repo + + environment: + VIRTUALENV_DIR: "~/virtualenv" + # Don't install various StackStorm dependencies which are already + # installed by CI again in the various check scripts + ST2_INSTALL_DEPS: "0" + + steps: + - checkout + - restore_cache: + key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }} + - run: + name: Download dependencies + # NOTE: We don't want to use default "-e" option because this means + # step will fail immediately on one of the commands failures and we + # can't intercept the error and cause non-fatal exit in case pack + # doesn't declare support for Python 3 + shell: /bin/bash + command: | + git clone -b master git://github.com/stackstorm-exchange/ci.git ~/ci + ~/ci/.circle/dependencies ; ~/ci/.circle/exit_on_py3_checks $? + - run: + name: Run tests (Python 3.6) + # NOTE: We don't want to use default "-e" option because this means + # step will fail immediately on one of the commands failures and we + # can't intercept the error and cause non-fatal exit in case pack + # doesn't declare support for Python 3 + shell: /bin/bash + command: ~/ci/.circle/test ; ~/ci/.circle/exit_on_py3_checks $? + - save_cache: + key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }} + paths: + - ~/.cache/pip + - ~/.apt-cache + + deploy: + docker: + - image: circleci/python:2.7 + + working_directory: ~/repo + + environment: + VIRTUALENV_DIR: "~/virtualenv" + + steps: + - checkout + - restore_cache: + key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} + - attach_workspace: + at: / + - run: + name: Install dependencies + command: sudo apt -y install gmic optipng + - run: + # NOTE: We try to retry the script up to 5 times if it fails. The command could fail due + # to the race (e.g. we try to push changes to index, but index has been updated by some + # other pack in the mean time) + name: Update exchange.stackstorm.org + command: ~/ci/.circle/retry_on_failure.sh ~/ci/.circle/deployment + +workflows: + version: 2 + # Workflow which runs on each push + build_test_deploy_on_push: + jobs: + - build_and_test_python27 + - build_and_test_python36 + - deploy: + requires: + - build_and_test_python27 + filters: + branches: + only: master + build_test_weekly: + jobs: + - build_and_test_python27 + - build_and_test_python36 + # Workflow which runs nightly - note we don't perform deploy job on nightly + # build + triggers: + # Run nightly build for the pack + - schedule: + # NOTE: We run it at 1 am UTC on every Sunday + cron: "0 1 * * 0" + filters: + branches: + only: + - master diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..af98588 --- /dev/null +++ b/.gitignore @@ -0,0 +1,98 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +./lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# IPython Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# dotenv +.env + +# virtualenv +venv/ +ENV/ + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject + +# Mr Developer +.idea +.DS_Store +._* +.vscode +*.sublime-project +*.sublime-workspace# PyCharm +.idea