Skip to content

Commit

Permalink
Merge pull request #101 from cognifloyd/custom-pack-deps-script
Browse files Browse the repository at this point in the history
Custom pack deps script
  • Loading branch information
cognifloyd authored Sep 14, 2021
2 parents af25abe + 1a45169 commit 553be07
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .circle/circle.yml.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# WARNING: Minimize edits to this file!
#
# This file is part of the CI infrastructure for the StackStorm-Exchange.
# As such, it gets overwritten periodically in CI infrastructure updates.
# Check out `tests/setup_testing_env.sh` for how to customize the test env.
# If you need to add jobs, docker images, or other changes that do not work
# in `tests/setup_testing_env.sh`, then please add what you need and avoid
# changing the standard build_and_test and deploy jobs.
#
# Thanks for your contribution!
---
version: 2

jobs:
Expand Down
8 changes: 8 additions & 0 deletions .circle/dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ echo "Installing StackStorm runners and registering metrics drivers"
if [[ -n "${ROOT_DIR}" ]]; then
PACK_REQUIREMENTS_FILE="${ROOT_DIR}/requirements.txt"
PACK_TESTS_REQUIREMENTS_FILE="${ROOT_DIR}/requirements-tests.txt"
PACK_SETUP_TESTING_ENV="${ROOT_DIR}/tests/setup_testing_env.sh"

echo "Copying Makefile to ${ROOT_DIR}"
cp ~/ci/.circle/Makefile ${ROOT_DIR}
make -C requirements-ci .install-runners
else
PACK_REQUIREMENTS_FILE="$(pwd)/requirements.txt"
PACK_TESTS_REQUIREMENTS_FILE="$(pwd)/requirements-tests.txt"
PACK_SETUP_TESTING_ENV="$(pwd)/tests/setup_testing_env.sh"

echo "Copying Makefile to $(pwd)"
cp ~/ci/.circle/Makefile .
Expand All @@ -81,5 +83,11 @@ if [[ -f "${PACK_TESTS_REQUIREMENTS_FILE}" ]]; then
~/virtualenv/bin/pip install -r "${PACK_TESTS_REQUIREMENTS_FILE}"
fi

# Install custom pack testing enviornment
if [[ -x "${PACK_SETUP_TESTING_ENV}" ]]; then
echo "Setting up custom pack testing environment with ${PACK_SETUP_TESTING_ENV}"
"${PACK_SETUP_TESTING_ENV}"
fi

echo "Installed dependencies:"
pip list
15 changes: 15 additions & 0 deletions .circle/setup_testing_env.sh.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# For python deps, please use requirements.txt or requirements-test.txt.
# Do not install python requirements with this script.

# Some packs need to install and configure additional packages to properly
# run their test suite. Other packs need to clone other repositories to
# reuse standardized testing infrastructure. And other functional or end-to-end
# tests might need additional system setup to access external APIs via
# an enterprise bus or something else.
# That is the purpose of this script. Setup the testing environment
# to do mock-less regression or end-to-end testing.

# This script is called by `deployment` housed in StackStorm-exchange/ci.
# `deployment` will only run this script if it is executable.
5 changes: 5 additions & 0 deletions utils/exchange-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ git add .circleci/config.yml
curl -sS --fail "https://raw.githubusercontent.com/StackStorm-Exchange/ci/master/files/.gitignore.sample" > .gitignore
git add .gitignore

mkdir tests
curl -sS --fail "https://raw.githubusercontent.com/StackStorm-Exchange/ci/master/.circle/setup_testing_env.sh.sample" > tests/setup_testing_env.sh
# no execute bit until pack-author enables it.
git add tests/setup_testing_env.sh

git commit -m "Bootstrap a StackStorm Exchange pack repository for pack ${PACK}."
git push origin master

Expand Down

0 comments on commit 553be07

Please sign in to comment.