-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.22 KB
/
ansible-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Run ansible-playbook on macOS
on:
push:
branches:
- 'main'
schedule:
- cron: '0 18 1 * *' # Run at 6 pm UTC / 10 am PT on 1st every month
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: ”false"
jobs:
integration:
name: Integration Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-12 # macOS Monterey
- macos-11 # macOS Big Sur
steps:
- name: Check out the codebase
uses: actions/checkout@v2
- name: Uninstall GitHub Actions' built-in browsers
run: |
sudo rm -rf /Applications/Firefox.app
sudo rm -rf /Applications/Google\ Chrome.app
- name: Update homebrew
run: brew update-reset && brew update
- name: Install ansible
run: brew install ansible
- name: Cache .ansible dir
uses: actions/cache@v2
with:
path: ~/.ansible
key: ${{ runner.os }}-${{ hashFiles('**/requirements.galaxy.yml') }}
- name: Install ansible-galaxy
run: |
ansible-galaxy collection install -r requirements.galaxy.yml
- name: Check the playbook's syntax
run: ansible-playbook -i hosts -vv localhost.yml --syntax-check
- name: Execute the playbook
run: ansible-playbook -i hosts -vv localhost.yml
env:
ANSIBLE_FORCE_COLOR: '1'
- name: Check if the playbook is satisfied with Idempotence
run: |
idempotence=$(mktemp)
ansible-playbook -i hosts -vv localhost.yml | tee -a ${idempotence}
tail ${idempotence} | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
env:
ANSIBLE_FORCE_COLOR: '1'
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
- name: Setup tmate session without timeout
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3