Skip to content

Commit

Permalink
Merge pull request #141 from dafyddj/ci/chef-workst
Browse files Browse the repository at this point in the history
ci(kitchen): improve Windows testing
  • Loading branch information
myii authored Feb 22, 2021
2 parents 9fdf3dd + 470f4d6 commit c955053
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
32 changes: 23 additions & 9 deletions .github/workflows/kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI
name: kitchen

'on': [push, pull_request]

Expand All @@ -10,30 +10,44 @@ env:
KITCHEN_LOCAL_YAML: kitchen.github.yml

jobs:
build:
test:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
- name: Check out code
uses: actions/checkout@v2
- name: Install Chef
uses: actionshub/[email protected]
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-
- shell: powershell
- 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
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

source 'https://rubygems.org'

# Versions of `chef-utils` newer than `16.6.14` depend on Ruby 2.6 or
# newer, but the GitHub Actions Windows image comes with Ruby 2.5.8
gem 'chef-utils', '~> 16.6.14'
# Use the latest version of `inspec` prior to `4.23.4`, which introduces a
# regression where the diff isn't displayed when comparing using `eq`.
gem 'inspec', '~> 4.22.22'
Expand Down
1 change: 0 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ PLATFORMS
ruby

DEPENDENCIES
chef-utils (~> 16.6.14)
inspec (~> 4.22.22)
kitchen-docker!
kitchen-inspec (>= 2.2.1)
Expand Down
1 change: 0 additions & 1 deletion kitchen.github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ provisioner:
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls `
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls `
skip_verify=True makedirs=True
exit 0
5 changes: 2 additions & 3 deletions kitchen.vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ platforms:
provisioner:
init_environment: |
# Workaround to allow `kitchen converge` to be used multiple times
# without having to `kitchen destroy` first: remove state files copied
# across during the previous `converge` (if present)
# 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\openvpn.sls `
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls `
skip_verify=True makedirs=True
exit 0

0 comments on commit c955053

Please sign in to comment.