Skip to content

Commit c955053

Browse files
authored
Merge pull request #141 from dafyddj/ci/chef-workst
ci(kitchen): improve Windows testing
2 parents 9fdf3dd + 470f4d6 commit c955053

5 files changed

Lines changed: 25 additions & 17 deletions

File tree

.github/workflows/kitchen.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: CI
2+
name: kitchen
33

44
'on': [push, pull_request]
55

@@ -10,30 +10,44 @@ env:
1010
KITCHEN_LOCAL_YAML: kitchen.github.yml
1111

1212
jobs:
13-
build:
13+
test:
1414
runs-on: windows-latest
1515

1616
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/cache@v1
17+
- name: Check out code
18+
uses: actions/checkout@v2
19+
- name: Install Chef
20+
uses: actionshub/chef-install@1.1.0
21+
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
26+
with:
27+
name: PATH
28+
value: "C:\\opscode\\chef\\bin;\
29+
C:\\opscode\\chef\\embedded\\bin;$env:PATH"
30+
- name: Set up Bundler cache
31+
uses: actions/cache@v1
1932
with:
2033
path: vendor/bundle
2134
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
2235
restore-keys: |
2336
${{ runner.os }}-gems-
24-
- shell: powershell
37+
- name: Set up test user
2538
run: |
2639
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
2740
New-LocalUser $env:machine_user -Password $password
2841
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
29-
- shell: powershell
42+
- name: Set up WinRM
3043
run: >
3144
Set-WSManQuickConfig -Force;
3245
Set-WSManInstance -ResourceURI winrm/config/service
3346
-ValueSet @{AllowUnencrypted="true"}
34-
- run: gem install bundler --quiet --no-document
35-
- name: Bundle install
47+
- name: Run Bundler
3648
run: |
49+
ruby --version
3750
bundle config path vendor/bundle
3851
bundle install --jobs 4 --retry 3
39-
- run: bundle exec kitchen test
52+
- name: Run Test Kitchen
53+
run: bundle exec kitchen verify

Gemfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
source 'https://rubygems.org'
44

5-
# Versions of `chef-utils` newer than `16.6.14` depend on Ruby 2.6 or
6-
# newer, but the GitHub Actions Windows image comes with Ruby 2.5.8
7-
gem 'chef-utils', '~> 16.6.14'
85
# Use the latest version of `inspec` prior to `4.23.4`, which introduces a
96
# regression where the diff isn't displayed when comparing using `eq`.
107
gem 'inspec', '~> 4.22.22'

Gemfile.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ PLATFORMS
525525
ruby
526526

527527
DEPENDENCIES
528-
chef-utils (~> 16.6.14)
529528
inspec (~> 4.22.22)
530529
kitchen-docker!
531530
kitchen-inspec (>= 2.2.1)

kitchen.github.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ provisioner:
1818
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls `
1919
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls `
2020
skip_verify=True makedirs=True
21-
exit 0

kitchen.vagrant.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ platforms:
1313
provisioner:
1414
init_environment: |
1515
# Workaround to allow `kitchen converge` to be used multiple times
16-
# without having to `kitchen destroy` first: remove state files copied
17-
# across during the previous `converge` (if present)
16+
# without having to `kitchen destroy` first: remove state files cached by
17+
# Salt during the previous `converge` (if present)
1818
rm -recurse `
1919
C:\Users\vagrant\AppData\Local\Temp\kitchen\var\cache\salt\minion\files\base `
2020
-ErrorAction SilentlyContinue
2121
salt-call --local state.single file.managed `
2222
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls `
2323
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls `
2424
skip_verify=True makedirs=True
25-
exit 0

0 commit comments

Comments
 (0)