2
0

ci: enable Vagrant-based testing using GitHub Actions

* Semi-automated using https://github.com/myii/ssf-formula/pull/304
This commit is contained in:
Imran Iqbal 2021-03-26 11:15:22 +00:00
parent 9816f473c5
commit 163c77fcee
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
7 changed files with 174 additions and 75 deletions

36
.github/workflows/kitchen.vagrant.yml vendored Normal file
View File

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
name: 'Kitchen Vagrant (FreeBSD, OpenBSD & 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:
- v3002-py3-freebsd-122-latest-py3
- v3002-py3-freebsd-114-latest-py3
- v3001-py3-openbsd-68-latest-py3
- v3002-py3-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 }}'

View File

@ -1,39 +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:
build:
runs-on: windows-latest
test-2019:
runs-on: 'windows-2019'
strategy:
fail-fast: false
matrix:
instance:
- v3002-py3-windows-2019-latest-py3
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
- name: 'Check out code'
uses: 'actions/checkout@v2'
- name: 'Install Chef'
uses: 'actionshub/chef-install@1.1.0'
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- shell: powershell
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
- shell: powershell
- name: 'Set up WinRM'
run: >
Set-WSManQuickConfig -Force;
Set-WSManInstance -ResourceURI winrm/config/service
-ValueSet @{AllowUnencrypted="true"}
- run: gem install bundler --quiet --no-document
- name: Bundle install
- name: 'Run Bundler'
run: |
ruby --version
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- run: bundle exec kitchen test
- name: 'Run Test Kitchen'
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
test-2016:
runs-on: 'windows-2016'
strategy:
fail-fast: false
matrix:
instance:
- v3002-py3-windows-2016-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 }}'

View File

@ -135,7 +135,7 @@ v3002-py3-fedora-33-3002-5-py3: {extends: '.test_instance'}
v3002-py3-amazonlinux-2-3002-5-py3: {extends: '.test_instance'}
v3002-py3-oraclelinux-8-3002-5-py3: {extends: '.test_instance'}
v3002-py3-oraclelinux-7-3002-5-py3: {extends: '.test_instance'}
# v3002-py3-arch-base-latest-3002-5-py3: {extends: '.test_instance'}
v3002-py3-arch-base-latest-3002-5-py3: {extends: '.test_instance'}
v3002-py3-gentoo-stage3-latest-3002-5-py3: {extends: '.test_instance'}
v3002-py3-gentoo-stage3-systemd-3002-5-py3: {extends: '.test_instance'}
v3001-py3-debian-10-3001-6-py3: {extends: '.test_instance'}

View File

@ -95,7 +95,7 @@ jobs:
- env: INSTANCE=v3002-py3-amazonlinux-2-3002-5-py3
- env: INSTANCE=v3002-py3-oraclelinux-8-3002-5-py3
- env: INSTANCE=v3002-py3-oraclelinux-7-3002-5-py3
# - env: INSTANCE=v3002-py3-arch-base-latest-3002-5-py3
- env: INSTANCE=v3002-py3-arch-base-latest-3002-5-py3
- env: INSTANCE=v3002-py3-gentoo-stage3-latest-3002-5-py3
- env: INSTANCE=v3002-py3-gentoo-stage3-systemd-3002-5-py3
- env: INSTANCE=v3001-py3-debian-10-3001-6-py3

View File

@ -3,37 +3,48 @@
---
driver:
name: vagrant
cache_directory: false
customize:
usbxhci: 'off'
gui: false
linked_clone: true
ssh:
shell: /bin/sh
platforms:
- name: windows-81
- name: freebsd-122-latest-py3
driver:
box: bento/freebsd-12.2
- name: freebsd-114-latest-py3
driver:
box: bento/freebsd-11.4
- name: openbsd-68-latest-py3
driver:
box: generic/openbsd6
ssh:
shell: /bin/ksh
- name: windows-81-latest-py3
driver:
box: techneg/win81x64-pro-salt
gui: false
linked_clone: true
cache_directory: "/omnibus/cache"
customize: {}
ssh: {}
provisioner:
init_environment: >
salt-call --local state.single file.managed
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-minion-py3.sls
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/salt-minion-py3.sls
skip_verify=True makedirs=True
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
# Salt during the previous `converge` (if present)
rm -recurse `
C:\Users\vagrant\AppData\Local\Temp\kitchen\var\cache\salt\minion\files\base `
-ErrorAction SilentlyContinue
salt-call --local state.single file.managed `
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-minion-py3.sls `
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/salt-minion-py3.sls `
skip_verify=True makedirs=True
exit 0
# yamllint enable rule:line-length
suites:
- name: v3000-py3
provisioner:
state_top:
base:
'*':
- salt._mapdata
- salt.minion
pillars:
top.sls:
base:
'*':
- salt
- v3000-py3
pillars_from_files:
salt.sls: test/salt/pillar/salt.sls
v3000-py3.sls: test/salt/pillar/v3000-py3.sls
verifier:
inspec_tests:
- path: test/integration/v3000-py3
provisioner:
salt_install: bootstrap

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
driver:
name: proxy
@ -8,34 +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 -version 3000.3
init_environment: >
C:\salt\salt-call --local state.single file.managed
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-minion-py3.sls
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/salt-minion-py3.sls
skip_verify=True makedirs=True
suites:
- name: v3000-py3
provisioner:
state_top:
base:
'*':
- salt._mapdata
- salt.minion
pillars:
top.sls:
base:
'*':
- salt
- v3000-py3
pillars_from_files:
salt.sls: test/salt/pillar/salt.sls
v3000-py3.sls: test/salt/pillar/v3000-py3.sls
verifier:
inspec_tests:
- path: test/integration/v3000-py3
salt_bootstrap_options: -pythonVersion 3 -version 3002.5
# 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\salt-minion-py3.sls `
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/salt-minion-py3.sls `
skip_verify=True makedirs=True
# yamllint enable rule:line-length

View File

@ -324,6 +324,11 @@ suites:
- arch-base-latest-3002-5-py3
- gentoo-stage3-latest-3002-5-py3
- gentoo-stage3-systemd-3002-5-py3
- freebsd-122-latest-py3
- freebsd-114-latest-py3
- windows-81-latest-py3
- windows-2019-latest-py3
- windows-2016-latest-py3
provisioner:
state_top:
base:
@ -363,6 +368,7 @@ suites:
- arch-base-latest-3001-6-py3
- gentoo-stage3-latest-3001-6-py3
- gentoo-stage3-systemd-3001-6-py3
- openbsd-68-latest-py3
provisioner:
state_top:
base: