Skip to content

Commit

Permalink
ci: enable Vagrant-based testing using GitHub Actions
Browse files Browse the repository at this point in the history
* Semi-automated using myii/ssf-formula#304
  • Loading branch information
myii committed Mar 26, 2021
1 parent c247b83 commit 290c8b4
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 30 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/kitchen.vagrant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
name: 'Kitchen Vagrant (FreeBSD & Windows)'
'on': ['push', 'pull_request']

env:
KITCHEN_LOCAL_YAML: 'kitchen.vagrant.yml'

jobs:
test:
runs-on: 'macos-10.15'
strategy:
fail-fast: false
matrix:
instance:
# - default-freebsd-122-latest-py3
# - default-freebsd-114-latest-py3
- default-windows-81-latest-py3
steps:
- name: 'Check out code'
uses: 'actions/checkout@v2'
- name: 'Set up Bundler cache'
uses: 'actions/cache@v1'
with:
path: 'vendor/bundle'
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
restore-keys: "${{ runner.os }}-gems-"
- name: 'Run Bundler'
run: |
ruby --version
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: 'Run Test Kitchen'
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
100 changes: 74 additions & 26 deletions .github/workflows/kitchen.windows.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,101 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
name: 'Kitchen (Windows)'

'on': [push, pull_request]
'on': ['push', 'pull_request']

env:
machine_user: kitchen
machine_pass: Pass@word1
machine_port: 5985
KITCHEN_LOCAL_YAML: kitchen.windows.yml
KITCHEN_LOCAL_YAML: 'kitchen.windows.yml'

jobs:
test:
runs-on: windows-latest

test-2019:
runs-on: 'windows-2019'
strategy:
fail-fast: false
matrix:
instance:
- default-windows-2019-latest-py3
steps:
- name: 'Check out code'
uses: 'actions/checkout@v2'
- name: 'Install Chef'
uses: 'actionshub/chef-install@1.1.0'
with:
project: 'chef'
version: '16.10.8'
- name: 'Add Chef bindir to PATH'
uses: 'myci-actions/export-env-var-powershell@1'
with:
name: 'PATH'
value: "C:\\opscode\\chef\\bin;\
C:\\opscode\\chef\\embedded\\bin;$env:PATH"
- name: 'Set up Bundler cache'
uses: 'actions/cache@v1'
with:
path: 'vendor/bundle'
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
restore-keys: "${{ runner.os }}-gems-"
- name: 'Set up test user'
run: |
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
New-LocalUser $env:machine_user -Password $password
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
- name: 'Set up WinRM'
run: >
Set-WSManQuickConfig -Force;
Set-WSManInstance -ResourceURI winrm/config/service
-ValueSet @{AllowUnencrypted="true"}
- name: 'Run Bundler'
run: |
ruby --version
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: 'Run Test Kitchen'
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
test-2016:
runs-on: 'windows-2016'
strategy:
fail-fast: false
matrix:
instance:
- default-windows-2016-latest-py3
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install Chef
uses: actionshub/chef-install@1.1.0
- name: 'Check out code'
uses: 'actions/checkout@v2'
- name: 'Install Chef'
uses: 'actionshub/chef-install@1.1.0'
with:
project: chef
version: 16.10.8
- name: Add Chef bindir to PATH
uses: myci-actions/export-env-var-powershell@1
project: 'chef'
version: '16.10.8'
- name: 'Add Chef bindir to PATH'
uses: 'myci-actions/export-env-var-powershell@1'
with:
name: PATH
name: 'PATH'
value: "C:\\opscode\\chef\\bin;\
C:\\opscode\\chef\\embedded\\bin;$env:PATH"
- name: Set up Bundler cache
uses: actions/cache@v1
- name: 'Set up Bundler cache'
uses: 'actions/cache@v1'
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Set up test user
path: 'vendor/bundle'
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
restore-keys: "${{ runner.os }}-gems-"
- name: 'Set up test user'
run: |
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
New-LocalUser $env:machine_user -Password $password
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
- name: Set up WinRM
- name: 'Set up WinRM'
run: >
Set-WSManQuickConfig -Force;
Set-WSManInstance -ResourceURI winrm/config/service
-ValueSet @{AllowUnencrypted="true"}
- name: Run Bundler
- name: 'Run Bundler'
run: |
ruby --version
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run Test Kitchen
run: bundle exec kitchen verify
- name: 'Run Test Kitchen'
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
27 changes: 24 additions & 3 deletions kitchen.vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@
---
driver:
name: vagrant
cache_directory: false
customize:
usbxhci: 'off'
gui: false
linked_clone: true
ssh:
shell: /bin/sh

platforms:
- name: windows
- name: freebsd-122-latest-py3
driver:
box: bento/freebsd-12.2
- name: freebsd-114-latest-py3
driver:
box: bento/freebsd-11.4
- name: windows-81-latest-py3
driver:
box: techneg/win81x64-pro-salt
gui: false
linked_clone: true
cache_directory: "/omnibus/cache"
customize: {}
ssh: {}
provisioner:
salt_install: none
# yamllint disable rule:line-length
init_environment: |
# Workaround to allow `kitchen converge` to be used multiple times
# without having to `kitchen destroy` first: remove state files cached by
Expand All @@ -22,3 +38,8 @@ platforms:
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls `
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls `
skip_verify=True makedirs=True
exit 0
# yamllint enable rule:line-length

provisioner:
salt_install: bootstrap
7 changes: 6 additions & 1 deletion kitchen.windows.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
driver:
name: proxy
Expand All @@ -8,13 +10,16 @@ driver:
password: Pass@word1

platforms:
- name: windows
- name: windows-2019-latest-py3
- name: windows-2016-latest-py3

provisioner:
salt_install: bootstrap
salt_bootstrap_options: -pythonVersion 3
# yamllint disable rule:line-length
init_environment: |
C:\salt\salt-call --local state.single file.managed `
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls `
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls `
skip_verify=True makedirs=True
# yamllint enable rule:line-length

0 comments on commit 290c8b4

Please sign in to comment.