From 9619abc409b983edd8f3e0cada4e3f5732785a42 Mon Sep 17 00:00:00 2001 From: Paddy Roddy Date: Wed, 25 Oct 2023 13:52:21 +0100 Subject: [PATCH 1/8] Add super hook --- .pre-commit-config.yaml | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d4620ab..5f73b77 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,33 +1,5 @@ repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + - repo: https://github.com/UCL-MIRSG/.github + rev: v0.25.0 hooks: - - id: check-added-large-files - - id: check-case-conflict - - id: check-docstring-first - - id: check-executables-have-shebangs - - id: check-merge-conflict - - id: check-yaml - - id: end-of-file-fixer - - id: fix-byte-order-marker - - id: mixed-line-ending - args: [--fix=lf] - - id: trailing-whitespace - - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.4 - hooks: - - id: forbid-tabs - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 - hooks: - - id: prettier - exclude: ".yml$" - - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.27.0 - hooks: - - id: check-github-workflows - - repo: https://github.com/ansible-community/ansible-lint.git - rev: v6.21.1 - hooks: - - id: ansible-lint - args: ["-p", "."] + - id: mirsg-hooks From 751fc74d790aa87aaed38d7e1709fe7825390aaa Mon Sep 17 00:00:00 2001 From: Paddy Roddy Date: Wed, 25 Oct 2023 13:52:28 +0100 Subject: [PATCH 2/8] Rename linting file --- .github/workflows/{checks.yml => linting.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{checks.yml => linting.yml} (100%) diff --git a/.github/workflows/checks.yml b/.github/workflows/linting.yml similarity index 100% rename from .github/workflows/checks.yml rename to .github/workflows/linting.yml From bca3383bfbc16413da085b8ed668e153783572ce Mon Sep 17 00:00:00 2001 From: Paddy Roddy Date: Wed, 25 Oct 2023 14:28:37 +0100 Subject: [PATCH 3/8] Add project board workflow --- .github/workflows/manage-projects.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/manage-projects.yml diff --git a/.github/workflows/manage-projects.yml b/.github/workflows/manage-projects.yml new file mode 100644 index 0000000..e1d11d5 --- /dev/null +++ b/.github/workflows/manage-projects.yml @@ -0,0 +1,15 @@ +name: Manage issues on the projects board + +on: + issues: + types: + - opened + +jobs: + add-issue-to-project: + runs-on: ubuntu-latest + steps: + - uses: UCL-MIRSG/.github/actions/add-to-project@v0.25.0 + with: + app-id: ${{ secrets.APP_ID }} + app-pem: ${{ secrets.APP_PEM }} \ No newline at end of file From 65a04b41056f301898aa47c5633fd8f17e74dfb3 Mon Sep 17 00:00:00 2001 From: Paddy Roddy Date: Wed, 25 Oct 2023 14:31:00 +0100 Subject: [PATCH 4/8] Add linting workflow --- .github/workflows/linting.yml | 41 ++++++++--------------------------- requirements.yml | 3 +++ 2 files changed, 12 insertions(+), 32 deletions(-) create mode 100644 requirements.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 2daf1db..f8bc44d 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,40 +1,17 @@ ---- -name: Pre-commit checks +name: Linting + on: - pull_request: push: branches: - - main + - main + - "renovate/**" + pull_request: jobs: - pre_commit: + linting: runs-on: ubuntu-latest steps: - - name: Checkout source - uses: actions/checkout@v4 - - - name: Set up python - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Set PY - run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - - - name: Cache pre-commit install - uses: actions/cache@v3 + - uses: UCL-MIRSG/.github/actions/linting@v0.25.0 with: - path: | - ${{ env.pythonLocation }} - ~/.cache/pre-commit - key: | - pre-commit-${{ env.PY }}-${{ hashFiles('.pre-commit-config.yaml') }} - - - name: Install dependencies - run: pip install pre-commit - - - name: Install pre-commit hooks - run: pre-commit install - - - name: Run pre-commit - run: pre-commit run --all-files --color always + ansible-roles-config: ./requirements.yml + pre-commit-config: ./.pre-commit-config.yaml diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..4d590c8 --- /dev/null +++ b/requirements.yml @@ -0,0 +1,3 @@ +--- +collections: + - community.general \ No newline at end of file From 6ab68fd72e19c0e73bb08a3957c2353d38e9c88d Mon Sep 17 00:00:00 2001 From: Paddy Roddy Date: Wed, 25 Oct 2023 14:32:01 +0100 Subject: [PATCH 5/8] Comment out `role_name` --- meta/main.yml | 6 ++++-- molecule/resources/converge.yml | 5 +++-- requirements.yml | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 2764932..5b40213 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -41,7 +41,8 @@ galaxy_info: # - 7 # - 99.99 - galaxy_tags: [] + galaxy_tags: + [] # List tags for your role here, one per line. A tag is a keyword that describes # and categorizes the role. Users find roles by searching for tags. Be sure to # remove the '[]' above, if you add tags to this list. @@ -49,7 +50,8 @@ galaxy_info: # NOTE: A tag is limited to a single word comprised of alphanumeric characters. # Maximum 20 tags per role. -dependencies: [] +dependencies: + [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, # if you add dependencies to this list. Or remove this and create a requirements.yml # file. diff --git a/molecule/resources/converge.yml b/molecule/resources/converge.yml index 7f6d12c..442ea8e 100644 --- a/molecule/resources/converge.yml +++ b/molecule/resources/converge.yml @@ -21,5 +21,6 @@ changed_when: false failed_when: systemctl_status.rc > 1 - roles: - - mirsg.role_name + # TODO: change this to the desired role name + # roles: + # - mirsg.role_name diff --git a/requirements.yml b/requirements.yml index 4d590c8..8dd5161 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,3 +1,3 @@ --- collections: - - community.general \ No newline at end of file + - community.general From 68fdbf91e3a61fdb46efbb2f77100091e7f0f484 Mon Sep 17 00:00:00 2001 From: Paddy Roddy Date: Wed, 25 Oct 2023 14:33:04 +0100 Subject: [PATCH 6/8] Fix linting --- .github/workflows/manage-projects.yml | 2 +- tests/test.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/manage-projects.yml b/.github/workflows/manage-projects.yml index e1d11d5..676c99a 100644 --- a/.github/workflows/manage-projects.yml +++ b/.github/workflows/manage-projects.yml @@ -12,4 +12,4 @@ jobs: - uses: UCL-MIRSG/.github/actions/add-to-project@v0.25.0 with: app-id: ${{ secrets.APP_ID }} - app-pem: ${{ secrets.APP_PEM }} \ No newline at end of file + app-pem: ${{ secrets.APP_PEM }} diff --git a/tests/test.yml b/tests/test.yml index 14d2c49..0d3792a 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -1,5 +1,6 @@ --- -- hosts: localhost +- name: Test + hosts: localhost remote_user: root roles: - . From 3ecf68e9d72fe4592fb3e55a1e20c404bccb785c Mon Sep 17 00:00:00 2001 From: Paddy Roddy Date: Wed, 25 Oct 2023 14:58:12 +0100 Subject: [PATCH 7/8] Fix `roles` --- molecule/resources/converge.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/molecule/resources/converge.yml b/molecule/resources/converge.yml index 442ea8e..de70256 100644 --- a/molecule/resources/converge.yml +++ b/molecule/resources/converge.yml @@ -21,6 +21,5 @@ changed_when: false failed_when: systemctl_status.rc > 1 - # TODO: change this to the desired role name - # roles: - # - mirsg.role_name + roles: + - mirsg.template From c271c7fbcbe77804c1dd7f035587a7ffc0262cf1 Mon Sep 17 00:00:00 2001 From: Paddy Roddy Date: Wed, 25 Oct 2023 15:07:08 +0100 Subject: [PATCH 8/8] Move `requirements.yml` file into `meta` folder --- .github/workflows/linting.yml | 2 +- requirements.yml => meta/requirements.yml | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename requirements.yml => meta/requirements.yml (100%) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index f8bc44d..33a20a5 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -13,5 +13,5 @@ jobs: steps: - uses: UCL-MIRSG/.github/actions/linting@v0.25.0 with: - ansible-roles-config: ./requirements.yml + ansible-roles-config: ./meta/requirements.yml pre-commit-config: ./.pre-commit-config.yaml diff --git a/requirements.yml b/meta/requirements.yml similarity index 100% rename from requirements.yml rename to meta/requirements.yml