Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local builds for Travis runners #672

Merged
merged 17 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
52 changes: 32 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
sudo: required

language: generic
language: ruby
rvm:
- 2.4.6

services:
- mysql
- docker

cache:
bundler: true
directories:
- public/lib/

install:
- cp config/database.yml.test.example config/database.yml
- cp config/database.yml.example config/database.yml
- cp config/config.yml.example config/config.yml
- cp db/schema.rb.example db/schema.rb
- docker-compose -f docker-compose.test.yml up -d --build
- >
while (! docker logs mapknitter-test | grep "Phusion Passenger Standalone web server started") > /dev/null 2>&1; do
echo "Waiting for start script to finish...";
sleep 20;
done; echo "Done!"
- docker-compose -f docker-compose.test.yml exec web bash -lc "rake db:setup || rake db:migrate"
- ./lib/exporter-deps.sh > /dev/null 2>&1
- bundle install && yarn install
- bundle exec rake db:setup || bundle exec rake db:migrate

env:
global:
- RAILS_ENV=test
matrix:
- TASK="CI=true TRAVIS=true rake test:unit"
- TASK="CI=true TRAVIS=true rake test:integration"
- TASK="CI=true TRAVIS=true rake test:functional"
- TASK="CI=true TRAVIS=true rake assets:precompile"
- TASK="CI=true TRAVIS=true bundle exec rubocop
- CI=true
- TRAVIS=true

script:
- docker-compose -f docker-compose.test.yml exec web bash -lc "$TASK"
- bash <(curl -s https://codecov.io/bash)
jobs:
include:
- name: "Unit Tests"
script: bundle exec rake test:unit
- name: "Integration Tests"
script: bundle exec rake test:integration
- name: "Functional Tests"
script: bundle exec rake test:functional
- name: "Rubocop Linter"
script: bundle exec rubocop
- name: "Docker Builds"
script: docker build -t mapknitter .
# Configure this option after full yarn setup
# - name: "Asset Precompilation"
# env:
# - RAILS_ENV=production
# script: bundle exec rake assets:precompile

branches:
only:
Expand Down
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.52.0'
gem 'rubocop', '~> 0.52.0'
gem 'ruby-prof'
gem 'rails-perftest'
gem 'simplecov', require: false
Expand Down
21 changes: 21 additions & 0 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,6 +82,10 @@ GEM
concurrent-ruby (~> 1.0)
image_science (1.3.0)
RubyInline (~> 3.9)
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 @@ -205,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 @@ -229,6 +245,7 @@ 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)
Expand All @@ -251,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 @@ -278,10 +297,12 @@ DEPENDENCIES
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.
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
100644 → 100755
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