Skip to content

Commit

Permalink
Move to sous-chefs + testing updates (#52)
Browse files Browse the repository at this point in the history
* Testing updates
* Update ownership to sous-chefs
* Modernize the test recipe setup a bit
* Fix integration test dir and use latest jruby
  • Loading branch information
tas50 authored and damacus committed Feb 12, 2017
1 parent 5b66c1f commit 10227cf
Show file tree
Hide file tree
Showing 24 changed files with 125 additions and 87 deletions.
28 changes: 15 additions & 13 deletions .kitchen.docker.yml
@@ -1,7 +1,7 @@
driver:
name: dokken
chef_version: latest
privileged: true # because Docker and SystemD/Upstart
chef_version: current

transport:
name: dokken
Expand All @@ -19,76 +19,78 @@ platforms:
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install lsb-release -y
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: debian-8
driver:
image: debian:8
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install lsb-release -y
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: centos-6
driver:
image: centos:6
platform: rhel
pid_one_command: /sbin/init
intermediate_instructions:
- RUN yum -y install which initscripts
- RUN yum -y install which initscripts net-tools wget

- name: centos-7
driver:
image: centos:7
platform: rhel
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN yum -y install lsof which systemd-sysv initscripts
- RUN yum -y install lsof which systemd-sysv initscripts wget net-tools

- name: fedora-latest
driver:
image: fedora:latest
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN dnf -y install yum which systemd-sysv initscripts
- RUN dnf -y install which systemd-sysv initscripts wget net-tools

- name: ubuntu-12.04
driver:
image: ubuntu-upstart:12.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: ubuntu-14.04
driver:
image: ubuntu-upstart:14.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: ubuntu-16.04
driver:
image: ubuntu:16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: opensuse-13.2
driver:
image: opensuse:13.2
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which net-tools

- name: opensuse-42.1
- name: opensuse-leap
driver:
image: opensuse:42.1
image: opensuse:leap
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which hostname

suites:
- name: alltherubies
- name: default
run_list:
- recipe[ruby_build]
- recipe[alltherubies]
- recipe[test]
15 changes: 4 additions & 11 deletions .kitchen.yml
Expand Up @@ -11,24 +11,17 @@ platforms:
- name: centos-6.8
- name: centos-7.2
- name: debian-7.11
run_list: apt::default
- name: debian-8.5
run_list: apt::default
- name: fedora-24
run_list: yum::dnf_yum_compat
- name: debian-8.6
- name: fedora-25
- name: opensuse-13.2
- name: opensuse-leap-42.1
- name: ubuntu-12.04
run_list: apt::default
- name: ubuntu-14.04
run_list: apt::default
- name: ubuntu-16.04
run_list: apt::default
- name: freebsd-9.3
- name: freebsd-10.3

suites:
- name: alltherubies
- name: default
run_list:
- recipe[ruby_build]
- recipe[alltherubies]
- recipe[test]
5 changes: 5 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,5 @@
# rubocop todo

Style/IdenticalConditionalBranches:
Exclude:
- 'recipes/default.rb'
24 changes: 11 additions & 13 deletions .travis.yml
Expand Up @@ -5,7 +5,7 @@ dist: trusty
addons:
apt:
sources:
- chef-current-trusty
- chef-stable-trusty
packages:
- chefdk

Expand All @@ -20,27 +20,25 @@ services: docker

env:
matrix:
- INSTANCE=alltherubies-centos-7
- INSTANCE=alltherubies-debian-7
- INSTANCE=alltherubies-debian-8
- INSTANCE=alltherubies-fedora-latest
- INSTANCE=alltherubies-ubuntu-1204
- INSTANCE=alltherubies-ubuntu-1404
- INSTANCE=alltherubies-ubuntu-1604
- INSTANCE=default-centos-7
- INSTANCE=default-debian-7
- INSTANCE=default-debian-8
- INSTANCE=default-fedora-latest
- INSTANCE=default-ubuntu-1204
- INSTANCE=default-ubuntu-1404
- INSTANCE=default-ubuntu-1604

before_script:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/cookstyle --version
- /opt/chefdk/embedded/bin/foodcritic --version

script: KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}

matrix:
include:
- before_script:
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/cookstyle --version
- /opt/chefdk/embedded/bin/foodcritic --version
- script:
- /opt/chefdk/bin/chef exec rake
env: UNIT_AND_LINT=1
5 changes: 1 addition & 4 deletions Berksfile
Expand Up @@ -3,8 +3,5 @@ source 'https://supermarket.chef.io'
metadata

group :integration do
cookbook 'alltherubies', path: './test/cookbooks/alltherubies'
cookbook 'apt'
cookbook 'user'
cookbook 'yum'
cookbook 'test', path: './test/cookbooks/test'
end
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,3 @@
# Community Guidelines

This project follows the Chef Community Guidelines <https://docs.chef.io/community_guidelines.html>
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,22 @@
# Contributing

## Branches

### `master` branch

The master branch is the current comitted changes. These changes may not yet be released although we try to release often.

## Tags

All releases are tagged in git. To see the releases available to you see the changelog or the tags directly.


## Pull requests

- <https://github.com/sous-chefs/ruby_build/pulls>

## Issues

