blob: 8bbd5c0ec840063818c0674eb7a120d043722ad2 [file] [log] [blame]
Linux Foundation Administrators14b8edb2018-01-25 13:00:42 -08001[tox]
2minversion = 1.6
Eric Ball9ecb7ad2024-09-12 12:52:26 -07003envlist = pre-commit
Linux Foundation Administrators14b8edb2018-01-25 13:00:42 -08004skipsdist = true
5
Eric Ball9ecb7ad2024-09-12 12:52:26 -07006[testenv:jenkins-jobs]
Linux Foundation Administrators14b8edb2018-01-25 13:00:42 -08007deps =
Eric Ball9ecb7ad2024-09-12 12:52:26 -07008 jenkins-job-builder=={env:JJB_VERSION:6.4.1}
Linux Foundation Administrators14b8edb2018-01-25 13:00:42 -08009commands =
Eric Ball9ecb7ad2024-09-12 12:52:26 -070010 jenkins-jobs {posargs:--help}
Linux Foundation Administrators14b8edb2018-01-25 13:00:42 -080011
Eric Ball9ecb7ad2024-09-12 12:52:26 -070012[testenv:pre-commit-install]
13basepython = python3
14deps = pre-commit
15commands =
16 pre-commit install
17 pre-commit install --hook-type commit-msg
Linux Foundation Administrators14b8edb2018-01-25 13:00:42 -080018
Eric Ball9ecb7ad2024-09-12 12:52:26 -070019[testenv:pre-commit-uninstall]
20basepython = python3
21deps = pre-commit
22commands =
23 pre-commit uninstall
24 pre-commit uninstall --hook-type commit-msg
25
26[testenv:pre-commit]
27description = Precommit checks for black, gitlint, etc.
28allowlist_externals =
29 /bin/sh
30deps =
31 pre-commit
32passenv = HOME
33commands =
34 pre-commit run --all-files --show-diff-on-failure
35 /bin/sh -c 'if ! git config --get user.name > /dev/null; then \
36 git config --global --add user.name "CI"; \
37 touch .git/REMOVE_USERNAME; fi'
38 /bin/sh -c 'if ! git config --get user.email > /dev/null; then \
39 git config --global --add user.email "ci@example.org"; \
40 touch .git/REMOVE_USEREMAIL; fi'
41 /bin/sh -c "if [ -f .git/COMMIT_EDITMSG ]; then \
42 cp .git/COMMIT_EDITMSG .git/COMMIT_MSGTOX; else \
43 git log HEAD -n1 --pretty=%B > .git/COMMIT_MSGTOX; fi"
44 pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_MSGTOX
45 /bin/sh -c "rm -f .git/COMMIT_MSGTOX"
46 /bin/sh -c "if [ -f .git/REMOVE_USERNAME ]; then \
47 git config --global --unset user.name; \
48 rm -f .git/REMOVE_USERNAME; fi"
49 /bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \
50 git config --global --unset user.email; \
51 rm -f .git/REMOVE_USEREMAIL; fi"