Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 144c9a1

Browse files
committed
add 'run in testbed' shortcut shell script:
- to avoid long, hard-to-read tasks in the circle.yml
1 parent bc5b4e1 commit 144c9a1

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

circle.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ dependencies:
1616
post:
1717
- npm run cibuild
1818
- docker run -d --name mytestbed -v $PWD:/var/www/streambed/image_server/plotly.js -p 9010:9010 plotly/testbed:latest
19-
- sudo lxc-attach -n "$(docker inspect --format '{{.Id}}' mytestbed)" -- bash -c "cp -f /var/www/streambed/image_server/plotly.js/test/image/index.html /var/www/streambed/image_server/server_app/index.html"
19+
- sudo ./tasks/run_in_testbed.sh mytestbed "cp -f test/image/index.html ../server_app/index.html"
2020
- wget --server-response --spider --tries=8 --retry-connrefused http://localhost:9010/ping
2121
test:
2222
override:
23-
- sudo lxc-attach -n "$(docker inspect --format '{{.Id}}' mytestbed)" -- bash -c "cd /var/www/streambed/image_server/plotly.js && node test/image/compare_pixels_test.js"
24-
- sudo lxc-attach -n "$(docker inspect --format '{{.Id}}' mytestbed)" -- bash -c "cd /var/www/streambed/image_server/plotly.js && node test/image/export_test.js"
23+
- sudo ./tasks/run_in_testbed.sh mytestbed "node test/image/compare_pixels_test.js"
24+
- sudo ./tasks/run_in_testbed.sh mytestbed "node test/image/export_test.js"
2525
- npm run citest-jasmine
2626
- npm run test-bundle
2727
- npm run test-syntax

tasks/run_in_testbed.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#! /bin/bash
2+
#
3+
# Useful shortcut to run command inside the `testbed` docker container
4+
# on CircleCI.
5+
#
6+
# ===============================================================================
7+
8+
ID="$1"
9+
CMD="$2"
10+
11+
CONTAINER="$(docker inspect --format '{{.Id}}' $ID)"
12+
REPOPATH="/var/www/streambed/image_server/plotly.js"
13+
14+
lxc-attach -n $CONTAINER -- bash -c "cd $REPOPATH && $CMD"

0 commit comments

Comments
 (0)