Skip to content

Commit 0175f54

Browse files
authored
Merge pull request #535 from myii/ci/add-macos
ci(macos): enable testing using GitHub Actions
2 parents e8a1237 + c05fddf commit 0175f54

File tree

10 files changed

+476
-12
lines changed

10 files changed

+476
-12
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
name: 'Kitchen (macOS)'
5+
'on': ['push', 'pull_request']
6+
7+
env:
8+
KITCHEN_LOCAL_YAML: 'kitchen.macos.yml'
9+
10+
jobs:
11+
test-12:
12+
runs-on: 'macos-12'
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
instance:
17+
- default-macos-12-latest-py3
18+
steps:
19+
- name: 'Check out code'
20+
uses: 'actions/checkout@v2'
21+
- name: 'Set up Bundler cache'
22+
uses: 'actions/cache@v1'
23+
with:
24+
path: 'vendor/bundle'
25+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
26+
restore-keys: "${{ runner.os }}-gems-"
27+
- name: 'Run Bundler'
28+
run: |
29+
ruby --version
30+
bundle config path vendor/bundle
31+
bundle install --jobs 4 --retry 3
32+
- name: 'Run Test Kitchen'
33+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
34+
test-11:
35+
runs-on: 'macos-11'
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
instance:
40+
- default-macos-11-latest-py3
41+
steps:
42+
- name: 'Check out code'
43+
uses: 'actions/checkout@v2'
44+
- name: 'Set up Bundler cache'
45+
uses: 'actions/cache@v1'
46+
with:
47+
path: 'vendor/bundle'
48+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
49+
restore-keys: "${{ runner.os }}-gems-"
50+
- name: 'Run Bundler'
51+
run: |
52+
ruby --version
53+
bundle config path vendor/bundle
54+
bundle install --jobs 4 --retry 3
55+
- name: 'Run Test Kitchen'
56+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'
57+
test-1015:
58+
runs-on: 'macos-10.15'
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
instance:
63+
- default-macos-1015-latest-py3
64+
steps:
65+
- name: 'Check out code'
66+
uses: 'actions/checkout@v2'
67+
- name: 'Set up Bundler cache'
68+
uses: 'actions/cache@v1'
69+
with:
70+
path: 'vendor/bundle'
71+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
72+
restore-keys: "${{ runner.os }}-gems-"
73+
- name: 'Run Bundler'
74+
run: |
75+
ruby --version
76+
bundle config path vendor/bundle
77+
bundle install --jobs 4 --retry 3
78+
- name: 'Run Test Kitchen'
79+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'

kitchen.macos.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
driver:
5+
name: exec
6+
7+
provisioner:
8+
sudo: true
9+
salt_install: bootstrap
10+
salt_bootstrap_options: -P stable latest
11+
salt_call_command: /opt/salt/bin/salt-call
12+
13+
platforms:
14+
- name: macos-12-latest-py3
15+
verifier:
16+
inputs:
17+
saltmajorversion: 3004
18+
- name: macos-11-latest-py3
19+
verifier:
20+
inputs:
21+
saltmajorversion: 3004
22+
- name: macos-1015-latest-py3
23+
verifier:
24+
inputs:
25+
saltmajorversion: 3004

