Skip to content

Commit

Permalink
Merge pull request #8 from salt-extensions/renovate/https-github.com-…
Browse files Browse the repository at this point in the history
…lkubb-salt-extension-copier-0.x
  • Loading branch information
lkubb authored Sep 26, 2024
2 parents c25b812 + 2100ee5 commit e48cb1e
Show file tree
Hide file tree
Showing 29 changed files with 1,185 additions and 350 deletions.
8 changes: 7 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Autogenerated. Do not edit this by hand, use `copier update`.
---
_commit: 0.2.7
_commit: 0.4.4
_src_path: https://github.com/lkubb/salt-extension-copier
author: EITR Technologies, LLC
author_email: [email protected]
coc_contact: ''
copyright_begin: 2024
deploy_docs: rolling
docs_url: ''
integration_name: Freezer
license: apache
loaders:
- module
Expand All @@ -14,10 +18,12 @@ no_saltext_namespace: false
package_name: freezer
project_name: freezer
python_requires: '3.8'
relax_pylint: false
salt_version: '3005'
source_url: https://github.com/salt-extensions/saltext-freezer
ssh_fixtures: false
summary: Salt Extension for interacting with Freezer
test_containers: false
tracker_url: https://github.com/salt-extensions/saltext-freezer/issues
url: https://github.com/salt-extensions/saltext-freezer
workflows: org
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
layout_saltext() {
VIRTUAL_ENV="$(python3 tools/initialize.py --print-venv)"
PATH_add "$VIRTUAL_ENV/bin"
export VIRTUAL_ENV
}

layout_saltext
5 changes: 5 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Pull Request or Push

on:
Expand All @@ -12,6 +13,10 @@ jobs:
call_central_workflow:
name: CI
uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main
with:
deploy-docs: true
permissions:
contents: write
id-token: write
pages: write
pull-requests: read
5 changes: 4 additions & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Tagged Releases

on:
Expand All @@ -16,16 +17,18 @@ jobs:

- name: Extract tag name
id: get_version
run: echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/v})"
run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"

call_central_workflow:
needs: get_tag_version
uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main
with:
deploy-docs: true
release: true
version: ${{ needs.get_tag_version.outputs.version }}
permissions:
contents: write
id-token: write
pages: write
pull-requests: read
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ celerybeat.pid
*.sage.py

# Environments
!.envrc
.env
.venv
env/
Expand Down
72 changes: 39 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
minimum_pre_commit_version: 2.4.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: trailing-whitespace # Trims trailing whitespace.
- id: check-merge-conflict # Check for files that contain merge conflict strings.
args: [--assume-in-merge]
- id: trailing-whitespace # Trim trailing whitespace.
args: [--markdown-linebreak-ext=md]
- id: mixed-line-ending # Replaces or checks mixed line ending.
- id: mixed-line-ending # Ensure files use UNIX-style newlines only.
args: [--fix=lf]
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline.
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: check-ast # Simply check whether files parse as valid python.
- id: end-of-file-fixer # Ensure files end with a newline.
- id: check-ast # Check whether files parse as valid Python.

# ----- Formatting ---------------------------------------------------------------------------->
- repo: https://github.com/saltstack/pre-commit-remove-import-headers
Expand All @@ -24,15 +24,15 @@ repos:
- id: check-cli-examples
name: Check CLI examples on execution modules
entry: python .pre-commit-hooks/check-cli-examples.py
language: system
language: python
files: ^src/saltext/freezer/modules/.*\.py$

- repo: local
hooks:
- id: check-docs
name: Check rST doc files exist for modules/states
entry: python .pre-commit-hooks/make-autodocs.py
language: system
language: python
pass_filenames: false

- repo: https://github.com/s0undt3ch/salt-rewrite
Expand All @@ -56,7 +56,7 @@ repos:
args: [--silent, -E, fix_docstrings]

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.2
rev: v3.16.0
hooks:
- id: pyupgrade
name: Rewrite Code to be Py3.8+
Expand All @@ -65,43 +65,43 @@ repos:
]
exclude: src/saltext/freezer/version.py

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: reorder-python-imports
- id: isort
args: [
--py38-plus,
--py 38,
]
exclude: src/saltext/freezer/version.py
exclude: src/saltext/freezer/(__init__|version).py

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 24.8.0
hooks:
- id: black
args: [-l 100]
exclude: src/saltext/freezer/version.py

- repo: https://github.com/adamchainz/blacken-docs
rev: v1.12.1
rev: 1.18.0
hooks:
- id: blacken-docs
args: [--skip-errors]
files: ^(docs/.*\.rst|src/saltext/freezer/.*\.py)$
additional_dependencies:
- black==22.6.0
- black==24.2.0
# <---- Formatting -----------------------------------------------------------------------------

# ----- Security ------------------------------------------------------------------------------>
- repo: https://github.com/PyCQA/bandit
rev: "1.7.4"
rev: 1.7.9
hooks:
- id: bandit
alias: bandit-salt
name: Run bandit against the code base
args: [--silent, -lll, --skip, B701]
exclude: src/saltext/freezer/version.py
- repo: https://github.com/PyCQA/bandit
rev: "1.7.4"
rev: 1.7.9
hooks:
- id: bandit
alias: bandit-tests
Expand All @@ -111,29 +111,35 @@ repos:
# <---- Security -------------------------------------------------------------------------------

# ----- Code Analysis ------------------------------------------------------------------------->
- repo: https://github.com/saltstack/mirrors-nox
rev: v2021.6.12

- repo: local
hooks:
- id: nox
alias: lint-src
name: Lint Source Code
language: python
entry: nox -e lint-code-pre-commit --
files: ^((setup|noxfile)|src/.*)\.py$
require_serial: true
args:
- -e
- lint-code-pre-commit
- --
additional_dependencies:
- nox==2024.4.15
- uv==0.4.0 # Makes this hook much faster

- repo: https://github.com/saltstack/mirrors-nox
rev: v2021.6.12
hooks:
- id: nox
alias: lint-tests
name: Lint Tests
language: python
entry: nox -e lint-tests-pre-commit --
files: ^tests/.*\.py$
require_serial: true
args:
- -e
- lint-tests-pre-commit
- --
additional_dependencies:
- nox==2024.4.15
- uv==0.4.0 # Makes this hook much faster

- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: 1ca29a1b5d949b3586800190ad6cc98317cb43b8 # v1.7.1.15
hooks:
- id: actionlint
additional_dependencies:
- shellcheck-py>=0.9.0.5
# <---- Code Analysis --------------------------------------------------------------------------
8 changes: 6 additions & 2 deletions .pre-commit-hooks/make-autodocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import subprocess
from pathlib import Path


repo_path = Path(subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode().strip())
src_dir = repo_path / "src" / "saltext" / "freezer"
doc_dir = repo_path / "docs"
Expand Down Expand Up @@ -34,9 +33,14 @@ def write_module(rst_path, path, use_virtualname=True):
virtualname = "``" + _find_virtualname(path) + "``"
else:
virtualname = make_import_path(path)
header_len = len(virtualname)
# The check-merge-conflict pre-commit hook chokes here:
# https://github.com/pre-commit/pre-commit-hooks/issues/100
if header_len == 7:
header_len += 1
module_contents = f"""\
{virtualname}
{'='*len(virtualname)}
{'='*header_len}
.. automodule:: {make_import_path(path)}
:members:
Expand Down
Loading

0 comments on commit e48cb1e

Please sign in to comment.