这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,9 @@ dependencies:
cache_directories:
- "~/docker"
override:
# need to add the dokku user to the docker group
- sudo -E CI=true make -e sshcommand
- sudo usermod -G docker dokku
- sudo -E CI=true DOCKER_VERSION=1.5.0 make -e install: { timeout: 300 }
- make -e ci-dependencies
#### circle does some weird *expletive* with regards to root and gh auth (needed for gitsubmodules test)
- sudo rsync -a ~ubuntu/.ssh/ ~root/.ssh/
- sudo chown -R root:root ~root/.ssh/
- sudo sed -e 's:/home/ubuntu:/root:g' ~root/.ssh/config
####
- sudo -E make -e setup-deploy-tests
- ./tests/ci/parallel_runner.sh setup: { timeout: 300 }
post:
- sudo -E make -e lint
test:
override:
- ./tests/ci/parallel_runner.sh: { parallel: true, timeout: 1800 }
- ./tests/ci/parallel_runner.sh testing: { parallel: true, timeout: 1800 }
5 changes: 4 additions & 1 deletion tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ lint:

unit-tests:
@echo running unit tests...
ifndef UNIT_TEST_BATCH
@$(QUIET) bats tests/unit
else
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
endif

deploy-test-clojure:
@echo deploying config app...
Expand Down Expand Up @@ -125,7 +129,6 @@ deploy-test-static:

deploy-tests:
@echo running deploy tests...
# @$(QUIET) bats tests/deploy
@$(QUIET) $(MAKE) deploy-test-config
@$(QUIET) $(MAKE) deploy-test-clojure
@$(QUIET) $(MAKE) deploy-test-dockerfile
Expand Down
40 changes: 33 additions & 7 deletions tests/ci/parallel_runner.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
#!/usr/bin/env bash

MODE="$1"; MODE=${MODE:="testing"}

setup_circle() {
MAKE_ENV="CI=true DOCKER_VERSION=1.5.0"
[[ "$1" == "buildstack" ]] && MAKE_ENV+=" BUILD_STACK=true "
echo "setting up with MAKE_ENV: $MAKE_ENV"
sudo -E CI=true make -e sshcommand
# need to add the dokku user to the docker group
sudo usermod -G docker dokku
#### circle does some weird *expletive* with regards to root and gh auth (needed for gitsubmodules test)
sudo rsync -a ~ubuntu/.ssh/ ~root/.ssh/
sudo chown -R root:root ~root/.ssh/
sudo sed --in-place 's:/home/ubuntu:/root:g' ~root/.ssh/config
####
sudo -E $MAKE_ENV make -e install
sudo -E make -e setup-deploy-tests
make -e ci-dependencies
}

case "$CIRCLE_NODE_INDEX" in
0)
echo "=====> make unit-tests"
sudo -E make -e unit-tests
echo "=====> make unit-tests (1/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
sudo -E UNIT_TEST_BATCH=1 make -e unit-tests
;;

1)
echo "=====> make deploy-tests (buildstep release)"
sudo -E make -e deploy-tests
echo "=====> make unit-tests (2/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
sudo -E UNIT_TEST_BATCH=2 make -e unit-tests
;;

2)
echo "=====> make deploy-tests (buildstep master)"
docker rmi -f progrium/buildstep && \
sudo -E BUILD_STACK=true make -e stack && \
echo "=====> make deploy-tests (buildstep release) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
sudo -E make -e deploy-tests
;;

3)
echo "=====> make deploy-tests (buildstep master) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
[[ "$MODE" == "setup" ]] && setup_circle buildstack && exit 0
sudo -E make -e deploy-tests
;;
esac
37 changes: 37 additions & 0 deletions tests/ci/unit_test_runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

is_number() {
local NUMBER=$1; local NUM_RE='^[0-9]+$'
if [[ $NUMBER =~ $NUM_RE ]];then
return 0
else
return 1
fi
}

usage() {
echo "usage: $0 1|2"
exit 0
}

BATCH_NUM="$1"
is_number $BATCH_NUM || usage

TESTS=($(find "$(dirname $0)"/../unit -maxdepth 1 -name "*.bats"))
HALF_TESTS=$(( ${#TESTS[@]} / 2 ))
FIRST_HALF=("${TESTS[@]:0:${HALF_TESTS}}")
LAST_HALF=("${TESTS[@]:${HALF_TESTS}:${#TESTS[@]}}")

case "$BATCH_NUM" in
1)
bats "${FIRST_HALF[@]}"
;;

2)
bats "${LAST_HALF[@]}"
;;

*)
usage
;;
esac
10 changes: 0 additions & 10 deletions tests/deploy/config.bats

This file was deleted.

10 changes: 0 additions & 10 deletions tests/deploy/gitsubmodules.bats

This file was deleted.

10 changes: 0 additions & 10 deletions tests/deploy/go.bats

This file was deleted.

10 changes: 0 additions & 10 deletions tests/deploy/java.bats

This file was deleted.

10 changes: 0 additions & 10 deletions tests/deploy/multi.bats

This file was deleted.

10 changes: 0 additions & 10 deletions tests/deploy/nodejs-express.bats

This file was deleted.

11 changes: 0 additions & 11 deletions tests/deploy/php.bats

This file was deleted.

10 changes: 0 additions & 10 deletions tests/deploy/python-flask.bats

This file was deleted.

11 changes: 0 additions & 11 deletions tests/deploy/static.bats

This file was deleted.