Skip to content

Commit b93e517

Browse files
committed
ci(windows): test using GitHub Actions
1 parent 33e98ab commit b93e517

File tree

8 files changed

+141
-3
lines changed

8 files changed

+141
-3
lines changed

.github/workflows/kitchen.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: CI
3+
4+
'on': [push, pull_request]
5+
6+
env:
7+
machine_user: kitchen
8+
machine_pass: Pass@word1
9+
machine_port: 5985
10+
KITCHEN_LOCAL_YAML: kitchen.github.yml
11+
12+
jobs:
13+
build:
14+
runs-on: windows-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/cache@v1
19+
with:
20+
path: vendor/bundle
21+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
22+
restore-keys: |
23+
${{ runner.os }}-gems-
24+
- shell: powershell
25+
run: |
26+
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
27+
New-LocalUser $env:machine_user -Password $password
28+
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
29+
- shell: powershell
30+
run: >
31+
Set-WSManQuickConfig -Force;
32+
Set-WSManInstance -ResourceURI winrm/config/service
33+
-ValueSet @{AllowUnencrypted="true"}
34+
- run: gem install bundler --quiet --no-document
35+
- name: Bundle install
36+
run: |
37+
bundle config path vendor/bundle
38+
bundle install --jobs 4 --retry 3
39+
- run: bundle exec kitchen test

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ source 'https://rubygems.org'
55
gem 'kitchen-docker', '>= 2.9'
66
gem 'kitchen-inspec', '>= 1.1'
77
gem 'kitchen-salt', '>= 0.6.0'
8+
9+
group :vagrant do
10+
gem 'kitchen-vagrant'
11+
end

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ GEM
287287
kitchen-salt (0.6.3)
288288
hashie (>= 3.5)
289289
test-kitchen (>= 1.4)
290+
kitchen-vagrant (1.6.1)
291+
test-kitchen (>= 1.4, < 3)
290292
libyajl2 (1.2.0)
291293
license-acceptance (1.0.19)
292294
pastel (~> 0.7)
@@ -526,6 +528,7 @@ DEPENDENCIES
526528
kitchen-docker (>= 2.9)
527529
kitchen-inspec (>= 1.1)
528530
kitchen-salt (>= 0.6.0)
531+
kitchen-vagrant
529532

530533
BUNDLED WITH
531534
2.1.2

kitchen.github.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
driver:
3+
name: proxy
4+
host: localhost
5+
reset_command: "exit 0"
6+
port: 5985
7+
username: kitchen
8+
password: Pass@word1
9+
10+
platforms:
11+
- name: windows-81-latest-py3
12+
13+
provisioner:
14+
salt_install: bootstrap
15+
salt_bootstrap_options: -pythonVersion 3
16+
init_environment: >
17+
C:\salt\salt-call --local state.single file.managed
18+
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-winrepo-ng\chocolatey\init.sls
19+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/chocolatey/init.sls
20+
skip_verify=True makedirs=True;
21+
C:\salt\salt-call --local state.single file.managed
22+
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-winrepo-ng\chocolatey\install.cmd
23+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/chocolatey/install.cmd
24+
skip_verify=True makedirs=True;
25+
C:\salt\salt-call --local state.single file.managed
26+
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-winrepo-ng\chocolatey\uninstall.cmd
27+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/chocolatey/uninstall.cmd
28+
skip_verify=True makedirs=True;
29+
exit 0

kitchen.vagrant.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
driver:
5+
name: vagrant
6+
7+
platforms:
8+
- name: windows-81-latest-py3
9+
driver:
10+
box: techneg/win81x64-pro-salt
11+
gui: false
12+
linked_clone: true
13+
provisioner:
14+
init_environment: >
15+
salt-call --local state.single file.managed
16+
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-winrepo-ng\chocolatey\init.sls
17+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/chocolatey/init.sls
18+
skip_verify=True makedirs=True;
19+
salt-call --local state.single file.managed
20+
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-winrepo-ng\chocolatey\install.cmd
21+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/chocolatey/install.cmd
22+
skip_verify=True makedirs=True;
23+
salt-call --local state.single file.managed
24+
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\salt-winrepo-ng\chocolatey\uninstall.cmd
25+
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/chocolatey/uninstall.cmd
26+
skip_verify=True makedirs=True;
27+
exit 0

kitchen.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,21 @@ suites:
333333
verifier:
334334
inspec_tests:
335335
- path: test/integration/default
336+
- name: windows
337+
includes:
338+
- windows-81-latest-py3
339+
provisioner:
340+
state_top:
341+
base:
342+
'*':
343+
- packages.chocolatey
344+
pillars:
345+
top.sls:
346+
base:
347+
'*':
348+
- packages
349+
pillars_from_files:
350+
packages.sls: test/salt/pillar/windows.sls
351+
verifier:
352+
inspec_tests:
353+
- path: test/integration/default

pillar.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ packages:
6464

6565
chocolatey:
6666
wanted:
67-
firefox:
68-
install_args: "l=fr-FR"
67+
Firefox:
68+
package_args: "/l:en-GB"
6969
packagename:
7070
version: '12.04'
7171
source: 'mychocolatey/source'
7272
force: true
7373
unwanted:
74-
- googlechrome
74+
- GoogleChrome
7575

7676
snaps:
7777
wanted:

test/salt/pillar/windows.sls

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
packages:
5+
chocolatey:
6+
wanted:
7+
adobereader: {}
8+
Firefox:
9+
package_args: "/l:en-GB"
10+
jq:
11+
version: '1.5'
12+
# `1.6` already installed on the pre-salted image
13+
force: true
14+
notepadplusplus:
15+
version: '7.8.8'
16+
unwanted:
17+
- GoogleChrome
18+
- hg

0 commit comments

Comments
 (0)