diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d53210c..0d3e5771 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,3 @@ jobs: - name: Lint docs uses: articulate/actions-markdownlint@v1 - with: - config: markdownlint-config.json - files: "docs/**/*.md" diff --git a/markdownlint-config.json b/.markdownlint.json similarity index 100% rename from markdownlint-config.json rename to .markdownlint.json diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 00000000..821c19db --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1 @@ +.github \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..9509d9ef --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +--- +repos: + - repo: https://github.com/ansible-community/ansible-lint.git + rev: v6.5.0 + hooks: + - id: ansible-lint + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.27.1 + hooks: + - id: yamllint + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.32.2 + hooks: + - id: markdownlint diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e308548b..2b1ffa70 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -22,9 +22,9 @@ } }, { - "label": "Run ansible-lint", + "label": "Run pre-commit checks", "type": "shell", - "command": "docker run --rm -it -v $(pwd):/code pipelinecomponents/ansible-lint:latest nas.yml", + "command": "pre-commit run --all-files", "group": "test" }, { @@ -40,4 +40,4 @@ "group": "build" } ] -} \ No newline at end of file +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb877441..a6d9036c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ Contributing to Ansible-NAS is easy! Add your functionality, then raise a pull request on GitHub. A few things to bear in mind: -* **Restrict pull requests to one piece of functionality or bugfix at a time.** +* **Restrict pull requests to one piece of functionality or bugfix at a time.** * Test your new functionality or bugfix using the included `tests/test-vagrant.sh` script to spin up a test VM. * Run `ansible-lint` against the playbook before committing. (There is a VSCode task set up to run the right command for you) * Ensure that your PR only changes files required for your functionality or bugfix. Random changes in other files will result in your PR being rejected @@ -26,3 +26,5 @@ If you're adding a new application: * Development of Ansible-NAS is carried out in [Visual Studio Code](https://code.visualstudio.com/) - you'll get some nice recommended extensions and task setups if you do the same. +* You'll need a working Python 3 environment, and [pre-commit](https://pre-commit.com) installed - `pip install pre-commit`. + diff --git a/docs/installation.md b/docs/installation.md index fe7c79ee..23bac7ec 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -6,7 +6,7 @@ Before running anything, check out the playbook and understand what it does. Run 💀 💀 💀 -## Read This First... +## Read This First Calling this page "installation" is a bit of a misnomer. Ansible-NAS isn't *installed* per-se, it is a bunch of automation that installs other software onto your server. Ansible-NAS relies heavily on Ansible's [variable prescedence](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable) to do its job. Ansible-NAS defines its installable software with roles with (mostly) sane defaults, these can then be enabled and the settings overridden in your inventory `nas.yml` file. diff --git a/inventories/sample/inventory b/inventories/sample/inventory index e7efa92c..83f3ce88 100644 --- a/inventories/sample/inventory +++ b/inventories/sample/inventory @@ -15,4 +15,4 @@ # ansible-nas ansible_connection=local ansible_host=localhost [nas] -ansible-nas \ No newline at end of file +ansible-nas diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..e42b23c1 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1 @@ +pre-commit \ No newline at end of file