Skip to content

Commit

Permalink
Cherry pick local builds for travis runners, #672
Browse files Browse the repository at this point in the history
Co-authored-by: Álax de Carvalho Alves <alaxallves@gmail.com>
  • Loading branch information
kaustubh-nair and alaxalves committed Jun 16, 2019
1 parent 9a54f16 commit 4e01707
Show file tree
Hide file tree
Showing 22 changed files with 114 additions and 99 deletions.
9 changes: 7 additions & 2 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
require 'simplecov-cobertura'

if ENV['CI'] == 'true'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
else
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
end

SimpleCov.start 'rails' do
add_group 'Units', 'app/models'
add_group 'Functionals', 'app/controllers'
add_group 'Services', 'app/services'
add_group 'Libraries', 'lib/'

add_filter '/test/'
add_filter '/config/'
add_filter '/db/'
add_filter '/vendor/'
add_filter '/log/'
add_filter '/tmp/'
end
16 changes: 7 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ install:
- cp db/schema.rb.example db/schema.rb
- ./lib/exporter-deps.sh > /dev/null 2>&1
- bundle install && yarn install
- if [ $RAILS_ENV == 'production' ]; then
bundle exec rake db:create;
else
bundle exec rake db:setup || bundle exec rake db:migrate;
fi
- bundle exec rake db:setup || bundle exec rake db:migrate

env:
global:
Expand All @@ -41,13 +37,15 @@ jobs:
script: bundle exec rubocop
- name: "Docker Builds"
script: docker build -t mapknitter .
- name: "Asset Precompilation"
env:
- RAILS_ENV=production
script: bundle exec rake assets:precompile
# Configure this option after full yarn setup
# - name: "Asset Precompilation"
# env:
# - RAILS_ENV=production
# script: bundle exec rake assets:precompile

branches:
only:
- main
- unstable
- development

10 changes: 6 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,22 @@ group :dependencies do
# gem 'right_aws'
gem 'right_aws_api'


# compiling markdown to html
gem "rdiscount", "2.2.0.1"

# asset pipelining
gem "sprockets"#, "2.12.1"
gem 'bootstrap-sass'
gem 'sassc-rails'
gem 'jquery-rails'
gem "sprockets"
gem "sprockets-rails"
gem "sass", :require => 'sass'
gem "autoprefixer-rails"
gem "uglifier"

end

group :test do
gem "rubocop", '~> 0.64.0'
gem 'rubocop', '~> 0.52.0'
gem 'ruby-prof'
gem 'rails-perftest'
gem 'simplecov', require: false
Expand Down
33 changes: 26 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ GEM
uuidtools (~> 2.1)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.3)
byebug (11.0.1)
climate_control (0.2.0)
Expand Down Expand Up @@ -79,7 +82,10 @@ GEM
concurrent-ruby (~> 1.0)
image_science (1.3.0)
RubyInline (~> 3.9)
jaro_winkler (1.5.2)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jshintrb (0.3.0)
execjs
multi_json (>= 1.3)
Expand Down Expand Up @@ -188,14 +194,13 @@ GEM
net-http-persistent (~> 2.9)
redcarpet (>= 3.0.0)
ruby-hmac (>= 0.4.0)
rubocop (0.64.0)
jaro_winkler (~> 1.5.1)
rubocop (0.52.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
parser (>= 2.4.0.2, < 3.0)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.4.0)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-hmac (0.4.0)
ruby-openid (2.7.0)
ruby-openid-apps-discovery (1.2.0)
Expand All @@ -207,6 +212,15 @@ GEM
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sassc (2.0.1)
ffi (~> 1.9)
rake
sassc-rails (2.1.1)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand All @@ -231,11 +245,12 @@ GEM
ref
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.4.1)
unicode-display_width (1.6.0)
uuidtools (2.1.5)
web-console (2.3.0)
activemodel (>= 4.0)
Expand All @@ -253,12 +268,14 @@ DEPENDENCIES
RubyInline
autoprefixer-rails
aws-sdk (~> 1.5.7)
bootstrap-sass
byebug
faker
friendly_id
geokit-rails (= 1.1.4)
httparty
image_science (= 1.3.0)
jquery-rails
jshintrb
minitest
minitest-reporters
Expand All @@ -276,14 +293,16 @@ DEPENDENCIES
rdiscount (= 2.2.0.1)
recaptcha
right_aws_api
rubocop (~> 0.64.0)
rubocop (~> 0.52.0)
ruby-openid (~> 2.5)
ruby-prof
sass
sassc-rails
simplecov
simplecov-cobertura
skylight
sprockets
sprockets-rails
sqlite3
therubyracer
uglifier
Expand Down
4 changes: 3 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
// GO AFTER THE REQUIRES BELOW.
//

