Last active
September 28, 2017 20:35
-
-
Save iynere/9ccad307aad59c2c3b48404338416ff6 to your computer and use it in GitHub Desktop.
SolarCS Dockerfile https://hub.docker.com/r/iynere/solarcs
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
notify: | |
webhooks: | |
- url: 'https://cipherchatbot.herokuapp.com/hooks/circle' | |
version: 2 | |
jobs: | |
build: | |
parallelism: 12 | |
# run build out of shared memory to improve database i/o times | |
working_directory: /dev/shm/banff | |
docker: | |
- image: iynere/solarcs:ruby-node-browsers-v2 | |
environment: | |
CIRCLE_TEST_REPORTS: /dev/shm/banff/test_reports | |
CIRCLE_ARTIFACTS: /dev/shm/banff/artifacts | |
RAILS_ENV: test | |
RACK_ENV: test | |
REDIS_HOST: 127.0.0.1 | |
- image: iynere/redis:2.8.4 | |
- image: library/memcached:1.5-alpine | |
steps: | |
# may not strictly be necessary—designed to fix some potential ipv6 issues on our end | |
- run: | |
name: localhost/127.0.0.1 fix | |
shell: sudo bash -eo pipefail | |
command: | | |
export LAST=$(tail -1 /etc/hosts) | |
echo "127.0.0.1 localhost" > /etc/hosts | |
echo $LAST >> /etc/hosts | |
- restore_cache: | |
keys: | |
- banff-v7-{{ .Branch }}-{{ .Revision }} | |
- banff-v7-{{ .Branch }}- | |
- banff-v7- | |
- checkout | |
- run: | |
name: symmlink deps | |
command: | | |
ln -s /home/circleci/banff/vendor vendor | |
- save_cache: | |
key: banff-v7-{{ .Branch }}-{{ .Revision }} | |
paths: | |
- ".git" | |
# thought this might help webmock tests but ended up skipping them for now | |
- run: | |
name: fix spec_helper file for webmock | |
command: | | |
sed -i '64i\\n config.before(:all, type: :request) do\n WebMock.allow_net_connect!(net_http_connect_on_start: true)\n end' spec/spec_helper.rb | |
- restore_cache: | |
key: banff-v7-{{ checksum "Gemfile.lock" }}-{{ arch }} | |
- run: bundle check --path=/home/circleci/banff/vendor/bundle || bundle install --path=/home/circleci/banff/vendor/bundle --jobs=4 --retry=3 | |
- save_cache: | |
key: banff-v7-{{ checksum "Gemfile.lock" }}-{{ arch }} | |
paths: | |
- /home/circleci/banff/tmp/cache | |
- /home/circleci/banff/vendor/bundle | |
- restore_cache: | |
key: banff-v7-{{ checksum "bower.json" }}-{{ arch }} | |
- run: bower install | |
- save_cache: | |
key: banff-v7-{{ checksum "bower.json" }}-{{ arch }} | |
paths: | |
- bower_components | |
# the /dev/shm volume is mounted with a `noexec` flag, meaning we need to explicitly specify how to run scripts | |
# these `sed` commands append the appropriate interpreters to all scripts called within these `exe/` scripts | |
- run: | |
name: fix no-exec dev/shm script issues | |
command: | | |
sed -i 's|bin/rubocop|ruby bin/rubocop|g' exe/chunk_of_rubocops | |
sed -i 's|exe/splitter|ruby exe/splitter|g' exe/chunk_of_rubocops | |
sed -i 's|exe/splitter|ruby exe/splitter|g' exe/chunk_of_coffeelints | |
sed -i 's|exe/splitter|ruby exe/splitter|g' exe/chunk_of_scss_lints | |
sed -i 's|bin/scss-lint|ruby bin/scss-lint|g' exe/chunk_of_scss_lints | |
sed -i 's|exe/splitter|ruby exe/splitter|g' exe/chunk_of_haml_lints | |
sed -i 's|bin/haml-lint|ruby bin/haml-lint|g' exe/chunk_of_haml_lints | |
sed -i 's|exe/splitter|ruby exe/splitter|g' exe/chunk_of_cukes_lints | |
sed -i 's|bin/gherkin_lint|ruby bin/gherkin_lint|g' exe/chunk_of_cukes_lints | |
sed -i 's|bin/rspec|ruby bin/rspec|g' exe/rerun_failed_specs | |
# disable to fix nokogiri version issue: | |
# bin/bundle-audit check --update | |
# (this is likely easy to fix in source code, but hard to fix on our end) | |
# see https://circleci.com/gh/SolarCS/banff/34401 for example of the error | |
- run: | |
name: checks/linters | |
command: | | |
ruby bin/security-audit deploy/config | |
sh exe/chunk_of_rubocops | |
sh exe/chunk_of_coffeelints | |
sh exe/chunk_of_scss_lints | |
sh exe/chunk_of_haml_lints | |
sh exe/chunk_of_cukes_lints | |
- restore_cache: | |
keys: | |
- banff-assets-v7-{{ arch }}-{{ .Branch }}-{{ .Revision }} | |
- banff-assets-v7-{{ arch }}-{{ .Branch }}- | |
- banff-assets-v7-{{ arch }}- | |
- run: ruby bin/rake assets:precompile assets:clean | |
- save_cache: | |
key: banff-assets-v7-{{ arch }}-{{ .Branch }}-{{ .Revision }} | |
paths: | |
- public/assets | |
- tmp/cache/assets | |
- run: | |
name: remove troublesome specs for now | |
command: | | |
rm -f spec/blueprint/services/user_security_spec.rb | |
rm -f spec/data_generation/data_generation_spec.rb | |
rm -f spec/infrastructure/bluepill_spec.rb | |
rm -f spec/infrastructure/mongodb_spec.rb | |
rm -f spec/infrastructure/sidekiq_spec.rb | |
rm -f spec/operations/check_ip_location_operation_spec.rb | |
rm -f spec/requests/api/v8/encounters_spec.rb | |
rm -f spec/servers/pentaho_ldap_server_spec.rb | |
rm -f spec/services/report_packages/report_package_performer_spec.rb | |
- run: | |
name: Start local replicaset with MongoDB custom version | |
command: ruby exe/local_rs start 1 | |
- run: | |
name: Unit tests with RSpec | |
command: | | |
mkdir -p $CIRCLE_TEST_REPORTS/rspec | |
bundle exec rspec -r \ | |
rspec_junit_formatter \ | |
--order random \ | |
--format documentation \ | |
--require spec_helper \ | |
--format RspecJunitFormatter -o test_reports/rspec/junit-specs.xml \ | |
$(circleci tests glob \ | |
"spec/**/*_spec.rb" | \ | |
circleci tests split --split-by=timings) || \ | |
bash exe/rerun_failed_specs || \ | |
bash exe/rerun_failed_specs || \ | |
bash exe/rerun_failed_specs | |
- run: | |
name: Integration tests with Cucumber and Capybara | |
command: | | |
mkdir -p $CIRCLE_TEST_REPORTS/cucumber | |
bundle exec cucumber \ | |
--order random \ | |
--format pretty \ | |
--format junit \ | |
--out test_reports/cucumber \ | |
$(circleci tests glob \ | |
"features/**/*.feature" | \ | |
circleci tests split --split-by=timings) || \ | |
bash exe/rerun_failed_cukes || \ | |
bash exe/rerun_failed_cukes || \ | |
bash exe/rerun_failed_cukes | |
- run: | |
name: deploy staging | |
command: | | |
if [ "${CIRCLE_BRANCH}" == "staging" ]; then | |
bundle exec cap staging deploy | |
fi | |
no_output_timeout: 1800 | |
- run: | |
name: deploy demo | |
command: | | |
if [ "${CIRCLE_BRANCH}" == "demo" ]; then | |
bundle exec cap demo deploy | |
fi | |
no_output_timeout: 500 | |
- store_artifacts: | |
path: artifacts | |
- store_artifacts: | |
path: test_reports | |
- store_test_results: | |
path: test_reports |
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
FROM circleci/node:8.5.0-browsers | |
USER root | |
# remove Node 8.5.0 | |
RUN rm -f \ | |
/usr/local/bin/node \ | |
/usr/local/bin/nodejs \ | |
/usr/local/bin/npm \ | |
/usr/local/bin/npx \ | |
/usr/local/share/man/man1/node.1 \ | |
/usr/local/share/systemtap/tapset/node.stp | |
RUN rm -rf \ | |
/usr/local/lib/node_modules \ | |
/usr/local/include/node \ | |
/usr/local/share/doc/node | |
# install Node 4.2.6 | |
RUN wget https://nodejs.org/dist/v4.2.6/node-v4.2.6.tar.gz && \ | |
tar -xzvf node-v4.2.6.tar.gz && \ | |
rm node-v4.2.6.tar.gz && \ | |
cd node-v4.2.6 && \ | |
./configure && \ | |
make -j4 && \ | |
make install && \ | |
cd .. && \ | |
rm -r node-v4.2.6 | |
# install Ruby 2.3.0 | |
RUN wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz && \ | |
tar -xzvf ruby-2.3.0.tar.gz && \ | |
rm ruby-2.3.0.tar.gz && \ | |
cd ruby-2.3.0 && \ | |
./configure --with-openssl-dir=/usr/bin && \ | |
make -j4 && \ | |
make install && \ | |
cd .. && \ | |
rm -r ruby-2.3.0 | |
# install sox | |
RUN apt-get update && \ | |
apt-get install -y sox | |
# install bower | |
RUN npm install -g bower coffeelint | |
# install bundler | |
RUN gem install bundler && \ | |
mkdir -p /usr/local/bundle && \ | |
chown -R circleci /usr/local/bundle | |
USER circleci |
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
FROM circleci/node:8.5.0-browsers | |
USER root | |
# remove Node 8.5.0 | |
RUN rm -f \ | |
/usr/local/bin/node \ | |
/usr/local/bin/nodejs \ | |
/usr/local/bin/npm \ | |
/usr/local/bin/npx \ | |
/usr/local/share/man/man1/node.1 \ | |
/usr/local/share/systemtap/tapset/node.stp | |
RUN rm -rf \ | |
/usr/local/lib/node_modules \ | |
/usr/local/include/node \ | |
/usr/local/share/doc/node | |
# install Node 4.2.6 | |
RUN wget https://nodejs.org/dist/v4.2.6/node-v4.2.6.tar.gz && \ | |
tar -xzvf node-v4.2.6.tar.gz && \ | |
rm node-v4.2.6.tar.gz && \ | |
cd node-v4.2.6 && \ | |
./configure && \ | |
make -j4 && \ | |
make install && \ | |
cd .. && \ | |
rm -r node-v4.2.6 | |
# install Ruby 2.3.0 | |
RUN wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz && \ | |
tar -xzvf ruby-2.3.0.tar.gz && \ | |
rm ruby-2.3.0.tar.gz && \ | |
cd ruby-2.3.0 && \ | |
./configure --with-openssl-dir=/usr/bin && \ | |
make -j4 && \ | |
make install && \ | |
cd .. && \ | |
rm -r ruby-2.3.0 | |
# install sox | |
RUN apt-get update && \ | |
apt-get install -y sox | |
# install bower | |
RUN npm install -g bower coffeelint | |
# install bundler | |
RUN gem install bundler && \ | |
mkdir -p /usr/local/bundle && \ | |
chown -R circleci /usr/local/bundle | |
# install MongoDB (via https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian) | |
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 | |
RUN echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list | |
RUN apt-get update && \ | |
apt-get install -y mongodb-org=3.4.5 | |
# delete default mongo conf file | |
RUN rm -f /etc/init/mongod.conf | |
USER circleci |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment