-
Notifications
You must be signed in to change notification settings - Fork 21
66 lines (55 loc) · 1.64 KB
/
linting.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
name: Linting
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
ansible-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ansible requirements
run: |
pip install ansible-playbook-grapher ansible ansible-lint
sudo apt-get -y install graphviz
ansible-galaxy collection install -r ansible/requirements.yml --force
- name: Run ansible-lint
working-directory: ./ansible
run: ansible-lint
- name: Retrieve task list from playbook
env:
ANSIBLE_LOCALHOST_WARNING: False
run: |
mkdir artifacts
ansible-playbook --list-tasks ansible/site.yml > artifacts/list-tasks-site
- name: Generate graph representing the Ansible playbook
env:
ANSIBLE_LOCALHOST_WARNING: False
run: |
ansible-playbook-grapher --include-role-tasks ansible/site.yml -o artifacts/graph-site
- name: Upload Ansible artifacts
uses: actions/upload-artifact@v3
with:
name: ansible-artifacts
path: artifacts
yaml-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run yaml-lint
uses: ibiqlik/action-yamllint@v3
with:
config_file: ansible/.yamllint
shell-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -x -s bash -e SC1091