Skip to content

Commit c7c1830

Browse files
authored
Merge pull request #50 from mrlesmithjr/feature/add-ci-and-modernize
feat: add CI workflow and modernize role code
2 parents 38573a7 + 83c1b1b commit c7c1830

File tree

12 files changed

+281
-294
lines changed

12 files changed

+281
-294
lines changed

.ansible-lint

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
exclude_paths:
3+
- .github/
4+
- tests/
5+
- molecule/
6+
7+
skip_list:
8+
- galaxy[no-changelog]
9+
- galaxy[version-incorrect]
10+
- role-name[path]
11+
12+
warn_list:
13+
- experimental
14+
- ignore-errors
15+
- no-handler
16+
- fqcn[action-core]
17+
18+
use_default_rules: true

.github/workflows/default.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: CI
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
- master
10+
schedule:
11+
- cron: "0 5 * * 0"
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install ansible-core ansible-lint yamllint
30+
31+
- name: Run yamllint
32+
run: yamllint .
33+
34+
- name: Run ansible-lint
35+
run: ansible-lint
36+
37+
syntax:
38+
name: Syntax Check (Ansible ${{ matrix.ansible-version }})
39+
runs-on: ubuntu-latest
40+
strategy:
41+
matrix:
42+
ansible-version:
43+
- "2.14"
44+
- "2.15"
45+
- "2.16"
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: "3.12"
54+
55+
- name: Install Ansible
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install "ansible-core~=${{ matrix.ansible-version }}.0"
59+
60+
- name: Create role symlink for tests
61+
run: |
62+
mkdir -p tests/roles
63+
ln -s ../../ tests/roles/ansible-mdadm
64+
65+
- name: Run syntax check
66+
run: |
67+
ansible-playbook tests/test.yml -i tests/inventory --syntax-check

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Distribution / packaging
7+
.Python
8+
build/
9+
develop-eggs/
10+
dist/
11+
downloads/
12+
eggs/
13+
.eggs/
14+
lib/
15+
lib64/
16+
parts/
17+
sdist/
18+
var/
19+
wheels/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
24+
# Ansible
25+
*.retry
26+
.galaxy_install_info
27+
28+
# IDE
29+
.vscode/
30+
.idea/
31+
*.swp
32+
*.swo
33+
*~
34+
35+
# OS
36+
.DS_Store
37+
Thumbs.db
38+
39+
# Testing
40+
.cache/
41+
.pytest_cache/
42+
.tox/
43+
htmlcov/
44+
.coverage
45+
.coverage.*
46+
coverage.xml
47+
*.cover
48+
.ansible/

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sudo: false
99
addons:
1010
apt:
1111
packages:
12-
- python-pip
12+
- python-pip
1313

1414
install:
1515
# Install ansible
@@ -26,4 +26,4 @@ script:
2626
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
2727

2828
notifications:
29-
webhooks: https://galaxy.ansible.com/api/v1/notifications/
29+
webhooks: https://galaxy.ansible.com/api/v1/notifications/

.yamllint

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
line-length:
6+
max: 160
7+
level: warning
8+
truthy:
9+
allowed-values: ['true', 'false', 'yes', 'no']
10+
comments:
11+
min-spaces-from-content: 1
12+
comments-indentation: false
13+
braces:
14+
max-spaces-inside: 1
15+
octal-values:
16+
forbid-implicit-octal: true

0 commit comments

Comments
 (0)