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

ci: enable Vagrant-based testing using GitHub Actions #143

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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# yamllint disable rule:indentation rule:line-length
# Windows-2016Server
---
values:
bin_dir: C:\Program Files\OpenVPN\bin\
conf_dir: C:\Program Files\OpenVPN\config
conf_ext: ovpn
dh_files:
- '512'
dsaparam: false
external_repo_enabled: false
external_repo_supported: []
external_repo_version: stable
group: nobody
log_user: null
map_jinja:
sources:
- Y:G@osarch
- Y:G@os_family
- Y:G@os
- Y:G@osfinger
- C@openvpn:lookup
- Y:G@id
multi_services: false
network_manager_pkgs:
- network-manager-openvpn
- network-manager-openvpn-gnome
pkgs:
- openvpn
service: OpenVPNService
service_function: running
user: nobody