Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency https://github.com/lkubb/salt-extension-copier to v0.4.4 #9

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 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.6
_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: Mattermost
license: apache
loaders:
- module
Expand All @@ -15,9 +19,12 @@ no_saltext_namespace: false
package_name: mattermost
project_name: mattermost
python_requires: '3.8'
relax_pylint: false
salt_version: '3005'
source_url: https://github.com/salt-extensions/saltext-mattermost
ssh_fixtures: false
summary: Salt Extension for interacting with Mattermost
test_containers: false
tracker_url: https://github.com/salt-extensions/saltext-mattermost/issues
url: https://github.com/salt-extensions/saltext-mattermost
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
15 changes: 13 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
---
name: Pull Request or Push

on: [push, pull_request]
on:
push:
branches:
- 'main' # Run on pushes to main
tags-ignore:
- '*' # Ignore pushes to tags
pull_request:

jobs:
ci:
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
30 changes: 19 additions & 11 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
---
name: Tagged Releases

on:
push:
tags:
- "v*"
- "v*" # Only tags starting with "v" for "v1.0.0", etc.

jobs:
ci:
get_tag_version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: CI
uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main
with:
release: true
version: ${{ env.VERSION }}
permissions:
contents: write
pull-requests: read
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/mattermost/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/mattermost/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/mattermost/version.py
exclude: src/saltext/mattermost/(__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/mattermost/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/mattermost/.*\.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/mattermost/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" / "mattermost"
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