diff --git a/inventory/group_vars/active_roles.yml b/inventory/group_vars/active_roles.yml index de9d65a..2f97fba 100644 --- a/inventory/group_vars/active_roles.yml +++ b/inventory/group_vars/active_roles.yml @@ -18,12 +18,20 @@ present_templates: - .github/workflows/pr-title-lint.yml - .github/workflows/test_converting_readme.yml - .github/workflows/weekly_ci.yml + - .github/workflows/woke.yml - README-ansible.md absent_files: - .github/workflows/commitlint.yml - .github/workflows/tox.yml - README-devel.md - README-testing.md + - .github/actions/custom-woke-action/LICENSE + - .github/actions/custom-woke-action/README.md + - .github/actions/custom-woke-action/action.yml + - .github/actions/custom-woke-action/entrypoint.sh + - .github/actions/custom-woke-action/testdata/bad.txt + - .github/actions/custom-woke-action + - .github/actions github_org: linux-system-roles github_url_prefix: "https://github.com/" default_ansible_lint: diff --git a/inventory/host_vars/metrics.yml b/inventory/host_vars/metrics.yml index f7d6ec2..bf3f6d9 100644 --- a/inventory/host_vars/metrics.yml +++ b/inventory/host_vars/metrics.yml @@ -15,3 +15,4 @@ ansible_lint: - performancecopilot.metrics.redis - performancecopilot.metrics.repository - performancecopilot.metrics.spark +markdownlint_args: "--ignore=vendor" diff --git a/inventory/host_vars/network.yml b/inventory/host_vars/network.yml index 81762e6..bde8d4f 100644 --- a/inventory/host_vars/network.yml +++ b/inventory/host_vars/network.yml @@ -13,3 +13,7 @@ yamllint: ignore: | tests/roles/ role_specific_contributing: include_files/network_contributing.md +present_badges: + - "[![Coverage Status](https://coveralls.io/repos/github/linux-system-roles/network/badge.svg)](https://coveralls.io/github/linux-system-roles/network)" + - "[![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)" + - "[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/linux-system-roles/network.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/linux-system-roles/network/context:python)" diff --git a/playbooks/include_files/kernel_settings_contributing.md b/playbooks/include_files/kernel_settings_contributing.md index c919bb3..aa7ebaf 100644 --- a/playbooks/include_files/kernel_settings_contributing.md +++ b/playbooks/include_files/kernel_settings_contributing.md @@ -1,11 +1,10 @@ -Testing kernel_settings modules -------------------------------- +## Testing kernel_settings modules It is recommended to use `tox` to set up your `virtualenv` for development/testing purposes: -``` +```bash dnf/yum install python-tox tox -e py38 ``` @@ -13,7 +12,7 @@ tox -e py38 You can also use the virtualenv created by `tox` just like any other virtualenv created by `python-virtualenv`: -``` +```bash . .tox/env-py38/bin/activate python >>> import package.that.only.exists.in.venv @@ -31,7 +30,7 @@ run and debug unit tests. However, you may need to create a `.env` file like this, in order for code navigation, auto-completion, and test discovery to work correctly: -``` +```bash PYTHONPATH=/full/path/to/tuned:/full/path/to/linux-system-roles/kernel_settings/library ``` diff --git a/playbooks/include_files/network_contributing.md b/playbooks/include_files/network_contributing.md index a500fa0..59ea7e9 100644 --- a/playbooks/include_files/network_contributing.md +++ b/playbooks/include_files/network_contributing.md @@ -1,6 +1,5 @@ -Debugging network system role ------------------------------ +## Debugging network system role When using the `nm` provider, NetworkManager create a checkpoint and reverts the changes on failures. This makes it hard to debug the error. To disable this, set diff --git a/playbooks/include_files/ssh_contributing.md b/playbooks/include_files/ssh_contributing.md index f4caad4..8091806 100644 --- a/playbooks/include_files/ssh_contributing.md +++ b/playbooks/include_files/ssh_contributing.md @@ -1,6 +1,5 @@ -Developer documentation for ssh system role -------------------------------------------- +## Developer documentation for ssh system role ### Internal role variables diff --git a/playbooks/include_files/storage_contributing.md b/playbooks/include_files/storage_contributing.md index 759129d..684b84f 100644 --- a/playbooks/include_files/storage_contributing.md +++ b/playbooks/include_files/storage_contributing.md @@ -1,6 +1,5 @@ -Storage system role architecture --------------------------------- +## Storage system role architecture ### Overview diff --git a/playbooks/templates/.github/workflows/markdownlint.yml b/playbooks/templates/.github/workflows/markdownlint.yml index 14edf34..7e7a0bd 100644 --- a/playbooks/templates/.github/workflows/markdownlint.yml +++ b/playbooks/templates/.github/workflows/markdownlint.yml @@ -27,8 +27,13 @@ jobs: - name: Check out code uses: {{ gha_checkout_action }} - - name: Lint README.md + # CHANGELOG.md is generated automatically from PR titles and descriptions + # It might have issues but they are not critical + - name: Lint all markdown files except for CHANGELOG.md uses: docker://avtodev/markdown-lint:master with: - args: README.md + args: >- + {{ markdownlint_args | d() -}} + --ignore=CHANGELOG.md + **/*.md config: .markdownlint.yaml diff --git a/playbooks/templates/.github/workflows/woke.yml b/playbooks/templates/.github/workflows/woke.yml new file mode 100644 index 0000000..a1e6a36 --- /dev/null +++ b/playbooks/templates/.github/workflows/woke.yml @@ -0,0 +1,19 @@ +# yamllint disable rule:line-length +name: Woke +on: # yamllint disable-line rule:truthy + - pull_request +jobs: + woke: + name: Detect non-inclusive language + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: {{ gha_checkout_action }} + + - name: Run lsr-woke-action + # Originally, uses: get-woke/woke-action@v0 + uses: linux-system-roles/lsr-woke-action@main + with: + woke-args: "-c https://raw.githubusercontent.com/linux-system-roles/tox-lsr/main/src/tox_lsr/config_files/woke.yml --count-only-error-for-failure" + # Cause the check to fail on any broke rules + fail-on-error: true diff --git a/playbooks/templates/README-ansible.md b/playbooks/templates/README-ansible.md index bdd47b1..01a54eb 100644 --- a/playbooks/templates/README-ansible.md +++ b/playbooks/templates/README-ansible.md @@ -1,5 +1,4 @@ -Introduction to Ansible for Linux System Roles -============================================== +# Introduction to Ansible for Linux System Roles If you are not familiar with Ansible, please see [Introduction to Ansible for Linux System Roles](https://linux-system-roles.github.io/documentation/intro-to-ansible-for-system-roles.html), diff --git a/playbooks/templates/contributing.md b/playbooks/templates/contributing.md index 6ad9493..a0a8287 100644 --- a/playbooks/templates/contributing.md +++ b/playbooks/templates/contributing.md @@ -1,9 +1,7 @@ -{% set title = "Contributing to the " ~ inventory_hostname ~ " Linux System Role" %} +{% set title = "# Contributing to the " ~ inventory_hostname ~ " Linux System Role" %} {{ title }} -{{ "=" * (title | length) }} -Where to start --------------- +## Where to start The first place to go is [Contribute](https://linux-system-roles.github.io/contribute.html). This has all of the common information that all role developers need: @@ -22,9 +20,9 @@ are likely to be suitable for new contributors! **Code** is managed on [Github](https://github.com/linux-system-roles/{{ inventory_hostname }}), using [Pull Requests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests). - {% if 'python_roles' in group_names %} -### Python Code + +## Python Code The Python code needs to be **compatible with the Python versions supported by the role platform**. diff --git a/playbooks/update_files.yml b/playbooks/update_files.yml index 345c6cd..4b76048 100644 --- a/playbooks/update_files.yml +++ b/playbooks/update_files.yml @@ -146,6 +146,37 @@ __present_python_templates + __present_shellcheck_templates)) + ([__role_template_dir] | product(__role_present_templates)) }}" + - name: Find workflows to create badges for + find: + paths: "{{ git_dir }}/.github/workflows" + file_type: file + excludes: + - ansible-managed-var-comment.yml + - ansible-plugin-scan.yml + - build_docs.yml + - changelog_to_tag.yml + - pr-title-lint.yml + - test_converting_readme.yml + - weekly_ci.yml + register: find + + - name: Ensure badges in README.md + lineinfile: + path: "{{ git_dir }}/README.md" + regex: \[\!.* + firstmatch: true + line: "{%-for file in find.files -%}\ + [![{{ file.path | basename }}]\ + (https://github.com/linux-system-roles/{{ inventory_hostname }}/actions/workflows/{{ file.path | basename }}/badge.svg)]\ + (https://github.com/linux-system-roles/{{ inventory_hostname }}/actions/workflows/{{ file.path | basename }})\ + {{- ' ' if not loop.last else '' -}}\ + {% endfor %} + {{- ' ' if present_badges | d([]) | length > 0 else '' -}}\ + {%- for badge in present_badges | d([]) -%} + {{ badge }}\ + {{ ' ' if not loop.last else '' }}\ + {% endfor %}" + - name: Create git commit, PR changed_when: false shell: @@ -155,6 +186,7 @@ for file in {{ __all_present | join(" ") }}; do git add "$file" done + git add README.md for file in {{ __all_absent | join(" ") }}; do if [ ! -f "$file" ]; then echo WARNING: file to be deleted was not found: "$file"