Skip to content

Commit

Permalink
Try to align the CI with vscode file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Stevens committed Oct 3, 2019
1 parent 26e3634 commit e3a7903
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 33 deletions.
30 changes: 30 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
lint_and_unit: &lint_and_unit
- delivery
- danger
- lint-yaml
- lint-markdown

version: 2.1
orbs:
kitchen: sous-chefs/kitchen@2

workflows:
kitchen:
jobs:
# Lint and Unit Test
- kitchen/yamllint:
name: lint-yaml
- kitchen/mdlint:
name: lint-markdown
- kitchen/danger:
name: danger
context: Danger
- kitchen/delivery:
name: delivery

- kitchen/dokken-single:
name: default
suite: default
requires:
*lint_and_unit
40 changes: 40 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Reference: http://danger.systems/reference.html

# A pull request summary is required. Add a description of the pull request purpose.
# Changelog must be updated for each pull request that changes code.
# Warnings will be issued for:
# Pull request with more than 400 lines of code changed
# Pull reqest that change more than 5 lines without test changes
# Failures will be issued for:
# Pull request without summary
# Pull requests with code changes without changelog entry

def code_changes?
code = %w(libraries attributes recipes resources files templates)
code.each do |location|
return true unless git.modified_files.grep(/#{location}/).empty?
end
false
end

def test_changes?
tests = %w(spec test .kitchen.yml .kitchen.dokken.yml)
tests.each do |location|
return true unless git.modified_files.grep(/#{location}/).empty?
end
false
end

fail 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10

warn 'This is a big Pull Request.' if git.lines_of_code > 400

# Require a CHANGELOG entry for non-test changes.
if !git.modified_files.include?('CHANGELOG.md') && code_changes?
fail 'Please include a CHANGELOG entry.'
end

# A sanity check for tests.
if git.lines_of_code > 5 && code_changes? && !test_changes?
warn 'This Pull Request is probably missing tests.'
end
26 changes: 6 additions & 20 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
chef_version: <%= ENV['CHEF_VERSION'] || 'current' %>
# because Docker and SystemD/Upstart
privileged: true
env: [CHEF_LICENSE=accept]

transport:
name: dokken

provisioner:
name: dokken
deprecations_as_errors: true
product_name: chef
product_version: <%= ENV['CHEF_VERSION'] || 'latest' %>
install_strategy: once

verifier:
name: inspec
Expand All @@ -33,11 +36,6 @@ platforms:
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: centos-6
driver:
image: dokken/centos-6
pid_one_command: /sbin/init

- name: centos-7
driver:
image: dokken/centos-7
Expand All @@ -48,13 +46,6 @@ platforms:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd

- name: ubuntu-14.04
driver:
image: dokken/ubuntu-14.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
Expand All @@ -68,8 +59,3 @@ platforms:
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: opensuse-leap
driver:
image: dokken/opensuse-leap
pid_one_command: /bin/systemd
18 changes: 9 additions & 9 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ driver:

provisioner:
name: chef_zero
deprecations_as_errors: true
chef_license: accept-no-persist
product_name: chef
product_version: <%= ENV['CHEF_VERSION'] || 'latest' %>
install_strategy: once

client_rb:
treat_deprecation_warnings_as_errors: true

verifier:
name: inspec

platforms:
- name: amazonlinux
driver_config:
box: mvbcoding/awslinux
- name: centos-6
- name: centos-7
- name: debian-8
- name: debian-9
- name: fedora-28
- name: opensuse-leap-42
- name: ubuntu-14.04
- name: ubuntu-16.04
- name: ubuntu-18.04
- name: amazonlinux
driver_config:
box: mvbcoding/awslinux

suites:
- name: default
Expand Down
6 changes: 3 additions & 3 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

recipe 'memcached::default', 'Installs and configures memcached'

source_url 'https://github.com/chef-cookbooks/memcached'
issues_url 'https://github.com/chef-cookbooks/memcached/issues'
chef_version '>= 12.7'
source_url 'https://github.com/sous-chefs/memcached'
issues_url 'https://github.com/sous-chefs/memcached/issues'
chef_version '>= 13.8'
2 changes: 1 addition & 1 deletion spec/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
end

context 'on ubuntu' do
let(:chef_run) { ChefSpec::ServerRunner.new(step_into: ['memcached_instance'], platform: 'ubuntu', version: '14.04').converge(described_recipe) }
let(:chef_run) { ChefSpec::ServerRunner.new(step_into: ['memcached_instance'], platform: 'ubuntu', version: '16.04').converge(described_recipe) }

it 'installs memcached package' do
expect(chef_run).to install_package('memcached')
Expand Down

0 comments on commit e3a7903

Please sign in to comment.