Created
December 15, 2016 08:59
-
-
Save oreoshake/0bbc278f0fdfd054ba27a0f5e9ca0a10 to your computer and use it in GitHub Desktop.
A smarter Dockerfile and more containers when testing. Takes 50% as long to run.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Dockerfile b/Dockerfile | |
index d63fcbe..22d87cd 100644 | |
--- a/Dockerfile | |
+++ b/Dockerfile | |
@@ -11,21 +11,22 @@ ENV DISPLAY :99 | |
RUN rm -rf /root/bmp | |
-# use COPY for local testing, use the RUN command in CI | |
-COPY . /root/bmp | |
+RUN mkdir -p /root/bmp | |
+COPY Gemfile /root/bmp | |
+COPY Gemfile.lock /root/bmp | |
-RUN cd /root/bmp | |
-WORKDIR /root/bmp | |
+RUN gem install bundler | |
+RUN cd /root/bmp && ls && ssh-agent bash -c 'ssh-add /root/.ssh/project_rsa; bundle install -j 16 --without guard --path vendor/bundle --clean' \ | |
+ && mkdir /vendor \ | |
+ && cp -R vendor/bundle /vendor/ | |
RUN java -version | |
+RUN ruby -v | |
+ | |
+COPY . /root/bmp | |
+WORKDIR /root/bmp | |
# revive bundler cache | |
-RUN if [ -d "/vendor/bundle" ]; then mkdir vendor && mv /vendor/bundle vendor; fi | |
-RUN gem install bundler | |
-RUN ssh-agent bash -c 'ssh-add /root/.ssh/project_rsa; bundle install -j 16 --without guard --path vendor/bundle --clean' \ | |
- && mkdir /vendor \ | |
- && cp -R vendor/bundle /vendor/ | |
CMD ./tests.sh | |
diff --git a/tests.sh b/tests.sh | |
index 649575e..c90b0e3 100755 | |
--- a/tests.sh | |
+++ b/tests.sh | |
@@ -35,6 +35,7 @@ if [ -e /etc/init.d/xvfb ]; then | |
/etc/init.d/xvfb start | |
fi | |
+ | |
export testing=true | |
case "$TESTS" in | |
@@ -43,22 +44,29 @@ case "$TESTS" in | |
jruby_run ".test/integration/test_render_path.rb" \ | |
&& ssh-agent bash -c 'ssh-add /root/.ssh/project_rsa' \ | |
&& bundle exec rake build_jar \ | |
- && java -jar BrakemanPro.jar vendor/bundle/jruby/1.9/cache/bundler/git/brakeman-pro-engine*) | |
+ && java -jar BrakemanPro.jar vendor/bundle/jruby/1.9/cache/bundler/git/brakeman-pro-engine* | |
+ ) | |
;; | |
2) | |
- time( \ | |
- jruby_run ".test/integration/test_triage_pane.rb" \ | |
- && jruby_run ".test/test_create.rb" \ | |
+ time(jruby_run ".test/test_create.rb" \ | |
&& jruby_run ".test/test_import.rb" \ | |
&& jruby_run ".test/test_export.rb" \ | |
- && jruby_run ".test/test_delete.rb" \ | |
- && jruby_run ".test/integration/test_search.rb") | |
+ && jruby_run ".test/test_delete.rb") | |
;; | |
3) | |
- time( \ | |
- jruby_run ".test/integration/test_graph_updates.rb" \ | |
- && jruby_run ".test/integration/test_custom_rules.rb" \ | |
- && jruby_run ".test/integration/test_smoke.rb" ) | |
+ time(jruby_run ".test/integration/test_graph_updates.rb") | |
+ ;; | |
+ 4) | |
+ time(jruby_run ".test/integration/test_custom_rules.rb") | |
+ ;; | |
+ 5) | |
+ time(jruby_run ".test/integration/test_smoke.rb" ) | |
+ ;; | |
+ 6) | |
+ time(jruby_run ".test/integration/test_search.rb") | |
+ ;; | |
+ 7) | |
+ time(jruby_run ".test/integration/test_triage_pane.rb") | |
;; | |
*) | |
time( \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/oreoshake/0bbc278f0fdfd054ba27a0f5e9ca0a10#file-speed-diff-L13 is what copies the dependency lock files
https://gist.github.com/oreoshake/0bbc278f0fdfd054ba27a0f5e9ca0a10#file-speed-diff-L17 installs the ruby dependency manager
https://gist.github.com/oreoshake/0bbc278f0fdfd054ba27a0f5e9ca0a10#file-speed-diff-L18 installs all ruby dependencies
https://gist.github.com/oreoshake/0bbc278f0fdfd054ba27a0f5e9ca0a10#file-speed-diff-L25 is the only step that can introduce change (other than a dependency change)