Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from myii/feat/add-vagrant-testing-via-github…
…-actions feat(vagrant+proxy): add testing via. GitHub Actions
- Loading branch information
Showing
13 changed files
with
413 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
{%- from tplroot ~ "/libcimatrix.jinja" import format_ci_matrix with context %} | ||
|
||
{#- Concatenate active platforms #} | ||
{%- set active_platforms = [] %} | ||
{%- if testing_freebsd.active %} | ||
{%- do active_platforms.append("FreeBSD") %} | ||
{%- endif %} | ||
{%- if testing_openbsd.active %} | ||
{%- do active_platforms.append("OpenBSD") %} | ||
{%- endif %} | ||
{%- if testing_windows.active %} | ||
{%- do active_platforms.append("Windows") %} | ||
{%- endif %} | ||
{#- https://stackoverflow.com/questions/30083949/how-to-join-list-in-python-but-make-the-last-separator-different/30084022 #} | ||
{%- if active_platforms | length == 1 %} | ||
{%- set active_platforms_concat = active_platforms[0] %} | ||
{%- else %} | ||
{%- set active_platforms_concat = " & ".join([", ".join(active_platforms[:-1]), active_platforms[-1]]) %} | ||
{%- endif %} | ||
name: '{{ "Kitchen Vagrant ({})".format(active_platforms_concat) }}' | ||
'on': ['push', 'pull_request'] | ||
|
||
env: | ||
KITCHEN_LOCAL_YAML: 'kitchen.vagrant.yml' | ||
|
||
jobs: | ||
test: | ||
runs-on: 'macos-10.15' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
instance: | ||
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True, use_vagrant_platforms=True) }} | ||
{%- raw %} | ||
steps: | ||
- name: 'Check out code' | ||
uses: 'actions/checkout@v2' | ||
- 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-" | ||
- name: 'Run Bundler' | ||
run: | | ||
ruby --version | ||
bundle config path vendor/bundle | ||
bundle install --jobs 4 --retry 3 | ||
- name: 'Run Test Kitchen' | ||
run: 'bundle exec kitchen verify ${{ matrix.instance }}' | ||
{%- endraw %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
{%- from tplroot ~ "/libcimatrix.jinja" import format_ci_matrix with context %} | ||
name: 'Kitchen (Windows)' | ||
'on': ['push', 'pull_request'] | ||
|
||
env: | ||
machine_user: {{ testing_windows.github.driver.username }} | ||
machine_pass: {{ testing_windows.github.driver.password }} | ||
machine_port: {{ testing_windows.github.driver.port }} | ||
KITCHEN_LOCAL_YAML: 'kitchen.windows.yml' | ||
|
||
jobs: | ||
{%- for platform in proxyplatformswindows %} | ||
{#- set os = platform[0] | d('') #} | ||
{%- set os_ver = platform[1] | d('') %} | ||
{#- set salt_ver = platform[2] | d('') #} | ||
{#- set py_ver = platform[3] | d('') #} | ||
test-{{ os_ver }}: | ||
runs-on: 'windows-{{ os_ver }}' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
instance: | ||
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True, use_proxy_platforms_windows=platform) }} | ||
{%- raw %} | ||
steps: | ||
- name: 'Check out code' | ||
uses: 'actions/checkout@v2' | ||
- name: 'Install Chef' | ||
uses: 'actionshub/chef-install@1.1.0' | ||
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-" | ||
- 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 | ||
- name: 'Set up WinRM' | ||
run: > | ||
Set-WSManQuickConfig -Force; | ||
Set-WSManInstance -ResourceURI winrm/config/service | ||
-ValueSet @{AllowUnencrypted="true"} | ||
- name: 'Run Bundler' | ||
run: | | ||
ruby --version | ||
bundle config path vendor/bundle | ||
bundle install --jobs 4 --retry 3 | ||
- name: 'Run Test Kitchen' | ||
run: 'bundle exec kitchen verify ${{ matrix.instance }}' | ||
{%- endraw %} | ||
{%- endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
driver: | ||
name: vagrant | ||
cache_directory: false | ||
customize: | ||
usbxhci: 'off' | ||
gui: false | ||
linked_clone: true | ||
ssh: | ||
shell: /bin/sh | ||
|
||
platforms: | ||
{%- for platform in vagrantboxes %} | ||
{%- set os = platform[0] | d('') %} | ||
{%- set os_ver = platform[1] | d('') %} | ||
{%- set salt_ver = platform[2] | d('') %} | ||
{%- set py_ver = platform[3] | d('') %} | ||
{#- Go to the next platform where not set as active #} | ||
{%- if (os == 'freebsd' and not testing_freebsd.active) or | ||
(os == 'openbsd' and not testing_openbsd.active) or | ||
(os == 'windows' and not testing_windows.active) %} | ||
{%- continue %} | ||
{%- endif %} | ||
- name: {{ os | replace('/', '-') }}-{{ os_ver | replace('.', '') }}-{{ salt_ver | replace('.', '-') }}-py{{ py_ver }} | ||
driver: | ||
{%- if os == 'freebsd' %} | ||
box: {{ 'bento/{}-{}'.format(os, os_ver) }} | ||
{%- elif os == 'openbsd' %} | ||
box: {{ 'generic/{}{}'.format(os, os_ver | int) }} | ||
ssh: | ||
{{ testing_openbsd.vagrant.platforms.driver.ssh | yaml(False) | indent(8) }} | ||
{%- elif os == 'windows' %} | ||
box: {{ testing_windows.vagrant.platforms.driver.box }} | ||
cache_directory: "/omnibus/cache" | ||
customize: {} | ||
ssh: {} | ||
{%- endif %} | ||
{%- if os == 'windows' %} | ||
provisioner: | ||
salt_install: none | ||
# yamllint disable rule:line-length | ||
init_environment: | | ||
# Workaround to allow `kitchen converge` to be used multiple times | ||
# 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 | ||
{%- for pkg in testing_windows.winrepo_ng %} | ||
salt-call --local state.single file.managed ` | ||
C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\{{ pkg }}.sls ` | ||
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/{{ pkg }}.sls ` | ||
skip_verify=True makedirs=True | ||
{%- endfor %} | ||
exit 0 | ||
# yamllint enable rule:line-length | ||
{%- endif %} | ||
{%- endfor %} | ||
|
||
provisioner: | ||
salt_install: bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
driver: | ||
name: {{ testing_windows.github.driver.name }} | ||
host: {{ testing_windows.github.driver.host }} | ||
reset_command: {{ testing_windows.github.driver.reset_command }} | ||
port: {{ testing_windows.github.driver.port }} | ||
username: {{ testing_windows.github.driver.username }} | ||
password: {{ testing_windows.github.driver.password }} | ||
|
||
platforms: | ||
{%- for platform in proxyplatformswindows %} | ||
{%- set os = platform[0] | d('') %} | ||
{%- set os_ver = platform[1] | d('') %} | ||
{%- set salt_ver = platform[2] | d('') %} | ||
{%- set py_ver = platform[3] | d('') %} | ||
- name: {{ os | replace('/', '-') }}-{{ os_ver | replace('.', '') }}-{{ salt_ver | replace('.', '-') }}-py{{ py_ver }} | ||
{%- endfor %} | ||
|
||
provisioner: | ||
salt_install: {{ testing_windows.github.platforms.provisioner.salt_install }} | ||
salt_bootstrap_options: {{ testing_windows.github.platforms.provisioner.salt_bootstrap_options }} | ||
{#- This template needs this `if` block since `init_environment` may not be needed at all #} | ||
{%- if testing_windows.winrepo_ng %} | ||
# yamllint disable rule:line-length | ||
init_environment: | | ||
{%- for pkg in testing_windows.winrepo_ng %} | ||
C:\salt\salt-call --local state.single file.managed ` | ||
C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\{{ pkg }}.sls ` | ||
source=https://github.com/saltstack/salt-winrepo-ng/raw/master/{{ pkg }}.sls ` | ||
skip_verify=True makedirs=True | ||
{%- endfor %} | ||
# yamllint enable rule:line-length | ||
{%- endif %} |
Oops, something went wrong.