Skip to content

Commit 0d1bd4a

Browse files
committed
ci: enable Vagrant-based testing using GitHub Actions
* Automated using myii/ssf-formula#312
1 parent b511c40 commit 0d1bd4a

File tree

6 files changed

+267
-0
lines changed

6 files changed

+267
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
name: 'Kitchen Vagrant (FreeBSD, OpenBSD & Windows)'
5+
'on': ['push', 'pull_request']
6+
7+
env:
8+
KITCHEN_LOCAL_YAML: 'kitchen.vagrant.yml'
9+
10+
jobs:
11+
test:
12+
runs-on: 'macos-10.15'
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
instance:
17+
- default-freebsd-130-master-py3
18+
# - archive-freebsd-130-master-py3
19+
# - source-freebsd-130-master-py3
20+
# - repo-freebsd-130-master-py3
21+
- default-freebsd-123-master-py3
22+
# - archive-freebsd-123-master-py3
23+
# - source-freebsd-123-master-py3
24+
# - repo-freebsd-123-master-py3
25+
# - default-freebsd-130-3004-0-py3
26+
# - default-freebsd-123-3004-0-py3
27+
- default-openbsd-70-3003-3-py3
28+
# - archive-openbsd-70-3003-3-py3
29+
- default-openbsd-69-3002-6-py3
30+
# - archive-openbsd-69-3002-6-py3
31+
- default-windows-10-latest-py3
32+
# - archive-windows-10-latest-py3
33+
- default-windows-81-latest-py3
34+
# - archive-windows-81-latest-py3
35+
steps:
36+
- name: 'Check out code'
37+
uses: 'actions/checkout@v2'
38+
- name: 'Set up Bundler cache'
39+
uses: 'actions/cache@v1'
40+
with:
41+
path: 'vendor/bundle'
42+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
43+
restore-keys: "${{ runner.os }}-gems-"
44+
- name: 'Run Bundler'
45+
run: |
46+
ruby --version
47+
bundle config path vendor/bundle
48+
bundle install --jobs 4 --retry 3
49+
- name: 'Run Test Kitchen'
50+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
name: 'Kitchen (Windows)'
5+
'on': ['push', 'pull_request']
6+
7+
env:
8+
machine_user: kitchen
9+
machine_pass: Pass@word1
10+
machine_port: 5985
11+
KITCHEN_LOCAL_YAML: 'kitchen.windows.yml'
12+
13+
jobs:
14+
test-2022:
15+
runs-on: 'windows-2022'
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
instance:
20+
- default-windows-2022-latest-py3
21+
# - archive-windows-2022-latest-py3
22+
steps:
23+
- name: 'Check out code'
24+
uses: 'actions/checkout@v2'
25+
- name: 'Install Chef'
26+
uses: 'actionshub/[email protected]'
27+
with:
28+
project: 'chef'
29+
version: '16.10.8'
30+
- name: 'Add Chef bindir to PATH'
31+
uses: 'myci-actions/export-env-var-powershell@1'
32+
with:
33+
name: 'PATH'
34+
value: "C:\\opscode\\chef\\bin;\
35+
C:\\opscode\\chef\\embedded\\bin;$env:PATH"
36+
- name: 'Set up Bundler cache'
37+
uses: 'actions/cache@v1'
38+
with:
39+
path: 'vendor/bundle'
40+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
41+
restore-keys: "${{ runner.os }}-gems-"
42+
- name: 'Set up test user'
43+
run: |
44+
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
45+
New-LocalUser $env:machine_user -Password $password
46+
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
47+
- name: 'Set up WinRM'
48+
run: |
49+
Set-WSManQuickConfig -Force
50+
- name: 'Run Bundler'
51+
run: |
52+
ruby --version
53+
bundle config path vendor/bundle
54+
bundle install --jobs 4 --retry 3
55+
- name: 'Run Test Kitchen'
56+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
57+
test-2019:
58+
runs-on: 'windows-2019'
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
instance:
63+
- default-windows-2019-latest-py3
64+
# - archive-windows-2019-latest-py3
65+
steps:
66+
- name: 'Check out code'
67+
uses: 'actions/checkout@v2'
68+
- name: 'Install Chef'
69+
uses: 'actionshub/[email protected]'
70+
with:
71+
project: 'chef'
72+
version: '16.10.8'
73+
- name: 'Add Chef bindir to PATH'
74+
uses: 'myci-actions/export-env-var-powershell@1'
75+
with:
76+
name: 'PATH'
77+
value: "C:\\opscode\\chef\\bin;\
78+
C:\\opscode\\chef\\embedded\\bin;$env:PATH"
79+
- name: 'Set up Bundler cache'
80+
uses: 'actions/cache@v1'
81+
with:
82+
path: 'vendor/bundle'
83+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
84+
restore-keys: "${{ runner.os }}-gems-"
85+
- name: 'Set up test user'
86+
run: |
87+
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
88+
New-LocalUser $env:machine_user -Password $password
89+
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
90+
- name: 'Set up WinRM'
91+
run: |
92+
Set-WSManQuickConfig -Force
93+
- name: 'Run Bundler'
94+
run: |
95+
ruby --version
96+
bundle config path vendor/bundle
97+
bundle install --jobs 4 --retry 3
98+
- name: 'Run Test Kitchen'
99+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ gem 'kitchen-docker', git: 'https://gitlab.com/saltstack-formulas/infrastructure
1717

