From bc3587fbfb61908757dc4da3d1728b8eb726e945 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 19 Aug 2024 00:23:24 +0930 Subject: [PATCH 1/2] chore: add makefile ref: #28 closes #26 --- .gitignore | 9 +++++++ .vscode/extensions.json | 5 +++- CONTRIBUTING.md | 48 +++++++++++++++++++++++++++++++++--- makefile | 54 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 makefile diff --git a/.gitignore b/.gitignore index f8a4da4..f166a54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,12 @@ __pycache__ build pages +*.junit.xml + + +## Make prepare items +node_modules/ +package-lock.json +package.json +.markdownlint.json +.markdownlint-cli2.jsonc \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b711f73..d4932e4 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,6 +4,9 @@ "streetsidesoftware.code-spell-checker-australian-english", "streetsidesoftware.code-spell-checker", "github.vscode-github-actions", - "jebbs.markdown-extended" + "jebbs.markdown-extended", + "njpwerner.autodocstring", + "ms-python.python", + "ms-python.debugpy" ] } \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index db41a52..88c0ef6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,48 @@ -# Contirbution Guide +# Contribution Guide -We welcome contributions. +Development of this project has been setup to be done from VSCodium. The following additional requirements need to be met: + +- npm has been installed. _required for `markdown` linting_ + + `sudo apt install -y --no-install-recommends npm` + +- setup of other requirements can be done with `make prepare` + +- **ALL** Linting must pass for Merge to be conducted. + + _`make lint`_ + + +## Makefile + +!!! tip "TL;DR" + Common make commands are `make prepare` then `make docs` and `make lint` + +Included within the root of the repository is a makefile that can be used during development to check/run different items as is required during development. The following make targets are available: + +- `prepare` + + _prepare the repository. init's all git submodules and sets up a python virtual env and other make targets_ + +- `docs` + + _builds the docs and places them within a directory called build, which can be viewed within a web browser_ + +- `lint` + + _conducts all required linting_ + + - `ansible-lint` + + _lints ansible directories/files only. should only be used when you only want to check Ansible formatting._ + + - `docs-lint` + + _lints the markdown documents within the docs directory for formatting errors that MKDocs may/will have an issue with._ + +- `clean` + + _cleans up build artifacts and removes the python virtual environment_ ## Inventory Plugin @@ -8,6 +50,6 @@ We welcome contributions. ``` bash # to test use -ansible-inventory -i nofusscomputing.itsm.centurion --list -vvv +ansible-inventory -i nofusscomputing.centurion.centurion --list -vvv ``` diff --git a/makefile b/makefile new file mode 100644 index 0000000..efb207f --- /dev/null +++ b/makefile @@ -0,0 +1,54 @@ +.ONESHELL: + +PATH_VENV := /tmp/ansible_collection_centurion + +ACTIVATE_VENV :=. ${PATH_VENV}/bin/activate + +.PHONY: clean prepare docs ansible-lint lint + + +prepare: + git submodule update --init; + git submodule foreach git submodule update --init; + python3 -m venv ${PATH_VENV}; + ${ACTIVATE_VENV}; + pip install -r website-template/gitlab-ci/mkdocs/requirements.txt; + pip install -r gitlab-ci/lint/requirements.txt; + npm install markdownlint-cli2; + npm install markdownlint-cli2-formatter-junit; + cp -f "website-template/.markdownlint.json" ".markdownlint.json"; + cp -f "gitlab-ci/lint/.markdownlint-cli2.jsonc" ".markdownlint-cli2.jsonc"; + + +markdown-mkdocs-lint: + PATH=${PATH}:node_modules/.bin markdownlint-cli2 "docs/*.md docs/**/*.md docs/**/**/*.md docs/**/**/**/*.md docs/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci !website-template" + + +docs-lint: markdown-mkdocs-lint + + +docs: docs-lint + ${ACTIVATE_VENV} + mkdocs build --clean + + +ansible-lint-galaxy: + ${ACTIVATE_VENV} + ansible-lint galaxy.yml + + +ansible-lint-dirs: + ${ACTIVATE_VENV} + ansible-lint meta/ playbooks/ roles/ + + +ansible-lint: ansible-lint-galaxy ansible-lint-dirs + + +lint: ansible-lint markdown-mkdocs-lint + + +clean: + rm -rf ${PATH_VENV} + rm -rf pages + rm -rf build From 1606e361cc446f15e0bffede84507500e6063ed0 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 19 Aug 2024 13:36:07 +0930 Subject: [PATCH 2/2] ci(mkdocs): add mkdocs workflow ref: #28 https://github.com/nofusscomputing/action_mkdocs/pull/1 --- .github/workflows/ci.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e8bccd9..1b89403 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,6 +16,17 @@ env: jobs: + mkdocs: + name: 'MKDocs' + permissions: + pull-requests: write + contents: write + statuses: write + checks: write + actions: write + uses: nofusscomputing/action_mkdocs/.github/workflows/reusable_mkdocs.yaml@development + + collection: name: 'Ansible Collection' uses: nofusscomputing/action_ansible_collection/.github/workflows/reusable_ansible_collection.yaml@development