From 6a42d7b861bfda0fc55a4a30b35d9971d4414bef Mon Sep 17 00:00:00 2001 From: "David A. Harding" Date: Sun, 12 Apr 2015 10:00:40 -0400 Subject: [PATCH] Backend: Makefile Targets For 'deployment' and 'travis' * Set build server to use `make deployment` * Create Makefile target for 'deployment' to update dependencies if necessary * Set Travis CI to run `make travis` * Create Makefile target for 'travis' to use additional automation logic --- .travis.yml | 2 +- Gemfile | 12 +++++++++++- Makefile | 33 +++++++++++++++++++++++++++++---- _build/update_site.sh | 2 +- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84954566..b0eea3ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,4 @@ language: ruby rvm: - "2.0.0" -script: make all +script: make travis diff --git a/Gemfile b/Gemfile index 89bcc438..931f61c1 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,11 @@ source 'https://rubygems.org' ## to master ruby '2.0.0' +## Used on the build server. If you add a package here (like nokogiri) +## that has non-Gem dependencies (like zlib), please remind the site +## maintainers that they need to manually update the build server(s) +## before they commit to master. If `bundle install` can satisify all +## your dependencies, then nothing extra needs to be done group :development do gem 'ffi-icu' gem 'jekyll', '~>1.3.0' @@ -15,6 +20,11 @@ group :development do gem 'kramdown' gem 'RedCloth' gem 'therubyracer' # required by less - gem 'html-proofer' end +## Not used on build server. Only used by developers and Travis CI, so +## you can put whatever you want here and bundler will tell us humans to +## install the new Gems. +group :slow_test do + gem 'html-proofer' +end diff --git a/Makefile b/Makefile index d5433374..21b121d8 100644 --- a/Makefile +++ b/Makefile @@ -21,16 +21,35 @@ test: pre-build-tests post-build-tests valid: pre-build-tests-fast build post-build-tests-fast ## `make all`: build and run all tests -all: travis-background-keepalive pre-build-tests build post-build-tests +all: pre-build-tests build post-build-tests + +## `make deployment`: for use on build server +deployment: install-deps-deployment \ + valid + +## `make travis`: for use with Travis CI +travis: travis-background-keepalive \ + install-deps-development \ + all -## Pre-build tests which, aggregated together, take less than 5 seconds to run on a typical PC + +## Install dependencies (development version) +install-deps-development: + bundle install + +## Install dependencies (deployment version) +install-deps-deployment: + bundle install --deployment --without :slow_test + +## Pre-build tests which, aggregated together, take less than 10 seconds to run on a typical PC pre-build-tests-fast: check-for-non-ascii-urls check-for-wrong-filename-assignments \ check-for-missing-rpc-summaries \ - check-for-missing-copyright-licenses + check-for-missing-copyright-licenses \ + check-bundle -## Post-build tests which, aggregated together, take less than 5 seconds to run on a typical PC +## Post-build tests which, aggregated together, take less than 10 seconds to run on a typical PC post-build-tests-fast: check-for-build-errors ensure-each-svg-has-a-png check-for-liquid-errors \ check-for-missing-anchors check-for-broken-markdown-reference-links \ check-for-broken-kramdown-tables check-for-duplicate-header-ids \ @@ -206,6 +225,12 @@ check-for-broken-bitcoin-core-download-links: check-html-proofer: $S bundle exec ruby _contrib/bco-htmlproof +check-bundle: +## Ensure all the dependencies are installed. If you build without this +## check, you'll get confusing error messages when your deps aren't up +## to date + $S ! bundle check | grep -v "The Gemfile's dependencies are satisfied" + travis-background-keepalive: $S { while ps aux | grep -q '[m]ake' ; do echo "Ignore me: Travis CI keep alive" ; sleep 1m ; done ; } & diff --git a/_build/update_site.sh b/_build/update_site.sh index b2040f7e..dec61db0 100755 --- a/_build/update_site.sh +++ b/_build/update_site.sh @@ -49,7 +49,7 @@ lasttime=`stat -c %Y "$SITEDIR/_buildlock" | cut -d ' ' -f1` # Build website in a child process ( cd $WORKDIR -make valid && touch "$WORKDIR/_builddone" || touch "$WORKDIR/_buildfail" +make deployment && touch "$WORKDIR/_builddone" || touch "$WORKDIR/_buildfail" )& # Loop every 1 second to check status