Need to report an issue? Use the github issues:

- <https://github.com/sous-chefs/ruby_build/issues>
19 changes: 7 additions & 12 deletions Gemfile
@@ -1,15 +1,10 @@
# This gemfile provides additional gems for testing and releasing this cookbook
# It is meant to be installed on top of ChefDK which provides the majority
# of the necessary gems for testing this cookbook
#
# Run 'chef exec bundle install' to install these dependencies

source 'https://rubygems.org'

gem 'berkshelf', '>= 4.3'
gem 'chefspec', '~> 4.6'
gem 'cookstyle'
gem 'foodcritic', '~> 7.0'
gem 'kitchen-dokken'
gem 'kitchen-inspec', '>= 0.14'
gem 'kitchen-vagrant', '>= 0.20'
gem 'rake'
gem 'stove'
gem 'test-kitchen', '>= 1.10'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'rake'
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# ruby-build Chef Cookbook

[![Build Status](https://travis-ci.org/chef-rbenv/ruby_build.svg?branch=master)](https://travis-ci.org/chef-rbenv/ruby_build)
[![Build Status](https://travis-ci.org/sous-chefs/ruby_build.svg?branch=master)](https://travis-ci.org/sous-chefs/ruby_build)

## Description

Expand Down
19 changes: 11 additions & 8 deletions Rakefile
Expand Up @@ -8,7 +8,7 @@ namespace :style do

desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby)
rescue LoadError
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI']
end

Expand All @@ -19,10 +19,11 @@ namespace :style do
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any'],
progress: true
progress: true,
exclude: 'spec',
}
end
rescue LoadError
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI']
end
end
Expand All @@ -32,10 +33,11 @@ task style: ['style:chef', 'style:ruby']

# ChefSpec
begin
desc 'Run ChefSpec examples'
require 'rspec/core/rake_task'

desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI']
end

Expand All @@ -46,17 +48,18 @@ namespace :integration do

desc 'Run kitchen integration tests'
Kitchen::RakeTasks.new
rescue LoadError => e
rescue LoadError, StandardError => e
puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI']
end
end

namespace :supermarket do
begin
desc 'Publish cookbook to Supermarket with Stove'
require 'stove/rake_task'

desc 'Publish cookbook to Supermarket with Stove'
Stove::RakeTask.new
rescue LoadError
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI']
end
end
Expand Down
2 changes: 2 additions & 0 deletions TESTING.md
@@ -0,0 +1,2 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD
1 change: 1 addition & 0 deletions libraries/matchers.rb
Expand Up @@ -4,6 +4,7 @@
def install_ruby_build_ruby(name)
ChefSpec::Matchers::ResourceMatcher.new(:ruby_build_ruby, :install, name)
end

def reinstall_ruby_build_ruby(name)
ChefSpec::Matchers::ResourceMatcher.new(:ruby_build_ruby, :reinstall, name)
end
Expand Down
8 changes: 4 additions & 4 deletions metadata.rb
@@ -1,6 +1,6 @@
name 'ruby_build'
maintainer 'Fletcher Nichol'
maintainer_email 'fnichol@nichol.ca'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache 2.0'
description 'Manages the ruby-build framework and its installed rubies. A LWRP is also defined.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
Expand All @@ -21,6 +21,6 @@

depends 'yum-epel'

source_url 'https://github.com/chef-rbenv/ruby_build'
issues_url 'https://github.com/chef-rbenv/ruby_build/issues'
source_url "https://github.com/sous-chefs/#{name}"
issues_url "https://github.com/sous-chefs/#{name}/issues"
chef_version '>= 12.1' if respond_to?(:chef_version)
10 changes: 0 additions & 10 deletions test/cookbooks/alltherubies/metadata.rb

This file was deleted.

File renamed without changes.
10 changes: 10 additions & 0 deletions test/cookbooks/test/metadata.rb
@@ -0,0 +1,10 @@
name 'test'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache 2.0'
description 'Installs all-the-rubies via ruby_build cookbook'
version '1.0.0'

depends 'ruby_build'
depends 'java'
depends 'user'
@@ -1,5 +1,5 @@
#
# Cookbook Name:: alltherubies
# Cookbook Name:: test
# Recipe:: default
#
# Copyright 2012-2016, Fletcher Nichol
Expand All @@ -17,22 +17,20 @@
# limitations under the License.
#

cores = node['cpu']['total'].to_i
system_rubies = %w( 2.1.9 2.2.5 2.3.1 jruby-9.0.5.0 )
apt_update 'update'

include_recipe 'java'
include_recipe 'ruby_build'

package 'default-jre-headless' if %(ubuntu debian).include?(node['platform'])

package 'bash' if node['platform_family'] == 'freebsd'

java_alternatives 'force setting java alternatives' do
action :set
end

system_rubies.each do |rubie|
%w( 2.1.9 2.2.6 2.3.3 2.4.0 jruby-9.1.7.0 ).each do |rubie|
ruby_build_ruby rubie do
environment('MAKE_OPTS' => "-j #{cores + 1}")
environment('MAKE_OPTS' => "-j #{node['cpu']['total'].to_i + 1}")
end
end

Expand Down

0 comments on commit 10227cf

Please sign in to comment.