salt/minion.sls

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@ download-salt-minion:
2020
{% else %}
2121
- skip_verify: True
2222
{% endif %}
23-
- user: root
24-
- group: wheel
23+
- user: {{ salt_settings.rootuser }}
24+
- group: {{ salt_settings.rootgroup }}
2525
- mode: '0644'
2626
- unless:
2727
- test -n "{{ salt_settings.version }}" && '/opt/salt/bin/salt-minion --version=.*{{ salt_settings.version }}.*'
2828
- require_in:
2929
- macpackage: salt-minion
3030
- retry: {{ salt_settings.retry_options | json }}
3131
{%- elif "workaround https://github.com/saltstack/salt/issues/49348" %}
32-
cmd.run:
33-
- name: /usr/local/bin/brew install {{ salt_settings.salt_minion }}
34-
- onlyif: test -x /usr/local/bin/brew
35-
- runas: {{ salt_settings.rootuser }}
32+
{% if salt_settings.install_packages %}
33+
pkg.installed:
34+
- name: {{ salt_settings.salt_minion }}
35+
{%- if salt_settings.version is defined %}
36+
- version: {{ salt_settings.version }}
37+
{%- endif %}
38+
{% endif %}
3639
{%- endif %}
3740
3841
salt-minion-macos:
@@ -130,7 +133,7 @@ salt-minion:
130133
{%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %}
131134
- macpackage: salt-minion
132135
{%- elif grains.os == 'MacOS' %}
133-
- cmd: download-salt-minion
136+
- pkg: download-salt-minion
134137
{%- else %}
135138
- pkg: salt-minion
136139
{%- endif %}
@@ -155,7 +158,7 @@ restart-salt-minion:
155158
{%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %}
156159
- macpackage: salt-minion
157160
{%- elif grains.os == 'MacOS' %}
158-
- cmd: download-salt-minion
161+
- pkg: download-salt-minion
159162
{%- else %}
160163
- pkg: salt-minion
161164
{%- endif %}
@@ -201,7 +204,7 @@ permissions-minion-config:
201204
{%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
202205
wheel
203206
{%- else %}
204-
root
207+
{{ salt_settings.rootgroup }}
205208
{%- endif %}
206209
{%- if grains['kernel'] != 'Windows' %}
207210
- mode: 640
@@ -221,7 +224,7 @@ salt-minion-pki-dir:
221224
{%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
222225
wheel
223226
{%- else %}
224-
root
227+
{{ salt_settings.rootgroup }}
225228
{%- endif %}
226229
{%- if grains['kernel'] != 'Windows' %}
227230
- mode: 700
@@ -240,7 +243,7 @@ permissions-minion.pem:
240243
{%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
241244
wheel
242245
{%- else %}
243-
root
246+
{{ salt_settings.rootgroup }}
244247
{%- endif %}
245248
{%- if grains['kernel'] != 'Windows' %}
246249
- mode: 400
@@ -261,7 +264,7 @@ permissions-minion.pub:
261264
{%- if grains['kernel'] in ['FreeBSD', 'OpenBSD', 'NetBSD'] %}
262265
wheel
263266
{%- else %}
264-
root
267+
{{ salt_settings.rootgroup }}
265268
{%- endif %}
266269
{%- if grains['kernel'] != 'Windows' %}
267270
- mode: 644

salt/osfamilymap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Windows:
138138
rootuser: {{ rootuser | d('') }}
139139

140140
MacOS:
141+
salt_master: saltstack
141142
salt_minion: salt
142143
salt_minion_pkg_source: ''
143144
salt_minion_pkg_hash: ''

test/integration/default/controls/pkgs_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
%w[py38-salt]
99
when 'windows'
1010
['Salt Minion']
11+
when 'mac_os_x'
12+
%w[salt saltstack]
1113
else
1214
%w[salt-master salt-minion]
1315
end

test/integration/default/controls/service_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
%w[salt_master salt_minion]
77
when 'windows'
88
%w[salt-minion]
9+
when 'darwin'
10+
# The following is expected but isn't yet working in the GitHub Actions
11+
# macOS runners
12+
# %w[com.saltstack.salt.api
13+
# com.saltstack.salt.master
14+
# com.saltstack.salt.minion
15+
# com.saltstack.salt.syndic]
16+
[]
917
else
1018
%w[salt-master salt-minion]
1119
end
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# yamllint disable rule:indentation rule:line-length
2+
# Mac OS X
3+
---
4+
values:
5+
formulas_settings:
6+
checkout_orig_branch: false
7+
git_opts:
8+
default:
9+
basedir: /srv/formulas
10+
baseurl: https://github.com/saltstack-formulas
11+
options:
12+
output_loglevel: quiet
13+
rev: master
14+
update: false
15+
list: {}
16+
salt_settings:
17+
api_service: salt-api
18+
api_service_details:
19+
enabled: true
20+
state: running
21+
clean_config_d_dir: true
22+
cloud:
23+
template_sources:
24+
maps: salt://salt/files/cloud.maps.d
25+
profiles: salt://salt/files/cloud.profiles.d
26+
providers: salt://salt/files/cloud.providers.d
27+
config_path: /private/etc/salt
28+
gitfs:
29+
dulwich:
30+
install_from_source: true
31+
gitpython:
32+
install_from_source: false
33+
pygit2:
34+
git:
35+
install_from_package: git
36+
require_state: false
37+
install_from_source: true
38+
libgit2:
39+
build_parent_dir: /usr/src/
40+
download_hash: 683d1164e361e2a0a8d52652840e2340
41+
install_from_source: true
42+
version: 0.23.0
43+
version: 0.23.0
44+
install_packages: true
45+
master:
46+
ext_pillar:
47+
- cmd_yaml: cat /etc/salt/yaml
48+
- stack:
49+
- /path/to/stack1.cfg
50+
- /path/to/stack2.cfg
51+
- reclass:
52+
inventory_base_uri: /etc/reclass
53+
- saltclass:
54+
- path: /srv/saltclass
55+
file_roots:
56+
base:
57+
- /srv/salt
58+
fileserver_backend:
59+
- rootfs
60+
gitfs_provider: gitpython
61+
pillar_roots:
62+
base:
63+
- /srv/pillar
64+
master_config_use_TOFS: false
65+
master_remove_config: false
66+
master_service: com.saltstack.salt.master
67+
master_service_details:
68+
enabled: true
69+
state: running
70+
minion:
71+
file_roots:
72+
base:
73+
- /srv/salt
74+
fileserver_backend:
75+
- rootfs
76+
master: localhost
77+
master_type: str
78+
pillar_roots:
79+
base:
80+
- /srv/pillar
81+
minion_config_use_TOFS: false
82+
minion_remove_config: false
83+
minion_service: com.saltstack.salt.minion
84+
minion_service_details:
85+
enabled: true
86+
state: running
87+
parallel: true
88+
pin_version: false
89+
pkgrepo: ''
90+
py_ver: py3
91+
python_dulwich: python-dulwich
92+
python_git: python-git
93+
release: '3004'
94+
restart_via_at: false
95+
retry_options:
96+
attempts: 5
97+
interval: 10
98+
splay: 10
99+
until: true
100+
rootgroup: staff
101+
rootuser: runner
102+
salt_api: salt-api
103+
salt_cloud: salt-cloud
104+
salt_master: saltstack
105+
salt_master_macos_plist_hash: 8435331b2d48ca8f0759f216e5b15ec9171a4216b1441328c732c6906728b7c9
106+
salt_minion: salt
107+
salt_minion_macos_plist_hash: 26b33da12e0d8960ee96b488c8352002c22a377c19bf3df3f986a1e49eca8b20
108+
salt_minion_pkg_hash: ''
109+
salt_minion_pkg_source: ''
110+
salt_ssh: salt-ssh
111+
salt_syndic: salt-syndic
112+
ssh_roster: {}
113+
syndic_service: salt-syndic
114+
use_pip: false
115+
version: ''

0 commit comments

Comments
 (0)