Skip to content

Commit

Permalink
Migrated some invoke tasks to python-tools-scripts
Browse files Browse the repository at this point in the history
* `tasks/docs.py` -> `tools/precommit/docs.py`
* `tasks/docstrings.py` -> `tools/precommit/docstrings.py`

Refs saltstack#64374

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
  • Loading branch information
s0undt3ch committed May 29, 2023
1 parent 54385e8 commit 0659dd3
Show file tree
Hide file tree
Showing 21 changed files with 531 additions and 408 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,13 @@ jobs:
uses: actions/cache@v3
with:
path: .tools-venvs/docs
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/docs.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Cache Python Tools Changelog Virtualenv
uses: actions/cache@v3
with:
path: .tools-venvs/changelog
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/changelog.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}


- name: Setup Salt Version
Expand Down Expand Up @@ -430,7 +430,7 @@ jobs:
uses: actions/cache@v3
with:
path: .tools-venvs/build
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/build.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Build Source Tarball
uses: ./.github/actions/build-source-tarball
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@ jobs:
uses: actions/cache@v3
with:
path: .tools-venvs/docs
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/docs.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Cache Python Tools Changelog Virtualenv
uses: actions/cache@v3
with:
path: .tools-venvs/changelog
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/changelog.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}


- name: Setup Salt Version
Expand Down Expand Up @@ -488,7 +488,7 @@ jobs:
uses: actions/cache@v3
with:
path: .tools-venvs/build
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/build.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Build Source Tarball
uses: ./.github/actions/build-source-tarball
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ jobs:
uses: actions/cache@v3
with:
path: .tools-venvs/docs
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/docs.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Cache Python Tools Changelog Virtualenv
uses: actions/cache@v3
with:
path: .tools-venvs/changelog
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/changelog.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}


- name: Setup Salt Version
Expand Down Expand Up @@ -473,7 +473,7 @@ jobs:
uses: actions/cache@v3
with:
path: .tools-venvs/build
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/build.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Build Source Tarball
uses: ./.github/actions/build-source-tarball
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,13 @@ jobs:
uses: actions/cache@v3
with:
path: .tools-venvs/docs
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/docs.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Cache Python Tools Changelog Virtualenv
uses: actions/cache@v3
with:
path: .tools-venvs/changelog
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/changelog.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}


- name: Setup Salt Version
Expand Down Expand Up @@ -473,7 +473,7 @@ jobs:
uses: actions/cache@v3
with:
path: .tools-venvs/build
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/build.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Build Source Tarball
uses: ./.github/actions/build-source-tarball
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/templates/ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ on:
uses: actions/cache@v3
with:
path: .tools-venvs/docs
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/docs.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|docs|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Cache Python Tools Changelog Virtualenv
uses: actions/cache@v3
with:
path: .tools-venvs/changelog
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/changelog.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|changelog|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}


- name: Setup Salt Version
Expand Down Expand Up @@ -249,7 +249,7 @@ on:
uses: actions/cache@v3
with:
path: .tools-venvs/build
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/build.txt') }}
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|${{ github.job }}|tools-venvs|${{ steps.python-tools-scripts.outputs.version }}|build|${{ steps.get-python-version.outputs.version }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}

- name: Build Source Tarball
uses: ./.github/actions/build-source-tarball
Expand Down
184 changes: 94 additions & 90 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repos:
)$
- repo: https://github.com/s0undt3ch/python-tools-scripts
rev: "0.12.0"
rev: "0.13.3"
hooks:
- id: tools
alias: check-changelog-entries
Expand All @@ -55,12 +55,7 @@ repos:
- pre-commit
- changelog
- pre-commit-checks
additional_dependencies:
- boto3==1.21.46
- pyyaml==6.0
- jinja2==3.1.2
- packaging==23.0
- virustotal3==1.0.8

- id: tools
alias: generate-workflows
name: Generate GitHub Workflow Templates
Expand All @@ -70,12 +65,7 @@ repos:
- pre-commit
- workflows
- generate-workflows
additional_dependencies:
- boto3==1.21.46
- pyyaml==6.0
- jinja2==3.1.2
- packaging==23.0
- virustotal3==1.0.8

- id: tools
alias: actionlint
name: Lint GitHub Actions Workflows
Expand All @@ -86,17 +76,51 @@ repos:
- pre-commit
- workflows
- actionlint
additional_dependencies:
- boto3==1.21.46
- pyyaml==6.0
- jinja2==3.1.2
- packaging==23.0

- id: tools
alias: check-docs
name: Check Docs
files: ^(salt/.*\.py|doc/ref/.*\.rst)$
args:
- pre-commit
- docs
- check

- id: tools
alias: check-docstrings
name: Check docstrings
files: salt/.*\.py$
exclude: >
(?x)^(
templates/.*|
salt/ext/.*|
)$
args:
- pre-commit
- docstrings
- check

- id: tools
alias: check-known-missing-docstrings
name: Check Known Missing Docstrings
stages: [manual]
files: salt/.*\.py$
exclude: >
(?x)^(
templates/.*|
salt/ext/.*|
)$
args:
- pre-commit
- docstrings
- check

# ----- Packaging Requirements ------------------------------------------------------------------------------------>

