Working .travis.yml
This commit is contained in:
parent
d0e9c76e56
commit
d4b867e930
14 changed files with 136 additions and 20 deletions
32
.env.test
Normal file
32
.env.test
Normal file
|
@ -0,0 +1,32 @@
|
|||
export DEVISE_SECRET_KEY='0696452e54b14758b8534437d8cf418ea920ff23bb9c3a061a9ab2827bab4685710e89b899ebd4457df600cb5f2e04adb6a0fdef09a6a45558ecae1d6906f4a6' #bundle exec rake secret
|
||||
export SECRET_TOKEN='0696452e54b14758b8534437d8cf418ea920ff23bb9c3a061a9ab2827bab4685710e89b899ebd4457df600cb5f2e04adb6a0fdef09a6a45558ecae1d6906f4a6' #bundle exec rake secret
|
||||
|
||||
export STRIPE_API_KEY='REPLACE' # use your test private key from your stripe account
|
||||
export STRIPE_API_PUBLIC='REPLACE' # use your test public key from your stripe account
|
||||
export S3_BUCKET_NAME='REPLACE'
|
||||
export AWS_ACCESS_KEY='REPLACE'
|
||||
export AWS_SECRET_ACCESS_KEY='REPLACE'
|
||||
|
||||
### optional below
|
||||
export ORG_NAME="default_organization"
|
||||
|
||||
export GOOGLE_API_KEY='REPLACE'
|
||||
export TWITTER_API_SECRET='REPLACE'
|
||||
export FACEBOOK_API_SECRET='REPLACE'
|
||||
|
||||
export MAILCHIMP_API_KEY='REPLACE'
|
||||
export FULL_CONTACT_KEY='REPLACE'
|
||||
|
||||
export LOG_TO_FILES=true
|
||||
|
||||
export MAILCHIMP_OAUTH_CLIENT_ID='REPLACE'
|
||||
export MAILCHIMP_OAUTH_CLIENT_SECRET='REPLACE'
|
||||
export MAILCHIMP_REDIRECT_URL='REPLACE'
|
||||
export FACEBOOK_APP_ID="REPLACE"
|
||||
|
||||
|
||||
export CYPHER_KEY="REPLACE" # used for mailchimp integration
|
||||
|
||||
|
||||
|
||||
export CIVIC_CRM_RABBITMQ_PASSWORD=""
|
|
@ -7,7 +7,7 @@ services:
|
|||
|
||||
before_install:
|
||||
- docker-compose -f docker/build/docker-compose.yml build
|
||||
- cp .env.template .env
|
||||
- cp .env.test .env
|
||||
|
||||
script:
|
||||
- docker-compose -f docker/build/docker-compose.yml run -e RACK_ENV=ci -e RAILS_ENV=ci -e BUILD_DATABASE_URL=postgres://admin:password@db/commitchange_test build script/test.sh
|
||||
- docker-compose -f docker/build/docker-compose.yml run -e RACK_ENV=ci -e RAILS_ENV=ci -e BUILD_DATABASE_URL=postgres://admin:password@db/commitchange_development build script/test.sh
|
||||
|
|
4
Gemfile
4
Gemfile
|
@ -109,13 +109,13 @@ gem 'i18n-js'
|
|||
gem 'countries'
|
||||
|
||||
|
||||
group :development do
|
||||
group :development, :ci do
|
||||
gem 'traceroute'
|
||||
gem 'debase'
|
||||
gem 'ruby-debug-ide'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
group :development, :ci, :test do
|
||||
gem 'timecop'
|
||||
gem 'pry'
|
||||
#gem 'pry-byebug'
|
||||
|
|
|
@ -526,7 +526,7 @@ DEPENDENCIES
|
|||
webmock
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.3.6p384
|
||||
ruby 2.3.7p456
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
||||
1.16.4
|
||||
|
|
|
@ -33,7 +33,7 @@ test:
|
|||
ci:
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
database: commitchange_test
|
||||
database: commitchange_development
|
||||
pool: 5
|
||||
username: admin
|
||||
password: password
|
||||
|
|
|
@ -5,16 +5,23 @@ require File.expand_path('../application', __FILE__)
|
|||
Encoding.default_external = Encoding::UTF_8
|
||||
Encoding.default_internal = Encoding::UTF_8
|
||||
@ignore_dotenv = ENV['IGNORE_DOTENV']
|
||||
@env = Rails.env || 'development'
|
||||
unless (@ignore_dotenv)
|
||||
require 'dotenv'
|
||||
if @env == 'test'
|
||||
if File.file?(".env.#{@env}")
|
||||
Dotenv.load ".env.#{@env}"
|
||||
end
|
||||
else
|
||||
Dotenv.load ".env"
|
||||
end
|
||||
end
|
||||
@env = Rails.env || 'development'
|
||||
|
||||
@org_name = ENV['ORG_NAME'] || 'default_organization'
|
||||
puts "config files .env .env.#{@env} ./config/settings.#{@env}.yml#{ @env != 'test' ? " ./config/#{@org_name}.yml": " "} #{ @env != 'test' ? " ./config/#{@org_name}.#{@env}.yml": " "} #{ @env == 'test' ? "./config/settings.test.yml" : ""}"
|
||||
unless @ignore_dotenv
|
||||
Dotenv.load ".env.#{@env}" if File.file?(".env.#{@env}")
|
||||
end
|
||||
# unless @ignore_dotenv
|
||||
# Dotenv.load ".env.#{@env}" if File.file?(".env.#{@env}")
|
||||
# end
|
||||
if Rails.env == 'test'
|
||||
Settings.add_source!("./config/settings.test.yml")
|
||||
else
|
||||
|
|
|
@ -1,8 +1,60 @@
|
|||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||
require File.expand_path('config/environments/test')
|
||||
|
||||
Commitchange::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
config.log_level = :info
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
config.cache_store = Settings.default.cache_store.to_sym
|
||||
|
||||
# Log error messages when you accidentally call methods on nil.
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# You can uncomment the following to test our real AWS email server on localhost:
|
||||
# config.action_mailer.delivery_method = :aws_ses
|
||||
# config.action_mailer.default_url_options = { host: 'commitchange.com' }
|
||||
config.action_mailer.delivery_method = Settings.mailer.delivery_method.to_sym
|
||||
config.action_mailer.smtp_settings = { address: Settings.mailer.address, port: Settings.mailer.port }
|
||||
config.action_mailer.smtp_settings['user_name']= Settings.mailer.username if Settings.mailer.username
|
||||
config.action_mailer.smtp_settings['password']= Settings.mailer.password if Settings.mailer.password
|
||||
|
||||
config.action_mailer.default_url_options = { host: Settings.mailer.host }
|
||||
|
||||
# Print deprecation notices to the Rails logger
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Only use best-standards-support built into browsers
|
||||
config.action_dispatch.best_standards_support = :builtin
|
||||
|
||||
# Raise exception on mass assignment protection for Active Record models
|
||||
config.active_record.mass_assignment_sanitizer = :strict
|
||||
|
||||
# Log the query plan for queries taking more than this (works)
|
||||
# with SQLite, MySQL, and PostgreSQL)
|
||||
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||
|
||||
# Do not compress assets
|
||||
config.assets.compress = false
|
||||
|
||||
# Expands the lines which load the assets
|
||||
config.assets.debug = true
|
||||
|
||||
config.log_level = :debug
|
||||
|
||||
config.threadsafe!
|
||||
config.dependency_loading = true if $rails_rake_task
|
||||
# Turn this on if you want to mess with code inside /node_modules
|
||||
# config.browserify_rails.evaluate_node_modules = true
|
||||
|
||||
config.middleware.use I18n::JS::Middleware
|
||||
|
||||
config.after_initialize do
|
||||
ActiveRecord::Base.logger = nil
|
||||
end
|
||||
|
||||
end
|
|
@ -58,4 +58,5 @@ Commitchange::Application.configure do
|
|||
# config.browserify_rails.evaluate_node_modules = true
|
||||
|
||||
config.middleware.use I18n::JS::Middleware
|
||||
|
||||
end
|
||||
|
|
|
@ -38,11 +38,18 @@ Commitchange::Application.configure do
|
|||
# Expands the lines which load the assets
|
||||
config.assets.debug = true
|
||||
|
||||
config.log_level = :debug
|
||||
config.log_level = :none
|
||||
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.threadsafe!
|
||||
config.after_initialize do
|
||||
ActiveRecord::Base.logger = nil
|
||||
ActionController::Base.logger = nil
|
||||
ActionMailer::Base.logger = nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||
Commitchange::Application.configure do
|
||||
if (Rails.env != 'test')
|
||||
|
||||
|
||||
config.lograge.enabled = true
|
||||
# add time to lograge
|
||||
config.lograge.custom_options = lambda do |event|
|
||||
|
@ -8,4 +11,5 @@ Commitchange::Application.configure do
|
|||
exception_object: event.payload[:exception_object] # the exception instance
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,5 +13,5 @@ WORKDIR /myapp
|
|||
COPY Gemfile /myapp/Gemfile
|
||||
COPY Gemfile.lock /myapp/Gemfile.lock
|
||||
RUN bundle install
|
||||
CMD rake db:create db:structure:load test:prepare && rake spec && npx jest && npm run build-all
|
||||
CMD rake -T
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"watch": "export HOUDINI_WATCH=1; script/build.sh",
|
||||
"build": "script/build.sh",
|
||||
"build-all": "npm ci && script/compile-assets.sh && npm run build",
|
||||
"test": "rake spec && npm run build && npx jest",
|
||||
"test": "rake -v spec && npm run build && npx jest",
|
||||
"export-button-config": "bundle exec rake settings:generate_json",
|
||||
"export-i18n": "bundle exec rake settings:combine_translations",
|
||||
"generate-openapi": "rake oapi:gen",
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash
|
||||
npm install && rake db:create db:structure:load test:prepare && rake spec && npx jest && npm run build-all
|
||||
npm ci && rake db:create db:structure:load db:migrate && RAILS_ENV=test rake db:create db:structure:load test:prepare && rake spec
|
|
@ -117,3 +117,16 @@ RSpec.configure do |config|
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" && RUBY_VERSION >= "1.9"
|
||||
module Kernel
|
||||
alias :__at_exit :at_exit
|
||||
def at_exit(&block)
|
||||
__at_exit do
|
||||
exit_status = $!.status if $!.is_a?(SystemExit)
|
||||
block.call
|
||||
exit exit_status if exit_status
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue