-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (81 loc) · 2.47 KB
/
lint.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
75
76
77
78
79
80
81
82
83
84
---
name: Lint CI
"on":
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
jobs:
changes:
name: Filter changes
runs-on: ubuntu-latest
outputs:
scripts: ${{ steps.filter.outputs.scripts }}
playbooks: ${{ steps.filter.outputs.playbooks }}
steps:
- name: checkout project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
id: filter
with:
filters: |
scripts:
- '**/.local/bin/*'
playbooks:
- 'ansible/.ansible/**'
lint-shell:
name: Lint scripts
needs: changes
if: ${{ needs.changes.outputs.scripts == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Shellcheck scripts
run: |
find -- * -type f -executable -exec shellcheck {} \;
lint-playbook:
name: Lint playbooks
needs: changes
if: ${{ needs.changes.outputs.playbooks == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup env
run: |
python -m venv "$HOME/.venv"
{ echo "HOME=$HOME";
echo "PATH=$HOME/.venv/bin:$PATH";
echo "ansible_dwm=ansible/.ansible/dwm/";
} >> "$GITHUB_ENV"
- name: Install requirements-dev.txt
run: |
cd "$ansible_dwm"
python -m pip install --upgrade -r requirements/pip/pip.in -c requirements/pip/pip.txt
python3 -m pip install --upgrade -r requirements/ansible/ansible-dev.in -c requirements/ansible/ansible-dev.txt
- name: Check ansible version
run: |
ansible --version
ansible-lint --version
- name: Install requirements.yml
run: |
cd "$ansible_dwm"
ansible-galaxy collection install -r requirements/ansible/requirements.yml
- name: Run yaml-lint
run: |
cd "$ansible_dwm"
yamllint .
- name: Run playbook syntax-check
run: |
cd "$ansible_dwm"
ansible-playbook --syntax-check playbooks/dwm.yml
ansible-playbook --syntax-check playbooks/update.yml
- name: Run ansible-lint
run: |
cd "$ansible_dwm"
ansible-lint