-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtox.ini
More file actions
165 lines (149 loc) · 9.65 KB
/
Copy pathtox.ini
File metadata and controls
165 lines (149 loc) · 9.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
[tox]
minversion = 3.20
envlist = lint, py{37, 38, 39, 310, 311, 312, 313, 314}, darwin
[gh-actions]
# The "lint" job is run separately.
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313
3.14: py314
; [testenv:lint]
; # Warning: This environment inherits settings from the main [testenv] section.
; description = run code linters
; basepython = python3
; allowlist_externals =
; find
; deps =
; bison
; flex
; flake8
; pylint
; changedir = {toxinidir}
; commands =
; # stop the build if there are Python syntax errors or undefined names
; flake8 . --config {toxinidir}/.flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
; # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
; flake8 . --config {toxinidir}/.flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
; #find . -name .git -prune -false -o -name .tox -prune -false -o -iname '*.py' \
; # -exec pylint -j 0 --rcfile {toxinidir}/.pylintrc \{\} +
; #pylint -j 0 --rcfile .pylintrc bitsBuild bitsDeps bitsDoctor pb
[testenv]
description = run test suite under {envname}
# Commands we can call that aren't installed in the tox virtualenv.
allowlist_externals =
sh
git
test
touch
sl
rm
deps =
coverage
distro
setenv =
# `Bits analytics` puts preference files under $HOME.
HOME = {envtmpdir}
# Keep coverage info for later upload, if needed. Files in {envtmpdir} are
# deleted after each run.
COVERAGE_FILE = {toxworkdir}/coverage.{envname}
ARCHITECTURE = slc7_x86-64
darwin: ARCHITECTURE = osx_arm64
changedir = {envtmpdir}
commands =
# The first coverage command shouldn't have an -a, so we completely replace
# the coverage info from the last run.
# coverage run --source={toxinidir} {toxinidir}/bitsBuild analytics off
# test -e .config/bits/disable-analytics
# test ! -e .config/bits/analytics-uuid
# coverage run --source={toxinidir} -a {toxinidir}/bitsBuild analytics on
# test ! -e .config/bits/disable-analytics
# test -e .config/bits/analytics-uuid
# coverage run --source={toxinidir} -a {toxinidir}/bitsBuild analytics off
# test -e .config/bits/disable-analytics
# test -e .config/bits/analytics-uuid
coverage run --source={toxinidir} -a {toxinidir}/bitsBuild version
coverage run --source={toxinidir} -a -m unittest discover {toxinidir}/tests
git clone -b alibuild_CI --depth 1 https://github.com/alisw/alidist
coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -a {env:ARCHITECTURE} -z test-init init zlib
# This command is expected to fail, but run it for the coverage anyway.
# A leading "-" means tox ignores the exit code.
- coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c alidist build non-existing -a {env:ARCHITECTURE} --no-system --disable GCC-Toolchain
# TODO: do we need these? This seems to be at least partially covered by
# unit tests in tests/tests_parseRecipe.py.
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken1 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Header missing"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken2 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Empty recipe"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken3 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Unable to parse"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken4 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Malformed header"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken5 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Missing package"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken6 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "while scanning a quoted scalar"'
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build broken7 --force-unknown-architecture --no-system --disable GCC-Toolchain 2>&1 | tee /dev/stderr | grep "Malformed entry prefer_system"'
# This should check that we build different packages depending on the track_env
sh -c 'TRACKED_ENV=foo coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with foo"'
sh -c 'TRACKED_ENV=bar coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with bar"'
# Fake the development package
rm -fr tracking-env
git clone -b alibuild_CI --depth 1 https://github.com/alisw/alidist tracking-env
sh -c 'TRACKED_ENV=bar coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build tracking-env --force-unknown-architecture --no-system --disable GCC-Toolchain --debug 2>&1 | tee /dev/stderr | grep "Building with bar"'
# Make sure that etc/profile.d/init.sh is re-written properly, even if the package build overwrites it.
# In particular, AliEn-Runtime does this, so we must handle this.
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build clobber-initdotsh -a {env:ARCHITECTURE} --no-system --no-remote-store >&2 && WORK_DIR=$PWD/sw . sw/{env:ARCHITECTURE}/clobber-initdotsh/1-local1/etc/profile.d/init.sh'
# AliRoot-OCDB deletes $INSTALLROOT/etc/ during build, so make sure we can handle that fine too.
sh -c 'coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c {toxinidir}/tests/testdist build delete-etc -a {env:ARCHITECTURE} --no-system --no-remote-store >&2 && WORK_DIR=$PWD/sw . sw/{env:ARCHITECTURE}/delete-etc/1-local1/etc/profile.d/init.sh'
# Actual zlib compilation is skipped on Darwin: the macos-14 GitHub Actions
# runner is Apple Silicon (arm64) and cross-compiling for a different target
# is not supported in CI. All commands that require an installed zlib are
# guarded by the same condition.
sh -c 'test "$(uname)" = Darwin || coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c alidist build zlib -a {env:ARCHITECTURE} --no-system --disable GCC-Toolchain'
bits -a {env:ARCHITECTURE} q
sh -c 'test "$(uname)" = Darwin || bits -a {env:ARCHITECTURE} setenv zlib/latest -c bash -c '"'"'[[ $LD_LIBRARY_PATH == */zlib/* ]]'"'"''
# These build/doctor commands read recipes from the alidist checkout cloned
# above. Plain `bits` now defaults --config-dir to "." (you are normally
# inside a recipe repo); the legacy `alidist` default moved into the aliBuild
# wrapper (which coverage cannot run, as it is a shell script). Pass the
# config dir explicitly instead. `init` is unaffected: it keeps its own
# `alidist` default. See args.py (BITS_REPO_DIR).
coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c alidist -a {env:ARCHITECTURE} doctor AliPhysics
coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c alidist -a {env:ARCHITECTURE} build zlib --dry-run
py311: coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c alidist --aggressive-cleanup --docker -a slc7_x86-64 --always-prefer-system -d build zlib
# Test for devel packages
coverage run --source={toxinidir} -a {toxinidir}/bitsBuild init zlib
py311: coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c alidist --aggressive-cleanup --docker -a slc7_x86-64 --always-prefer-system -d build zlib
# Test that we complain if we have a devel package with an untracked file
coverage run --source={toxinidir} -a {toxinidir}/bitsBuild init zlib
touch zlib/foo
sh -c 'test "$(uname)" = Darwin || coverage run --source={toxinidir} -a {toxinidir}/bitsBuild -c alidist -a {env:ARCHITECTURE} --no-system --disable GCC-Toolchain build zlib'
coverage run --source={envsitepackagesdir} -a -m unittest discover {toxinidir}/tests
# On Darwin we also test sapling support (recipe-repo clone only; actual
# zlib compilation is skipped for the same reason as above).
# Both sl clones are non-fatal: Sapling occasionally crashes with SIGTRAP
# on macOS ARM runners (internal assertion after a successful fetch).
darwin: - sl clone https://github.com/alisw/alidist alidist-sapling
darwin: rm -fr zlib
darwin: sh -c 'sl clone https://github.com/madler/zlib || mkdir -p zlib'
touch zlib/foo
[coverage:run]
branch = True
include =
*/alibuild*/*
*/.tox/*/lib/*/bits_helpers/*
[coverage:report]
exclude_lines =
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:
[testenv:check-readme]
description = Check README formatting
skip_install = True
deps =
readme_renderer[md]
commands =
# Absolute path: this env inherits changedir = {envtmpdir} from [testenv],
# so a bare "README.md" is looked for in the tox tmp dir and not found.
python -m readme_renderer {toxinidir}/README.md