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

Lay the ground work for integration with travis-ci.org #13

Merged
merged 7 commits into from
Feb 15, 2017
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
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