blob: ea73c544ef071bb1f1dea28734dfcfc4f62affd6 [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 Ball8b48c862024-09-19 15:19:19 -070012[testenv:jjb-test]
13deps =
14 jenkins-job-builder=={env:JJB_VERSION:6.4.1}
15commands =
16 jenkins-jobs --conf {env:JJB_CONF:jenkins.ini} {posargs} test -o /tmp jjb/
17
Eric Ball9ecb7ad2024-09-12 12:52:26 -070018[testenv:pre-commit-install]
19basepython = python3
20deps = pre-commit
21commands =
22 pre-commit install
23 pre-commit install --hook-type commit-msg
Linux Foundation Administrators14b8edb2018-01-25 13:00:42 -080024
Eric Ball9ecb7ad2024-09-12 12:52:26 -070025[testenv:pre-commit-uninstall]
26basepython = python3
27deps = pre-commit
28commands =
29 pre-commit uninstall
30 pre-commit uninstall --hook-type commit-msg
31
32[testenv:pre-commit]
33description = Precommit checks for black, gitlint, etc.
34allowlist_externals =
35 /bin/sh
36deps =
37 pre-commit
38passenv = HOME
39commands =
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"