Linux Foundation Administrators | 14b8edb | 2018-01-25 13:00:42 -0800 | [diff] [blame] | 1 | [tox] |
| 2 | minversion = 1.6 |
Eric Ball | 9ecb7ad | 2024-09-12 12:52:26 -0700 | [diff] [blame] | 3 | envlist = pre-commit |
Linux Foundation Administrators | 14b8edb | 2018-01-25 13:00:42 -0800 | [diff] [blame] | 4 | skipsdist = true |
| 5 | |
Eric Ball | 9ecb7ad | 2024-09-12 12:52:26 -0700 | [diff] [blame] | 6 | [testenv:jenkins-jobs] |
Linux Foundation Administrators | 14b8edb | 2018-01-25 13:00:42 -0800 | [diff] [blame] | 7 | deps = |
Eric Ball | 9ecb7ad | 2024-09-12 12:52:26 -0700 | [diff] [blame] | 8 | jenkins-job-builder=={env:JJB_VERSION:6.4.1} |
Linux Foundation Administrators | 14b8edb | 2018-01-25 13:00:42 -0800 | [diff] [blame] | 9 | commands = |
Eric Ball | 9ecb7ad | 2024-09-12 12:52:26 -0700 | [diff] [blame] | 10 | jenkins-jobs {posargs:--help} |
Linux Foundation Administrators | 14b8edb | 2018-01-25 13:00:42 -0800 | [diff] [blame] | 11 | |
Eric Ball | 8b48c86 | 2024-09-19 15:19:19 -0700 | [diff] [blame] | 12 | [testenv:jjb-test] |
| 13 | deps = |
| 14 | jenkins-job-builder=={env:JJB_VERSION:6.4.1} |
| 15 | commands = |
| 16 | jenkins-jobs --conf {env:JJB_CONF:jenkins.ini} {posargs} test -o /tmp jjb/ |
| 17 | |
Eric Ball | 9ecb7ad | 2024-09-12 12:52:26 -0700 | [diff] [blame] | 18 | [testenv:pre-commit-install] |
| 19 | basepython = python3 |
| 20 | deps = pre-commit |
| 21 | commands = |
| 22 | pre-commit install |
| 23 | pre-commit install --hook-type commit-msg |
Linux Foundation Administrators | 14b8edb | 2018-01-25 13:00:42 -0800 | [diff] [blame] | 24 | |
Eric Ball | 9ecb7ad | 2024-09-12 12:52:26 -0700 | [diff] [blame] | 25 | [testenv:pre-commit-uninstall] |
| 26 | basepython = python3 |
| 27 | deps = pre-commit |
| 28 | commands = |
| 29 | pre-commit uninstall |
| 30 | pre-commit uninstall --hook-type commit-msg |
| 31 | |
| 32 | [testenv:pre-commit] |
| 33 | description = Precommit checks for black, gitlint, etc. |
| 34 | allowlist_externals = |
| 35 | /bin/sh |
| 36 | deps = |
| 37 | pre-commit |
| 38 | passenv = HOME |
| 39 | commands = |
| 40 | pre-commit run --all-files --show-diff-on-failure |
| 41 | /bin/sh -c 'if ! git config --get user.name > /dev/null; then \ |
| 42 | git config --global --add user.name "CI"; \ |
| 43 | touch .git/REMOVE_USERNAME; fi' |
| 44 | /bin/sh -c 'if ! git config --get user.email > /dev/null; then \ |
| 45 | git config --global --add user.email "ci@example.org"; \ |
| 46 | touch .git/REMOVE_USEREMAIL; fi' |
| 47 | /bin/sh -c "if [ -f .git/COMMIT_EDITMSG ]; then \ |
| 48 | cp .git/COMMIT_EDITMSG .git/COMMIT_MSGTOX; else \ |
| 49 | git log HEAD -n1 --pretty=%B > .git/COMMIT_MSGTOX; fi" |
| 50 | pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_MSGTOX |
| 51 | /bin/sh -c "rm -f .git/COMMIT_MSGTOX" |
| 52 | /bin/sh -c "if [ -f .git/REMOVE_USERNAME ]; then \ |
| 53 | git config --global --unset user.name; \ |
| 54 | rm -f .git/REMOVE_USERNAME; fi" |
| 55 | /bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \ |
| 56 | git config --global --unset user.email; \ |
| 57 | rm -f .git/REMOVE_USEREMAIL; fi" |