Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows & MacOS GH CI testing #144

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ name: ci
"on":
pull_request:
push:
branches:
- main
branches: [main]

jobs:
lint-unit:
Expand Down Expand Up @@ -53,18 +52,13 @@ jobs:
sudo journalctl -l --since today
KITCHEN_LOCAL_YAML=kitchen.dokken.yml /usr/bin/kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl -l"

integration-macos:
integration-windows:
needs: lint-unit
runs-on: macos-10.15
runs-on: windows-latest
strategy:
matrix:
os:
- windows-2012r2
- windows-2016
- windows-2019
- macos-1015
suite:
- resources
os: [windows-latest]
suite: [resources]
fail-fast: false

steps:
Expand All @@ -76,6 +70,30 @@ jobs:
uses: actionshub/test-kitchen@main
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.exec.yml
# ACTIONS_ALLOW_UNSECURE_COMMANDS: true # allow path editing
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}

integration-macos:
needs: lint-unit
runs-on: macos-11
strategy:
matrix:
os: [macos-latest]
suite: [resources]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install Chef
uses: actionshub/chef-install@main
- name: test-kitchen
uses: actionshub/test-kitchen@main
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.exec.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Fix Windows/MacOS CI testing
- Remove delivery and move to calling RSpec directly via a reusable workflow
- Update tested platforms

Expand Down
5 changes: 2 additions & 3 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
driver:
name: dokken
privileged: true # because Docker and SystemD
privileged: true

transport:
name: dokken
transport: { name: dokken }

provisioner:
name: dokken
Expand Down
7 changes: 7 additions & 0 deletions kitchen.exec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
driver: { name: exec }
transport: { name: exec }

platforms:
- name: windows-latest
- name: macos-latest
24 changes: 19 additions & 5 deletions kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
---
driver:
name: vagrant
driver: { name: vagrant }

provisioner:
name: chef_infra
product_name: chef
enforce_idempotency: true
chef_license: accept-no-persist
multiple_converge: 2
enforce_idempotency: true
deprecations_as_errors: true

verifier:
name: inspec
verifier: { name: inspec }

platforms:
- name: amazonlinux-2
Expand All @@ -27,14 +26,29 @@ platforms:
driver:
box: tas50/windows_2012r2
gui: false
customize:
memory: 2048
transport:
name: winrm
elevated: true
- name: windows-2016
driver:
box: tas50/windows_2016
gui: false
customize:
memory: 2048
transport:
name: winrm
elevated: true
- name: windows-2019
driver:
box: tas50/windows_2019
gui: false
customize:
memory: 2048
transport:
name: winrm
elevated: true
- name: macos-10.15
run_list: homebrew::default
driver:
Expand Down
2 changes: 1 addition & 1 deletion libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def parsed_windows_package_version

def parsed_windows_package_url
return new_resource.windows_package_url if new_resource.windows_package_url
"https://github.com/git-for-windows/git/releases/download/v%#{parsed_windows_package_version}.windows.1/Git-%#{parsed_windows_package_version}-32-bit.exe"
"https://github.com/git-for-windows/git/releases/download/v#{parsed_windows_package_version}.windows.1/Git-#{parsed_windows_package_version}-32-bit.exe"
end

def parsed_windows_package_checksum
Expand Down
10 changes: 6 additions & 4 deletions test/fixtures/cookbooks/test/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

git_client 'install it'

user_path = platform_family?('windows') ? 'C:\Users\random' : '/home/random'

user 'random' do
manage_home true
home '/home/random'
home user_path
end

git_config 'add name to random' do
Expand All @@ -14,8 +16,8 @@
value 'John Doe global'
end

git '/home/random/git_repo' do
repository 'https://github.com/chef/chef-repo.git'
git "#{user_path}/git_repo" do
repository 'https://github.com/chef-boneyard/chef-repo.git'
user 'random'
end

Expand All @@ -24,7 +26,7 @@
scope 'local'
key 'user.name'
value 'John Doe local'
path '/home/random/git_repo'
path "#{user_path}/git_repo"
end

git_config 'change system config' do
Expand Down