CI: Properly run gitlint in CI
[releng/global-jjb.git] / tox.ini
1 [tox]
2 minversion = 1.6
3 envlist =
4   ensure-documented,
5   jjb,
6   jjb-compare-xml,
7   jjb-latest,
8   jjb-version,
9   license,
10   pre-commit
11 skipsdist = True
12
13 [testenv:docs]
14 basepython = python3
15 deps = -rrequirements.txt
16 commands =
17     sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
18
19 [testenv:ensure-documented]
20 commands =
21     ./ensure-documented.sh
22
23 [testenv:jjb]
24 basepython = python3
25 deps =
26     jenkins-job-builder==2.8.0
27 commands =
28     jenkins-jobs -l DEBUG test --recursive -o {toxinidir}/archives/job-configs {toxinidir}/jjb:{toxinidir}/.jjb-test
29
30 [testenv:jjb-compare-xml]
31 basepython = python3
32 deps =
33     jenkins-job-builder
34 commands =
35     ./jjb-compare-xml.sh
36
37 [testenv:jjb-latest]
38 basepython = python3
39 deps =
40     jenkins-job-builder
41 commands =
42     jenkins-jobs -l DEBUG test --recursive -o {toxinidir}/archives/job-configs {toxinidir}/jjb:{toxinidir}/.jjb-test
43
44 [testenv:jjb-version]
45 basepython = python3
46 commands = python {toxinidir}/check_jjb_version.py
47
48 [testenv:license]
49 deps = lftools
50 commands = lftools license check-dir -r '.+' shell
51
52 [testenv:pre-commit]
53 basepython = python3
54 allowlist_externals =
55     /bin/sh
56 deps =
57     pre-commit
58 passenv = HOME
59 commands =
60     pre-commit run --all-files --show-diff-on-failure
61     /bin/sh -c 'if ! git config --get user.name > /dev/null; then \
62         git config --global --add user.name "CI"; \
63         touch .git/REMOVE_USERNAME; fi'
64     /bin/sh -c 'if ! git config --get user.email > /dev/null; then \
65         git config --global --add user.email "ci@example.org"; \
66         touch .git/REMOVE_USEREMAIL; fi'
67     /bin/sh -c "if [ -f .git/COMMIT_EDITMSG ]; then \
68         cp .git/COMMIT_EDITMSG .git/COMMIT_MSGTOX; else \
69         git log HEAD -n1 | tail -n +5 | cut -c 5- > .git/COMMIT_MSGTOX; fi"
70     pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_MSGTOX
71     /bin/sh -c "rm -f .git/COMMIT_MSGTOX"
72     /bin/sh -c "if [ -f .git/REMOVE_USERNAME ]; then \
73         git config --global --unset user.name; \
74         rm -f .git/REMOVE_USERNAME; fi"
75     /bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \
76         git config --global --unset user.email; \
77         rm -f .git/REMOVE_USEREMAIL; fi"
78
79 #########
80 # Tools #
81 #########
82
83 [testenv:jenkins-jobs]
84 deps =
85     jenkins-job-builder{env:JJB_VERSION_OP:~=}{env:JJB_VERSION:2.8.0}
86 commands =
87     jenkins-jobs {posargs:--help}
88
89 [testenv:lftools]
90 deps = lftools{env:LFTOOLS_VERSION_OP:~=}{env:LFTOOLS_VERSION:0.13.0}
91 commands = lftools {posargs:--help}
92
93 [testenv:openstack]
94 deps = python-openstackclient{env:OPENSTACK_VERSION_OP:~=}{env:OPENSTACK_VERSION:3.15.0}
95 commands = openstack {posargs:--help}
96
97 [testenv:reno]
98 deps = reno{env:RENO_VERSION_OP:~=}{env:RENO_VERSION:2.11.2}
99 commands = reno {posargs:--help}