Skip to content

Commit

Permalink
Merge pull request #13 from fintanmm/master
Browse files Browse the repository at this point in the history
Lay the ground work for integration with travis-ci.org
  • Loading branch information
aboe76 committed Feb 15, 2017
2 parents a3d7772 + 8e9dc56 commit 8148099
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 14 deletions.
34 changes: 20 additions & 14 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
---
driver:
name: vagrant
# name: docker
# binary: /usr/bin/docker
# use_sudo: false
# remove_images: true
# build_context: '.'
name: docker
hostname: salt-formula.ci.local
use_sudo: false
require_chef_omnibus: false

driver_config:
cap_add:
- SYS_PTRACE

# verifier:
# name: inspec

platforms:
- name: debian-jessie64
# - name: ubuntu-14.04-minimal
driver_config:
box: ssplatt/salt-deb-8
# box: saltstack/ubuntu-14.04-minimal
- name: ubuntu-14.04
- name: ubuntu-16.04
- name: debian-7
- name: debian-8
- name: centos-6
- name: centos-7

provisioner:
name: salt_solo
Expand All @@ -21,9 +27,9 @@ provisioner:
is_file_root: false
formula: wordpress
dependencies:
- {name: php, path: ../php-formula}
- {name: apache, path: ../apache-formula}
- {name: mysql, path: ../mysql-formula}
- {name: php, path: ../php}
- {name: apache, path: ../apache}
- {name: mysql, path: ../mysql}
pillars:
top.sls:
base:
Expand Down
43 changes: 43 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
language: php

rvm:
- 2.2.5

sudo: required
services:
- docker
- mysql
- apache

env:
matrix:
- INSTANCE: high-ubuntu-1404
- INSTANCE: high-ubuntu-1604
- INSTANCE: high-debian-7
- INSTANCE: high-debian-8
- INSTANCE: high-centos-6
- INSTANCE: cli-ubuntu-1404
- INSTANCE: cli-ubuntu-1604
- INSTANCE: cli-debian-7
- INSTANCE: cli-debian-8
- INSTANCE: cli-centos-6
- INSTANCE: config-ubuntu-1404
- INSTANCE: config-ubuntu-1604
- INSTANCE: config-debian-7
- INSTANCE: config-debian-8
- INSTANCE: config-centos-6

# https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142455888
before_script:
- sudo iptables -L DOCKER || sudo iptables -N DOCKER
- sudo apt-get install git
- git clone https://github.com/saltstack-formulas/apache-formula.git /tmp/kitchen/srv/salt/apache
- git clone https://github.com/saltstack-formulas/php-formula.git /tmp/kitchen/srv/salt/php
- git clone https://github.com/saltstack-formulas/mysql-formula.git /tmp/kitchen/srv/salt/mysql

install:
# setup ci for test formula
- export BUNDLE_GEMFILE=$PWD/Gemfile
- bundle install

script: bundle exec kitchen verify ${INSTANCE}
18 changes: 18 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source 'https://rubygems.org'

gem 'codeclimate-test-reporter', group: :test, require: nil
gem 'rake'
gem 'berkshelf', '~> 4.0'

group :integration do
gem 'test-kitchen'
gem 'kitchen-salt'
gem 'kitchen-inspec'
end

group :docker do
gem 'kitchen-docker'
end

# vi: set ft=ruby :
gem "kitchen-vagrant"
31 changes: 31 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'rake'
require 'rake/testtask'
require 'bundler/setup'

Rake::TestTask.new do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end

desc 'Run Test Kitchen integration tests'
namespace :integration do
desc 'Run integration tests with kitchen-docker'
task :docker do
require 'kitchen'
Kitchen.logger = Kitchen.default_file_logger
@loader = Kitchen::Loader::YAML.new(local_config: '.kitchen.docker.yml')
Kitchen::Config.new(loader: @loader).instances.each do |instance|
instance.test(:always)
end
end
end

task default: :test

begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end
9 changes: 9 additions & 0 deletions test/shared/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require "serverspec"
require "pathname"

# Set backend type
set :backend, :exec

RSpec.configure do |c|
c.path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
end

0 comments on commit 8148099

Please sign in to comment.