1818
gem 'kitchen-inspec', '>= 2.5.0'
1919
gem 'kitchen-salt', '>= 0.7.2'
20+
21+
group :vagrant do
22+
gem 'kitchen-vagrant'
23+
end

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ GEM
387387
kitchen-salt (0.7.2)
388388
hashie (>= 3.5)
389389
test-kitchen (>= 1.4)
390+
kitchen-vagrant (1.11.0)
391+
test-kitchen (>= 1.4, < 4)
390392
license-acceptance (2.1.13)
391393
pastel (~> 0.7)
392394
tomlrb (>= 1.2, < 3.0)
@@ -669,6 +671,7 @@ DEPENDENCIES
669671
kitchen-docker!
670672
kitchen-inspec (>= 2.5.0)
671673
kitchen-salt (>= 0.7.2)
674+
kitchen-vagrant
672675

673676
BUNDLED WITH
674677
2.1.2

kitchen.vagrant.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
driver:
5+
name: vagrant
6+
cache_directory: false
7+
customize:
8+
usbxhci: 'off'
9+
gui: false
10+
ssh:
11+
shell: /bin/sh
12+
<% unless ENV['CI'] %>
13+
linked_clone: true
14+
synced_folders:
15+
- - '.kitchen/kitchen-vagrant/%{instance_name}/vagrant'
16+
- '/vagrant'
17+
- 'create: true, disabled: false'
18+
<% end %>
19+
20+
platforms:
21+
- name: freebsd-130-master-py3
22+
driver:
23+
box: myii/freebsd-13.0-master-py3
24+
- name: freebsd-123-master-py3
25+
driver:
26+
box: myii/freebsd-12.3-master-py3
27+
- name: freebsd-130-3004-0-py3
28+
driver:
29+
box: myii/freebsd-13.0-3004.0-py3
30+
- name: freebsd-123-3004-0-py3
31+
driver:
32+
box: myii/freebsd-12.3-3004.0-py3
33+
- name: openbsd-70-3003-3-py3
34+
driver:
35+
box: myii/openbsd-7.0-3003.3-py3
36+
ssh:
37+
shell: /bin/ksh
38+
synced_folders: []
39+
- name: openbsd-69-3002-6-py3
40+
driver:
41+
box: myii/openbsd-6.9-3002.6-py3
42+
ssh:
43+
shell: /bin/ksh
44+
synced_folders: []
45+
- name: windows-10-latest-py3
46+
driver:
47+
box: techneg/win10x64-pro-salt
48+
cache_directory: "/omnibus/cache"
49+
customize: {}
50+
ssh: {}
51+
provisioner:
52+
# yamllint disable rule:line-length
53+
init_environment: |
54+
# Workaround to allow `kitchen converge` to be used multiple times
55+
# without having to `kitchen destroy` first: remove state files cached by
56+
# Salt during the previous `converge` (if present)
57+
rm -recurse `
58+
C:\Users\vagrant\AppData\Local\Temp\kitchen\var\cache\salt\minion\files\base `
59+
-ErrorAction SilentlyContinue
60+
salt-call --local state.single file.managed `
61+
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\node.js.sls `
62+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/node.js.sls `
63+
skip_verify=True makedirs=True
64+
exit 0
65+
# yamllint enable rule:line-length
66+
- name: windows-81-latest-py3
67+
driver:
68+
box: techneg/win81x64-pro-salt
69+
cache_directory: "/omnibus/cache"
70+
customize: {}
71+
ssh: {}
72+
provisioner:
73+
# yamllint disable rule:line-length
74+
init_environment: |
75+
# Workaround to allow `kitchen converge` to be used multiple times
76+
# without having to `kitchen destroy` first: remove state files cached by
77+
# Salt during the previous `converge` (if present)
78+
rm -recurse `
79+
C:\Users\vagrant\AppData\Local\Temp\kitchen\var\cache\salt\minion\files\base `
80+
-ErrorAction SilentlyContinue
81+
salt-call --local state.single file.managed `
82+
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\node.js.sls `
83+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/node.js.sls `
84+
skip_verify=True makedirs=True
85+
exit 0
86+
# yamllint enable rule:line-length

kitchen.windows.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
driver:
5+
name: proxy
6+
host: localhost
7+
reset_command: "exit 0"
8+
port: 5985
9+
username: kitchen
10+
password: Pass@word1
11+
12+
provisioner:
13+
salt_install: bootstrap
14+
salt_bootstrap_options: -pythonVersion 3
15+
# yamllint disable rule:line-length
16+
init_environment: |
17+
salt-call --local state.single file.managed `
18+
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\node.js.sls `
19+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/node.js.sls `
20+
skip_verify=True makedirs=True
21+
# yamllint enable rule:line-length
22+
23+
platforms:
24+
- name: windows-2022-latest-py3
25+
- name: windows-2019-latest-py3

0 commit comments

Comments
 (0)