From a1e0ce4d7ddd2700dd28aed2cb96261d4475af14 Mon Sep 17 00:00:00 2001 From: Alexander Simmerl Date: Thu, 30 Mar 2017 11:45:03 +0200 Subject: [PATCH 1/6] Cache npm directory --- circle.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index bc68ef7..baaecb7 100644 --- a/circle.yml +++ b/circle.yml @@ -5,12 +5,13 @@ machine: version: 7.7.4 services: - docker - - redis - postgresql + - redis dependencies: cache_directories: - "/home/ubuntu/.go_workspace" - "/home/ubuntu/.gimme" + - "/home/ubuntu/.npm" override: - ./infrastructure/scripts/dependencies pre: From 89db7f5566f18a44ce33156623c8ab44d71da41a Mon Sep 17 00:00:00 2001 From: Alexander Simmerl Date: Thu, 30 Mar 2017 12:59:52 +0200 Subject: [PATCH 2/6] Separate tests paths --- circle.yml | 3 ++- infrastructure/scripts/dependencies | 19 +++++++++++-------- infrastructure/scripts/execute-elm-tests | 8 ++++++++ .../{execute-tests => execute-go-tests} | 0 4 files changed, 21 insertions(+), 9 deletions(-) create mode 100755 infrastructure/scripts/execute-elm-tests rename infrastructure/scripts/{execute-tests => execute-go-tests} (100%) diff --git a/circle.yml b/circle.yml index baaecb7..3a9f74e 100644 --- a/circle.yml +++ b/circle.yml @@ -21,7 +21,8 @@ database: - PGPASSWORD=unicode psql -U ubuntu -d circle_test -f platform/pg/setup.sql -h 127.0.0.1 test: override: - - ./infrastructure/scripts/execute-tests + - ./infrastructure/scripts/execute-go-tests + - ./infrastructure/scripts/execute-elm-tests deployment: docker: branch: master diff --git a/infrastructure/scripts/dependencies b/infrastructure/scripts/dependencies index ecc6abd..cb85d87 100755 --- a/infrastructure/scripts/dependencies +++ b/infrastructure/scripts/dependencies @@ -7,22 +7,25 @@ echo "|> install gimme" sudo curl -sL -o /usr/local/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme sudo chmod +x /usr/local/bin/gimme -echo "|> install go" +echo "|> install Go" gimme 1.7.5 source ~/.gimme/envs/go1.7.5.env +echo "|> install static asset tool" +go get github.com/mjibson/esc + +echo "|> install Elm tooling" +npm install -g elm +npm install -g elm-test + echo "|> prepare directories" mkdir -p /home/ubuntu/.go_workspace/src/github.com/tapglue rm -rf /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas cp -R /home/ubuntu/snaas /home/ubuntu/.go_workspace/src/github.com/tapglue/ -echo "|> install packages" +echo "|> install Go packages" cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas go get -d -v ./... -echo "|> install static asset tool" -go get github.com/mjibson/esc - -echo "|> install Elm tooling" -npm install -g elm -npm install -g elm-test \ No newline at end of file +echo "|> install Elm packages" +elm-package install -y \ No newline at end of file diff --git a/infrastructure/scripts/execute-elm-tests b/infrastructure/scripts/execute-elm-tests new file mode 100755 index 0000000..0626667 --- /dev/null +++ b/infrastructure/scripts/execute-elm-tests @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +echo "|> execute Elm tests" +cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas/cmd/console +make test diff --git a/infrastructure/scripts/execute-tests b/infrastructure/scripts/execute-go-tests similarity index 100% rename from infrastructure/scripts/execute-tests rename to infrastructure/scripts/execute-go-tests From c8b225dc16bb37e43141a04294236c83830b5b03 Mon Sep 17 00:00:00 2001 From: Alexander Simmerl Date: Thu, 30 Mar 2017 13:03:49 +0200 Subject: [PATCH 3/6] Invoke from correct directory --- infrastructure/scripts/dependencies | 1 + infrastructure/scripts/execute-go-tests | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/infrastructure/scripts/dependencies b/infrastructure/scripts/dependencies index cb85d87..b4f7f55 100755 --- a/infrastructure/scripts/dependencies +++ b/infrastructure/scripts/dependencies @@ -28,4 +28,5 @@ cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas go get -d -v ./... echo "|> install Elm packages" +cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas/cmd/console elm-package install -y \ No newline at end of file diff --git a/infrastructure/scripts/execute-go-tests b/infrastructure/scripts/execute-go-tests index 83d20e6..46d0f31 100755 --- a/infrastructure/scripts/execute-go-tests +++ b/infrastructure/scripts/execute-go-tests @@ -30,7 +30,3 @@ go test \ -tags integration \ ./service/... \ -postgres.url="postgres://ubuntu:unicode@127.0.0.1/circle_test?sslmode-disable" - -echo "|> execute Elm tests" -cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas/cmd/console -make test From ae70dc0fd2394b8277a18d5dc62cd379880cbe84 Mon Sep 17 00:00:00 2001 From: Alexander Simmerl Date: Thu, 30 Mar 2017 13:13:00 +0200 Subject: [PATCH 4/6] Force right amount of cpus used for Elm --- circle.yml | 1 + infrastructure/scripts/dependencies | 9 +++++++++ infrastructure/scripts/execute-elm-tests | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 3a9f74e..766e79f 100644 --- a/circle.yml +++ b/circle.yml @@ -12,6 +12,7 @@ dependencies: - "/home/ubuntu/.go_workspace" - "/home/ubuntu/.gimme" - "/home/ubuntu/.npm" + - "/home/ubuntu/sysconfcpus" override: - ./infrastructure/scripts/dependencies pre: diff --git a/infrastructure/scripts/dependencies b/infrastructure/scripts/dependencies index b4f7f55..4f9cf67 100755 --- a/infrastructure/scripts/dependencies +++ b/infrastructure/scripts/dependencies @@ -18,6 +18,15 @@ echo "|> install Elm tooling" npm install -g elm npm install -g elm-test +echo "|> install sysconf" +if [ ! -d sysconfcpus/bin ]; +then + git clone https://github.com/obmarg/libsysconfcpus.git + cd libsysconfcpus + ./configure --prefix=/home/ubuntu/sysconfcpus + make && make install +fi + echo "|> prepare directories" mkdir -p /home/ubuntu/.go_workspace/src/github.com/tapglue rm -rf /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas diff --git a/infrastructure/scripts/execute-elm-tests b/infrastructure/scripts/execute-elm-tests index 0626667..ae45714 100755 --- a/infrastructure/scripts/execute-elm-tests +++ b/infrastructure/scripts/execute-elm-tests @@ -5,4 +5,4 @@ set -o pipefail echo "|> execute Elm tests" cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas/cmd/console -make test +/home/ubuntu/sysconfcpus/bin/sysconfcpus -n 2 make test From ceff5a0d0cd709cd99831149cf73f437d8a40623 Mon Sep 17 00:00:00 2001 From: Alexander Simmerl Date: Thu, 30 Mar 2017 16:33:21 +0200 Subject: [PATCH 5/6] Cache sysconfcpus sources --- circle.yml | 1 + infrastructure/scripts/dependencies | 1 + 2 files changed, 2 insertions(+) diff --git a/circle.yml b/circle.yml index 766e79f..d7af27a 100644 --- a/circle.yml +++ b/circle.yml @@ -12,6 +12,7 @@ dependencies: - "/home/ubuntu/.go_workspace" - "/home/ubuntu/.gimme" - "/home/ubuntu/.npm" + - "/home/ubuntu/libsysconfcpus" - "/home/ubuntu/sysconfcpus" override: - ./infrastructure/scripts/dependencies diff --git a/infrastructure/scripts/dependencies b/infrastructure/scripts/dependencies index 4f9cf67..3f3a0dc 100755 --- a/infrastructure/scripts/dependencies +++ b/infrastructure/scripts/dependencies @@ -19,6 +19,7 @@ npm install -g elm npm install -g elm-test echo "|> install sysconf" +cd /home/ubuntu if [ ! -d sysconfcpus/bin ]; then git clone https://github.com/obmarg/libsysconfcpus.git From 8ca35d3f076e4d5c4158d7e928937efcde11ac30 Mon Sep 17 00:00:00 2001 From: Alexander Simmerl Date: Thu, 30 Mar 2017 16:43:20 +0200 Subject: [PATCH 6/6] Cache test packages --- circle.yml | 1 + infrastructure/scripts/dependencies | 8 ++++---- infrastructure/scripts/execute-elm-tests | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/circle.yml b/circle.yml index d7af27a..5d51a9f 100644 --- a/circle.yml +++ b/circle.yml @@ -14,6 +14,7 @@ dependencies: - "/home/ubuntu/.npm" - "/home/ubuntu/libsysconfcpus" - "/home/ubuntu/sysconfcpus" + - "/home/ubuntu/snaas/cmd/console/tests/elm-stuff" override: - ./infrastructure/scripts/dependencies pre: diff --git a/infrastructure/scripts/dependencies b/infrastructure/scripts/dependencies index 3f3a0dc..f440259 100755 --- a/infrastructure/scripts/dependencies +++ b/infrastructure/scripts/dependencies @@ -28,6 +28,10 @@ then make && make install fi +echo "|> install Elm packages" +cd /home/ubuntu/snaas/cmd/console/tests +elm-package install -y + echo "|> prepare directories" mkdir -p /home/ubuntu/.go_workspace/src/github.com/tapglue rm -rf /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas @@ -36,7 +40,3 @@ cp -R /home/ubuntu/snaas /home/ubuntu/.go_workspace/src/github.com/tapglue/ echo "|> install Go packages" cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas go get -d -v ./... - -echo "|> install Elm packages" -cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas/cmd/console -elm-package install -y \ No newline at end of file diff --git a/infrastructure/scripts/execute-elm-tests b/infrastructure/scripts/execute-elm-tests index ae45714..d57c0ce 100755 --- a/infrastructure/scripts/execute-elm-tests +++ b/infrastructure/scripts/execute-elm-tests @@ -4,5 +4,5 @@ set -e set -o pipefail echo "|> execute Elm tests" -cd /home/ubuntu/.go_workspace/src/github.com/tapglue/snaas/cmd/console +cd /home/ubuntu/snaas/cmd/console /home/ubuntu/sysconfcpus/bin/sysconfcpus -n 2 make test