Skip to content

Commit 290c8b4

Browse files
committed
ci: enable Vagrant-based testing using GitHub Actions
* Semi-automated using myii/ssf-formula#304
1 parent c247b83 commit 290c8b4

File tree

4 files changed

+139
-30
lines changed

4 files changed

+139
-30
lines changed

.github/workflows/kitchen.vagrant.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
name: 'Kitchen Vagrant (FreeBSD & 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-122-latest-py3
18+
# - default-freebsd-114-latest-py3
19+
- default-windows-81-latest-py3
20+
steps:
21+
- name: 'Check out code'
22+
uses: 'actions/checkout@v2'
23+
- name: 'Set up Bundler cache'
24+
uses: 'actions/cache@v1'
25+
with:
26+
path: 'vendor/bundle'
27+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
28+
restore-keys: "${{ runner.os }}-gems-"
29+
- name: 'Run Bundler'
30+
run: |
31+
ruby --version
32+
bundle config path vendor/bundle
33+
bundle install --jobs 4 --retry 3
34+
- name: 'Run Test Kitchen'
35+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'

.github/workflows/kitchen.windows.yml

Lines changed: 74 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,101 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
13
---
24
name: 'Kitchen (Windows)'
3-
4-
'on': [push, pull_request]
5+
'on': ['push', 'pull_request']
56

67
env:
78
machine_user: kitchen
89
machine_pass: Pass@word1
910
machine_port: 5985
10-
KITCHEN_LOCAL_YAML: kitchen.windows.yml
11+
KITCHEN_LOCAL_YAML: 'kitchen.windows.yml'
1112

1213
jobs:
13-
test:
14-
runs-on: windows-latest
15-
14+
test-2019:
15+
runs-on: 'windows-2019'
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
instance:
20+
- default-windows-2019-latest-py3
21+
steps:
22+
- name: 'Check out code'
23+
uses: 'actions/checkout@v2'
24+
- name: 'Install Chef'
25+
uses: 'actionshub/[email protected]'
26+
with:
27+
project: 'chef'
28+
version: '16.10.8'
29+
- name: 'Add Chef bindir to PATH'
30+
uses: 'myci-actions/export-env-var-powershell@1'
31+
with:
32+
name: 'PATH'
33+
value: "C:\\opscode\\chef\\bin;\
34+
C:\\opscode\\chef\\embedded\\bin;$env:PATH"
35+
- name: 'Set up Bundler cache'
36+
uses: 'actions/cache@v1'
37+
with:
38+
path: 'vendor/bundle'
39+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
40+
restore-keys: "${{ runner.os }}-gems-"
41+
- name: 'Set up test user'
42+
run: |
43+
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
44+
New-LocalUser $env:machine_user -Password $password
45+
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
46+
- name: 'Set up WinRM'
47+
run: >
48+
Set-WSManQuickConfig -Force;
49+
Set-WSManInstance -ResourceURI winrm/config/service
50+
-ValueSet @{AllowUnencrypted="true"}
51+
- name: 'Run Bundler'
52+
run: |
53+
ruby --version
54+
bundle config path vendor/bundle
55+
bundle install --jobs 4 --retry 3
56+
- name: 'Run Test Kitchen'
57+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
58+
test-2016:
59+
runs-on: 'windows-2016'
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
instance:
64+
- default-windows-2016-latest-py3
1665
steps:
17-
- name: Check out code
18-
uses: actions/checkout@v2
19-
- name: Install Chef
20-
uses: actionshub/[email protected]
66+
- name: 'Check out code'
67+
uses: 'actions/checkout@v2'
68+
- name: 'Install Chef'
69+
uses: 'actionshub/[email protected]'
2170
with:
22-
project: chef
23-
version: 16.10.8
24-
- name: Add Chef bindir to PATH
25-
uses: myci-actions/export-env-var-powershell@1
71+
project: 'chef'
72+
version: '16.10.8'
73+
- name: 'Add Chef bindir to PATH'
74+
uses: 'myci-actions/export-env-var-powershell@1'
2675
with:
27-
name: PATH
76+
name: 'PATH'
2877
value: "C:\\opscode\\chef\\bin;\
2978
C:\\opscode\\chef\\embedded\\bin;$env:PATH"
30-
- name: Set up Bundler cache
31-
uses: actions/cache@v1
79+
- name: 'Set up Bundler cache'
80+
uses: 'actions/cache@v1'
3281
with:
33-
path: vendor/bundle
34-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
35-
restore-keys: |
36-
${{ runner.os }}-gems-
37-
- name: Set up test user
82+
path: 'vendor/bundle'
83+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
84+
restore-keys: "${{ runner.os }}-gems-"
85+
- name: 'Set up test user'
3886
run: |
3987
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
4088
New-LocalUser $env:machine_user -Password $password
4189
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
42-
- name: Set up WinRM
90+
- name: 'Set up WinRM'
4391
run: >
4492
Set-WSManQuickConfig -Force;
4593
Set-WSManInstance -ResourceURI winrm/config/service
4694
-ValueSet @{AllowUnencrypted="true"}
47-
- name: Run Bundler
95+
- name: 'Run Bundler'
4896
run: |
4997
ruby --version
5098
bundle config path vendor/bundle
5199
bundle install --jobs 4 --retry 3
52-
- name: Run Test Kitchen
53-
run: bundle exec kitchen verify
100+
- name: 'Run Test Kitchen'
101+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'

kitchen.vagrant.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,30 @@
33
---
44
driver:
55
name: vagrant
6+
cache_directory: false
7+
customize:
8+
usbxhci: 'off'
9+
gui: false
10+
linked_clone: true
11+
ssh:
12+
shell: /bin/sh
613

714
platforms:
8-
- name: windows
15+
- name: freebsd-122-latest-py3
16+
driver:
17+
box: bento/freebsd-12.2
18+
- name: freebsd-114-latest-py3
19+
driver:
20+
box: bento/freebsd-11.4
21+
- name: windows-81-latest-py3
922
driver:
1023
box: techneg/win81x64-pro-salt
11-
gui: false
12-
linked_clone: true
24+
cache_directory: "/omnibus/cache"
25+
customize: {}
26+
ssh: {}
1327
provisioner:
28+
salt_install: none
29+
# yamllint disable rule:line-length
1430
init_environment: |
1531
# Workaround to allow `kitchen converge` to be used multiple times
1632
# without having to `kitchen destroy` first: remove state files cached by
@@ -22,3 +38,8 @@ platforms:
2238
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls `
2339
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls `
2440
skip_verify=True makedirs=True
41+
exit 0
42+
# yamllint enable rule:line-length
43+
44+
provisioner:
45+
salt_install: bootstrap

kitchen.windows.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
13
---
24
driver:
35
name: proxy
@@ -8,13 +10,16 @@ driver:
810
password: Pass@word1
911

1012
platforms:
11-
- name: windows
13+
- name: windows-2019-latest-py3
14+
- name: windows-2016-latest-py3
1215

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

0 commit comments

Comments
 (0)