-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) · 1.18 KB
/
ci.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
name: Continuous Integration
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "15 0 1 * *" # Automatic check every month at 00:15
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Lint code
uses: ansible-community/ansible-lint-action@v6.0.2
with:
args: "-vv"
integration:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up the test environment
run: |
cp tests/ansible.cfg ./ansible.cfg
cp tests/inventory ./inventory
ansible-galaxy install -r requirements.yml
- name: Test the playbook
run: |
ansible-playbook playbook.yml
env:
ANSIBLE_FORCE_COLOR: '1'
- name: Idempotence check
run: |
idempotence=$(mktemp)
ansible-playbook playbook.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'