//= require popper
//= require_tree .
//= require jquery
//= require jquery-ujs
//= require jquery/dist/jquery.js
//= require jquery-ujs/src/rails.js

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
}

.leaflet-draw-toolbar a {
background-image: url('/assets/leaflet-illustrate/dist/images/spritesheet.png'); !important
background-image: url('/assets/leaflet-illustrate/dist/images/spritesheet.png') !important;
}
.leaflet-retina .leaflet-draw-toolbar a {
background-image: url('/assets/leaflet-draw/dist/images/spritesheet-2x.png'); !important
background-image: url('/assets/leaflet-draw/dist/images/spritesheet-2x.png') !important;
}
27 changes: 0 additions & 27 deletions app/assets/stylesheets/application.css

This file was deleted.

24 changes: 24 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$icon-font-path: "bootstrap-sass/assets/fonts/bootstrap/";
@import "style";
@import "maps";
@import "header";
@import "uploads";
@import "annotations";
@import "bootstrap/dist/css/bootstrap.min.css";
@import "leaflet-draw/dist/leaflet.draw.css";
@import "leaflet-illustrate/dist/Leaflet.Illustrate.css";
@import "leaflet-toolbar/dist/leaflet.toolbar.css";
@import "leaflet-distortableimage/dist/leaflet.distortableimage.css";
@import "fontawesome/css/font-awesome.min.css";
// /*
// * This is a manifest file that'll be compiled into application.css, which will include all the files
// * listed below.
// *
// * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
// * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
// *
// * You're free to add application-wide styles to this file and they'll appear at the top of the
// * compiled file, but it's generally better to create a new file per style scope.
// *

// */
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions config/database.yml.cloud9.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
development:
default: &default
encoding: utf8
adapter: mysql2

development:
<<: *default
username: root
password:
database: mapknitter

production:
adapter: mysql2
<<: *default
host: db
username: mapknitter
password: mapknitter
database: mapknitter

test:
adapter: mysql2
<<: *default
username: root
password:
database: mapknittertest
19 changes: 10 additions & 9 deletions config/database.yml.example
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
development:
default: &default
encoding: utf8
adapter: mysql2

development:
<<: *default
username:
password:
database: mapknitter
database: mapknitter-dev

production:
adapter: mysql2
host: db
<<: *default
username: mapknitter
password: mapknitter
database: mapknitter

test:
adapter: mysql2
username: mapknitter
password: mapknitter
host: db
database: mapknitter
<<: *default
username: root
database: mapknitter-test
7 changes: 0 additions & 7 deletions config/database.yml.test.example

This file was deleted.

17 changes: 0 additions & 17 deletions docker-compose.test.yml

This file was deleted.

17 changes: 16 additions & 1 deletion lib/exporter-deps.sh
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
sudo apt-get install gdal-bin python-gdal curl libcurl4-openssl-dev libssl-dev zip libmysqlclient-dev imagemagick ruby-rmagick libfreeimage3 libfreeimage-dev ruby-dev libmagickcore-dev libmagickwand-dev
sudo add-apt-repository -y ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install -y gdal-bin \
python3-gdal \
python-gdal \
curl \
libcurl4-openssl-dev \
libssl-dev zip \
libmysqlclient-dev \
imagemagick \
ruby-rmagick \
libfreeimage3 \
libfreeimage-dev \
ruby-dev \
libmagickcore-dev \
libmagickwand-dev
5 changes: 2 additions & 3 deletions lib/exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ def self.generate_composite_tiff(coords, origin, placed_warpables, slug, ordered
# generates a tileset at root/public/tms/<slug>/
# root is something like https://mapknitter.org
def self.generate_tiles(key, slug, root)
key = "AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ" if key == "" # ugh, let's clean this up!
key = key || "AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ"
gdal2tiles = 'gdal2tiles.py -k --s_srs EPSG:3857 -t "'+slug+'" -g "'+key+'" '+root+'/public/warps/'+slug+'/'+slug+'-geo.tif '+root+'/public/tms/'+slug+"/"
key = "AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ" if key.blank?
gdal2tiles = 'gdal2tiles.py -k --s_srs EPSG:4326 -t "'+slug+'" -g "'+key+'" '+root+'/public/warps/'+slug+'/'+slug+'-geo.tif '+root+'/public/tms/'+slug+"/"
puts gdal2tiles
system(self.ulimit+gdal2tiles)
end
Expand Down
4 changes: 0 additions & 4 deletions mapknitter.test.env

This file was deleted.

4 changes: 2 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ENV["RAILS_ENV"] = "test"

require 'simplecov'

require 'simplecov-cobertura'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/reporters'
MiniTest::Reporters.use! [MiniTest::Reporters::ProgressReporter.new,
MiniTest::Reporters::JUnitReporter.new]
ENV["RAILS_ENV"] = "test"

class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
Expand Down
Loading

0 comments on commit 4e01707

Please sign in to comment.