diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41bb1be..62c4e0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,7 @@ name: ci "on": pull_request: push: - branches: - - main + branches: [main] jobs: lint-unit: @@ -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: @@ -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 }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f0f768..b1d1f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 61a6cc5..caf68eb 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -1,10 +1,9 @@ --- driver: name: dokken - privileged: true # because Docker and SystemD + privileged: true -transport: - name: dokken +transport: { name: dokken } provisioner: name: dokken diff --git a/kitchen.exec.yml b/kitchen.exec.yml new file mode 100644 index 0000000..61fca24 --- /dev/null +++ b/kitchen.exec.yml @@ -0,0 +1,7 @@ +--- +driver: { name: exec } +transport: { name: exec } + +platforms: + - name: windows-latest + - name: macos-latest diff --git a/kitchen.yml b/kitchen.yml index 62ed780..ef883f3 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -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 @@ -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: diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 7bf29b3..0eaad74 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -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 diff --git a/test/fixtures/cookbooks/test/recipes/default.rb b/test/fixtures/cookbooks/test/recipes/default.rb index 1199f23..4e310a2 100644 --- a/test/fixtures/cookbooks/test/recipes/default.rb +++ b/test/fixtures/cookbooks/test/recipes/default.rb @@ -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 @@ -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 @@ -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