Commit 31500bd

mo <mo@mokhan.ca>
2018-05-07 22:16:53
hook up CI.
1 parent 94930e5
bin/cibuild
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# script/cibuild: Setup environment for CI to run tests. This is primarily
+#                 designed to run on the continuous integration server.
+
+set -e
+
+cd "$(dirname "$0")/.."
+
+echo [$(date "+%H:%M:%S")] "==> Started at…"
+
+# GC customizations
+export RUBY_GC_MALLOC_LIMIT=79000000
+export RUBY_GC_HEAP_INIT_SLOTS=800000
+export RUBY_HEAP_FREE_MIN=100000
+export RUBY_HEAP_SLOTS_INCREMENT=400000
+export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
+
+ruby -v
+gem install bundler --no-ri --no-rdoc --conservative
+bin/test
+bin/lint
bin/console
@@ -1,7 +1,8 @@
 #!/usr/bin/env ruby
+# frozen_string_literal: true
 
-require "bundler/setup"
-require "net/hippie"
+require 'bundler/setup'
+require 'net/hippie'
 
 # You can add fixtures and/or initialization code here to make experimenting
 # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "net/hippie"
 # require "pry"
 # Pry.start
 
-require "irb"
+require 'irb'
 IRB.start(__FILE__)
bin/lint
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+[ -z "$DEBUG" ] || set -x
+
+echo [$(date "+%H:%M:%S")] "==> Running linters…"
+bundle exec rake lint
bin/test
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# script/test: Run test suite for application. Optionally pass in a path to an
+#              individual test file to run a single test.
+
+
+set -e
+
+cd "$(dirname "$0")/.."
+
+[ -z "$DEBUG" ] || set -x
+
+echo [$(date "+%H:%M:%S")] "==> Running setup…"
+bin/setup
+
+echo [$(date "+%H:%M:%S")] "==> Running tests…"
+bundle exec rake test
.gitlab-ci.yml
@@ -0,0 +1,12 @@
+image: ruby:2.5
+
+before_script:
+  - apt-get update && apt-get install -y locales
+  - echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
+  - locale-gen
+  - export LC_ALL=en_US.UTF-8
+
+ci:
+  script:
+    - bin/cibuild
+
.travis.yml
@@ -1,5 +1,7 @@
 sudo: false
 language: ruby
+cache: bundler
 rvm:
   - 2.5.1
-before_install: gem install bundler -v 1.16.1
+script:
+  - bin/cibuild
net-hippie.gemspec
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
   spec.add_development_dependency "minitest", "~> 5.0"
   spec.add_development_dependency "vcr", "~> 4.0"
   spec.add_development_dependency "webmock", "~> 3.4"
+  spec.add_development_dependency "rubocop", '~> 0.55'
 end
Rakefile
@@ -1,10 +1,13 @@
 require "bundler/gem_tasks"
 require "rake/testtask"
+require 'rubocop/rake_task'
 
 Rake::TestTask.new(:test) do |t|
   t.libs << "test"
   t.libs << "lib"
   t.test_files = FileList["test/**/*_test.rb"]
 end
+RuboCop::RakeTask.new(:rubocop)
 
+task lint: [:rubocop]
 task :default => :test