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

Add CI workflow #404

Merged
merged 3 commits into from
Nov 14, 2023
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
10 changes: 5 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: bundler
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
94 changes: 94 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
name: Lint & Unit

"on":
pull_request:
push:
branches:
- main

jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Run yaml Lint
uses: actionshub/yamllint@main

chefstyle:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
ruby: ["3.1"]
name: Chefstyle on Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- uses: r7kamura/rubocop-problem-matchers-action@v1
- run: bundle exec chefstyle

unit:
name: Unit test on Ruby ${{ matrix.ruby }}
needs: [yamllint, chefstyle]
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["2.7", "3.0", "3.1"]
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake spec

integration-windows:
name: Windows ${{matrix.suite}} $${{matrix.os}}
runs-on: windows-latest
needs: unit
strategy:
fail-fast: false
matrix:
suite: [default]
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
- run: bundle exec kitchen test ${{ matrix.suite }}-${{ matrix.os }}

integration-linux:
name: Linux ${{matrix.suite}} $${{matrix.os}}
runs-on: windows-latest
needs: unit
strategy:
fail-fast: false
matrix:
suite: [default, context, capabilities, arm64, amd64, inspec]
os:
- amazonlinux-2
- ubuntu-18.04
- ubuntu-20.04
- fedora-latest
- centos-7
- centos-8
- oraclelinux-7
- rockylinux-8
- debian-9
- debian-10
- opensuse-15
- dockerfile
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
- run: bundle exec kitchen test ${{ matrix.suite }}-${{ matrix.os }}
33 changes: 0 additions & 33 deletions .kitchen.windows.yml

This file was deleted.

65 changes: 0 additions & 65 deletions .kitchen.yml

This file was deleted.

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

This file was deleted.

15 changes: 15 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
extends: default
rules:
line-length:
max: 256
level: warning
document-start: disable
braces:
forbid: false
min-spaces-inside: 0
max-spaces-inside: 1
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
comments:
min-spaces-from-content: 1
1 change: 1 addition & 0 deletions kitchen-docker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'fuubar', '~> 2.0'
spec.add_development_dependency 'simplecov', '~> 0.9'
spec.add_development_dependency 'codecov', '~> 0.0', '>= 0.0.2'
spec.add_development_dependency 'chefstyle'

# Integration testing gems.
spec.add_development_dependency 'kitchen-inspec', '~> 2.0'
Expand Down
33 changes: 33 additions & 0 deletions kitchen.windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# <% # Make sure the local copy of the driver is loaded %>
# <% lib = File.expand_path('../lib', __FILE__) %>
# <% $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) %>
---
driver:
name: docker
provision_command:
- powershell -ExecutionPolicy Bypass -NoLogo -Command . { iwr -useb https://omnitruck.chef.io/install.ps1 } ^| iex; install
- powershell -Command $path=$env:Path + ';c:\opscode\chef\embedded\bin'; Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $path

transport:
name: docker
socket: tcp://localhost:2375

provisioner:
name: dummy

platforms:
- name: windows
driver_config:
image: mcr.microsoft.com/windows/servercore:1809
platform: windows

suites:
- name: default
- name: context
driver:
build_context: false
- name: inspec
driver:
provision_command: echo 1
verifier:
name: inspec
65 changes: 65 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# <% # Make sure the local copy of the driver is loaded %>
# <% lib = File.expand_path('../lib', __FILE__) %>
# <% $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) %>
---
driver:
name: docker
provision_command: curl -L https://www.chef.io/chef/install.sh | bash

transport:
name: docker

provisioner:
name: dummy

platforms:
- name: amazonlinux-2
- name: ubuntu-18.04
- name: ubuntu-20.04
- name: fedora-latest
driver:
provision_command:
- yum install libxcrypt-compat -y
- curl -L https://www.chef.io/chef/install.sh | bash
- name: centos-7
- name: oraclelinux-7
- name: rockylinux-8
- name: debian-9
- name: debian-10
- name: opensuse-15
driver:
image: opensuse/leap:15
- name: dockerfile
driver:
username: dockerfile
password: dockerfile
dockerfile: test/Dockerfile
run_command: /sbin/init

suites:
- name: default
excludes: [arch, debian-9]
- name: context
excludes: [arch, debian-9]
driver:
build_context: false
- name: capabilities
includes: [debian-10, ubuntu-18.04, ubuntu-20.04]
driver:
provision_command:
- curl -L https://www.chef.io/chef/install.sh | bash
- apt-get install -y net-tools
cap_drop:
- NET_ADMIN
- name: arm64
excludes: [debian-9]
driver:
docker_platform: linux/arm64
- name: amd64
driver:
docker_platform: linux/amd64
- name: inspec
driver:
provision_command: true
verifier:
name: inspec
Loading