- repo: https://github.com/saltstack/pip-tools-compile-impersonate
rev: "4.8"
hooks:

# ----- Packaging Requirements ------------------------------------------------------------------------------------>
- id: pip-tools-compile
alias: compile-pkg-linux-3.7-zmq-requirements
name: Linux Packaging Py3.7 ZeroMQ Requirements
Expand Down Expand Up @@ -1024,6 +1048,50 @@ repos:
- --py-version=3.10
- --pip-args=--constraint=requirements/static/ci/py{py_version}/linux.txt
- requirements/static/ci/tools.in

- id: pip-tools-compile
alias: compile-ci-tools-base-3.9-requirements
name: Linux CI Py3.9 Tools Base Requirements
files: ^requirements/static/ci/(tools(-base)?\.in|py3.9/(tools(-base)?|linux)\.txt)$
pass_filenames: false
args:
- -v
- --py-version=3.9
- --pip-args=--constraint=requirements/static/ci/py{py_version}/linux.txt
- requirements/static/ci/tools-base.in

- id: pip-tools-compile
alias: compile-ci-tools-base-3.10-requirements
name: Linux CI Py3.10 Tools Base Requirements
files: ^requirements/static/ci/(tools(-base)?\.in|py3.10/(tools(-base)?|linux)\.txt)$
pass_filenames: false
args:
- -v
- --py-version=3.10
- --pip-args=--constraint=requirements/static/ci/py{py_version}/linux.txt
- requirements/static/ci/tools-base.in

- id: pip-tools-compile
alias: compile-ci-tools-virustotal-3.9-requirements
name: Linux CI Py3.9 Tools virustotal Requirements
files: ^requirements/static/ci/(tools(-virustotal)?\.in|py3.9/(tools(-virustotal)?|linux)\.txt)$
pass_filenames: false
args:
- -v
- --py-version=3.9
- --pip-args=--constraint=requirements/static/ci/py{py_version}/linux.txt
- requirements/static/ci/tools-virustotal.in

- id: pip-tools-compile
alias: compile-ci-tools-virustotal-3.10-requirements
name: Linux CI Py3.10 Tools virustotal Requirements
files: ^requirements/static/ci/(tools(-virustotal)?\.in|py3.10/(tools(-virustotal)?|linux)\.txt)$
pass_filenames: false
args:
- -v
- --py-version=3.10
- --pip-args=--constraint=requirements/static/ci/py{py_version}/linux.txt
- requirements/static/ci/tools-virustotal.in
# <---- Tools -----------------------------------------------------------------------------------------------------

# ----- Code Formatting ------------------------------------------------------------------------------------------->
Expand Down Expand Up @@ -1137,24 +1205,6 @@ repos:
# <---- Security ---------------------------------------------------------------------------------------------------

# ----- Pre-Commit ------------------------------------------------------------------------------------------------>
- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
- id: invoke
alias: check-docs
name: Check Docs
files: ^(salt/.*\.py|doc/ref/.*\.rst)$
args:
- docs.check
additional_dependencies:
- blessings==1.7
- pyyaml==6.0
- distro==1.7.0
- jinja2==3.0.3
- msgpack==1.0.3
- packaging
- looseversion

- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
Expand All @@ -1174,9 +1224,6 @@ repos:
- packaging
- looseversion

- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
- id: invoke
alias: loader-check-virtual
name: Check loader modules __virtual__
Expand All @@ -1197,68 +1244,25 @@ repos:
- packaging
- looseversion

- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
- id: invoke
alias: check-docstrings
name: Check docstrings
files: salt/.*\.py$
exclude: >
(?x)^(
templates/.*|
salt/ext/.*|
)$
args:
- docstrings.check
additional_dependencies:
- blessings==1.7
- pyyaml==6.0
- distro==1.7.0
- jinja2==3.0.3
- msgpack==1.0.3
- packaging
- looseversion

- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
- id: invoke
alias: check-known-missing-docstrings
name: Check Known Missing Docstrings
stages: [manual]
files: salt/.*\.py$
exclude: >
(?x)^(
templates/.*|
salt/ext/.*|
)$
args:
- docstrings.check
- --error-on-known-failures
additional_dependencies:
- blessings==1.7
- pyyaml==6.0
- distro==1.7.0
- jinja2==3.0.3
- msgpack==1.0.3
- packaging
- looseversion

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.0
rev: v1.3.0
hooks:
- id: mypy
alias: mypy-tools
name: Run mypy against tools
files: ^tools/.*\.py$
#args: [--strict]
exclude: >
(?x)^(
templates/.*|
salt/.*|
)$
additional_dependencies:
- attrs
- rich
- types-attrs
- types-pyyaml
- types-requests
- python-tools-scripts

- repo: https://github.com/saltstack/mirrors-nox
rev: v2021.6.12
Expand Down
4 changes: 4 additions & 0 deletions changelog/64374.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Migrated some [`invoke`](https://www.pyinvoke.org/) tasks to [`python-tools-scripts`](https://github.com/s0undt3ch/python-tools-scripts).

* `tasks/docs.py` -> `tools/precommit/docs.py`
* `tasks/docstrings.py` -> `tools/precommit/docstrings.py`
Loading

0 comments on commit 0659dd3

Please sign in to comment.