From be5056cf5b21651d344377ba550404911719cb2c Mon Sep 17 00:00:00 2001 From: Patrick Roddy Date: Wed, 25 Oct 2023 15:09:32 +0100 Subject: [PATCH] Bring this template in line with the general template (#11) Fixes #10 Essentially mimic what we have at https://github.com/UCL-MIRSG/mirsg-template --- .github/workflows/checks.yml | 40 --------------------------- .github/workflows/linting.yml | 17 ++++++++++++ .github/workflows/manage-projects.yml | 15 ++++++++++ .pre-commit-config.yaml | 34 ++--------------------- meta/main.yml | 6 ++-- meta/requirements.yml | 3 ++ molecule/resources/converge.yml | 2 +- tests/test.yml | 3 +- 8 files changed, 45 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/checks.yml create mode 100644 .github/workflows/linting.yml create mode 100644 .github/workflows/manage-projects.yml create mode 100644 meta/requirements.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index 2daf1db..0000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Pre-commit checks -on: - pull_request: - push: - branches: - - main - -jobs: - pre_commit: - 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 - 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 diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..33a20a5 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,17 @@ +name: Linting + +on: + push: + branches: + - main + - "renovate/**" + pull_request: + +jobs: + linting: + runs-on: ubuntu-latest + steps: + - uses: UCL-MIRSG/.github/actions/linting@v0.25.0 + with: + ansible-roles-config: ./meta/requirements.yml + pre-commit-config: ./.pre-commit-config.yaml diff --git a/.github/workflows/manage-projects.yml b/.github/workflows/manage-projects.yml new file mode 100644 index 0000000..676c99a --- /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 }} 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 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/meta/requirements.yml b/meta/requirements.yml new file mode 100644 index 0000000..8dd5161 --- /dev/null +++ b/meta/requirements.yml @@ -0,0 +1,3 @@ +--- +collections: + - community.general diff --git a/molecule/resources/converge.yml b/molecule/resources/converge.yml index 7f6d12c..de70256 100644 --- a/molecule/resources/converge.yml +++ b/molecule/resources/converge.yml @@ -22,4 +22,4 @@ failed_when: systemctl_status.rc > 1 roles: - - mirsg.role_name + - mirsg.template 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: - .