Skip to content

Commit

Permalink
Migrate CI to GH Actions
Browse files Browse the repository at this point in the history
* Remove Travis config
* Migrate from berkshelf to policyfile
* Update kitchen config paths

Change-Id: I072cf26b3ebdb7779de0def6e1b844504c0ce89a
  • Loading branch information
josqu4red committed Oct 24, 2022
1 parent 46d9a43 commit 0498317
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 41 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/criteo-cookbooks-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Criteo Cookbooks CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
rspec:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: bundle exec rubocop --version
- run: bundle exec rubocop
- run: bundle exec foodcritic --version
- run: bundle exec foodcritic . --exclude spec -f any
- run: bundle exec rspec
kitchen:
needs: [rspec]
runs-on: ubuntu-latest
strategy:
matrix:
instance: ['default-centos-7']
steps:
- uses: shimataro/ssh-key-action@v2
with:
key: ${{secrets.AWS_SSH_PRIVATE_KEY}}
known_hosts: unnecessary
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: CHEF_LICENSE='accept-no-persist' KITCHEN_LOCAL_YAML=kitchen.yml bundle exec kitchen test ${{ matrix.instance }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SSH_KEY_ID: ${{ secrets.AWS_SSH_KEY_ID }}
AWS_SUBNET: ${{ secrets.AWS_SUBNET }}
AWS_SECURITY_GROUP: ${{ secrets.AWS_SECURITY_GROUP }}
supermarket:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [kitchen]
steps:
- uses: actions/checkout@v2
- name: Publish to supermarket
uses: afaundez/chef-supermarket-action@8cdbe1cccbe1ecd8685b2ea8f48780135bae7cee
with:
user: criteo
cookbook: librenms
category: Utilities
env:
SUPERMARKET_API_KEY: ${{ secrets.SUPERMARKET_API_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bin/*
.kitchen.local.yml

.cookbook_version
Policyfile.lock.json
4 changes: 0 additions & 4 deletions .kitchen_suites.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

Binary file removed .travis/client.pem.enc
Binary file not shown.
Binary file removed .travis/travis-ci.pem.enc
Binary file not shown.
6 changes: 0 additions & 6 deletions Berksfile

This file was deleted.

7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
source 'https://rubygems.org'

gem 'berkshelf'
gem 'kitchen-vagrant'
gem 'chefspec'
gem 'rake'
gem 'foodcritic'
gem 'chef-zero-scheduled-task'
gem 'chef'
gem 'chef', '= 14.7.17'
gem 'chef-dk'

gem 'kitchen-transport-speedy'
group :ec2 do
gem 'test-kitchen'
gem 'kitchen-ec2', git: 'https://github.com/criteo-forks/kitchen-ec2.git', branch: 'criteo'
gem 'kitchen-ec2'
gem 'winrm', '>= 1.6'
gem 'winrm-fs', '>= 0.3'
gem 'dotenv'
Expand Down
6 changes: 6 additions & 0 deletions Policyfile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name 'librenms'

run_list ['librenms']

default_source :community
cookbook 'librenms', path: '.'
2 changes: 1 addition & 1 deletion chefignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ Procfile
.rubocop.yml
spec/*
Rakefile
.travis.yml
.foodcritic
.codeclimate.yml
.github

# SCM #
#######
Expand Down
5 changes: 4 additions & 1 deletion .kitchen.ec2.yml → kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ platforms:
image_id: ami-d2c924b2

suites:
<%= require 'erubis'; Erubis::Eruby.new(File.read('.kitchen_suites.yml')).evaluate %>
- name: default
run_list:
- recipe[librenms::default]
attributes:
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require 'chefspec'
require 'chefspec/berkshelf'
require 'chefspec/policyfile'

0 comments on commit 0498317

Please sign in to comment.