This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtox.ini
186 lines (175 loc) · 7.56 KB
/
tox.ini
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# Run build and tests of the Accelize DRM library
#
# Run using tox command (see https://tox.readthedocs.io).
#
# Testing environments ("c-*" & "cpp-*" environments):
# - Theses environments accept all command line arguments supported by "pytest"
# command used to test the DRM library (--cred, --fpga_image, ...)
# - Theses environments requires a FPGA device and a proper "cred.json" file.
#
# This file provides following common scenarios:
# - Build in debug mode and run tests with Coverage:
#
# "tox -e build-debug,c-debug,cpp-debug,coverage-debug -- --cred=./cred.json"
#
# It is possible to export coverage to "codecov.io" by passing the
# "CODECOV_TOKEN" environment variable containing the CodeCov token.
#
# - Build in release mode and run tests:
#
# "tox -e build-release,c-release,cpp-release -- --cred=./cred.json"
#
# It is possible to sign packages by passing "GPG_PRIVATE_KEY" and
# "GPG_PUBLIC_KEY" environment variable containing the paths to private and
# public GPG keys, and passing "GPG_PASS_PHRASE" environment variable
# containing GPG key pass phrase.
#
# - Build in release mode, install and run tests:
#
# "tox -e build-install,c-install,cpp-install -- --cred=./cred.json"
#
# - Build in release mode and export packages:
#
# "tox -e build-release,export-release"
#
# It is required to configure export directory using the "PACKAGES_DIR"
# environment variable.
# It is possible to define the release number of the packages using the
# "PACKAGES_RELEASE" environment variable (Default to "1")
#
# - Install from packages and run tests:
#
# "tox -e package-install,c-install,cpp-install -- --cred=./cred.json"
#
# It is required to configure package source directory using the
# "PACKAGES_DIR" environment variable.
#
[tox]
minversion = 3.7.0
envlist = {build,c,cpp,noparallel,awsxrt,awsf1}-{debug,release,install}, {sign,export}-release, package-install, build-doc, {coverage,aws-build}-debug
skipsdist = True
[testenv]
whitelist_externals = *
skip_install = True
isolated_build = False
sitepackages = True
recreate = False
args_are_paths = False
install_command = python -m pip install -U --no-cache-dir --disable-pip-version-check {opts} {packages}
description =
build: Accelize DRM library build
{c,cpp,noparallel,awsxrt,awsf1}: Accelize DRM Library tests ({envname})
coverage: Combine coverage data and create report
deps =
cython
pyopencl
flake8
flask
pytest
pytest-flask
requests
setuptools
wheel
debug: pytest-cov
debug: coverage
debug: codecov
build-doc: sphinx_rtd_theme
build-doc: breathe
setenv =
SDK_DIR = /opt/aws_fpga/sdk
XILINX_XRT = /opt/xilinx/xrt
!install: PYTHONPATH = {env:PYTHONPATH:}{:}{envdir}/build/python3_bdist{:}{toxinidir}
!install: LD_LIBRARY_PATH = /usr/local/lib64:{envdir}/build:/opt/xilinx/xrt/lib
install: LD_LIBRARY_PATH = /usr/local/lib64
{c,cpp}-debug: COVERAGE_FILE = {envdir}/build/.coverage.{envname}
aws: CMAKE_EXTRA_OPTIONS = -DAWS=ON
!aws: CMAKE_EXTRA_OPTIONS = -DAWS=OFF
# QA_RPATHS is used to ignore RPATH error when packaging python library
QA_RPATHS=$(( 0x0001|0x0010 ))
passenv=
# "codecov.io" token
coverage: CODECOV_TOKEN
# Directory to export/install packages
export-release: PACKAGES_DIR
package-install: PACKAGES_DIR
# Package release
build-{release,install}: PACKAGES_RELEASE
sign: GPG_PRIVATE_KEY
sign: GPG_PUBLIC_KEY
sign: GPG_PASS_PHRASE
# Tests
{build,c,cpp,noparallel,awsxrt,awsf1}: TOX_*
{build,c,cpp,noparallel,awsxrt,awsf1}: XILINX_*
aws: SDK_DIR
envdir =
debug: {toxworkdir}/debug
!debug: {toxworkdir}/release
changedir =
!install: {envdir}/build
build-install: {envdir}/build
{c,cpp,noparallel,awsxrt,awsf1,package}-install: {toxinidir}
commands =
# Force the use of system interpreter
{release,install}: -sh -c 'mv {envdir}/bin {envdir}/bin.bak'
# Build
build-debug: python3 -m coverage erase
build-debug: cmake -DPYTHON3=ON -DTESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON {env:CMAKE_EXTRA_OPTIONS} {toxinidir}
build-doc: cmake -DPYTHON3=ON -DDOC=ON {toxinidir}
build-release: cmake -DPYTHON3=ON -DTESTS=ON -DPKG=ON {toxinidir} -DCPACK_PACKAGE_RELEASE={env:PACKAGES_RELEASE:1}
build-install: cmake -DPYTHON3=ON -DTESTS=ON {toxinidir}
build: make -s -j
build-install: make install prefix=/usr
# Make packages
build-release: make package
sign-release: python3 {toxinidir}/deployment/sign_packages.py packages
# Export packages in PACKAGES_DIR directory
export-release: sh -c 'mkdir -p {env:PACKAGES_DIR}'
export-release: sh -c 'rm -Rfv {env:PACKAGES_DIR}/*'
export-release: sh -c 'cp -LRfpv packages/* {env:PACKAGES_DIR}'
# install from packages in PACKAGES_DIR directory
package-install: python3 {toxinidir}/deployment/install_packages.py {env:PACKAGES_DIR:}
# Run tests
c-!debug: python3 -m pytest {posargs} --backend=c
c-debug: python3 -m pytest {posargs} --backend=c --cov=accelize_drm --cov-append
cpp-!debug: python3 -m pytest {posargs} --backend=c++
cpp-debug: python3 -m pytest {posargs} --backend=c++ --cov=accelize_drm --cov-append
noparallel-!debug: python3 -m pytest {posargs} --noparallel
noparallel-debug: python3 -m pytest {posargs} --noparallel --cov=accelize_drm --cov-append
awsxrt: python3 -m pytest {posargs} --backend=c --fpga_driver="aws_xrt" -m awsxrt
awsf1: python3 -m pytest {posargs} --backend=c --fpga_driver="aws_f1" -m awsf1
# Collect coverage
coverage: -python3 -m coverage combine
coverage: -lcov --capture --directory . --output-file coverage.info -q
coverage: -lcov -r coverage.info '/usr/include/*' '*/drm_controller_sdk/*' '*/tests/*' '*/spdlog/*' -o coverage.info -q
# Produce HTML coverage report
coverage: -python3 -m coverage html -d report/coverage_python
coverage: -genhtml coverage.info -q --legend -o report/coverage_c_cpp
# Upload coverage status
coverage: -python3 -m coverage xml
coverage: -ln -s {toxinidir}/.git .
coverage: -sed -i 's#python3_bdist/accelize_drm/_accelize_drm#python3_bdist/src/_accelize_drm#g' coverage.xml
coverage: -python3 -m codecov -f coverage.xml coverage.info
# Show coverage summary
coverage: -python3 -m coverage report -m
coverage: -lcov --list coverage.info
commands_post=
# Restore Virtual env
{release,install}: -sh -c 'mv {envdir}/bin.bak {envdir}/bin'
depends =
{c,cpp}-debug: build-debug, aws-build-debug
noparallel-debug: build-debug, aws-build-debug, c-debug, cpp-debug
awsxrt-debug: build-debug, aws-build-debug, c-debug, cpp-debug, noparallel-debug
awsf1-debug: build-debug, aws-build-debug, c-debug, cpp-debug, noparallel-debug, awsxrt-debug
c-release: build-release, c-debug, noparallel-debug
cpp-release: build-release, cpp-debug, noparallel-debug
noparallel-release: build-release, c-release, cpp-release
awsxrt-release: build-release, c-release, cpp-release, noparallel-release
awsf1-release: build-release, c-release, cpp-release, noparallel-release, awsxrt-release
export-release: build-release
build-install: build-release, c-release, cpp-release, noparallel-release
package-install: build-install, export-release
{c,cpp}-install: build-install, package-install
noparallel-install: build-install, package-install, c-install, cpp-install
awsxrt-install: build-install, package-install, c-install, cpp-install, noparallel-install
awsf1-install: build-install, package-install, c-install, cpp-install, noparallel-install, awsxrt-install
coverage: cpp-debug, c-debug, noparallel-debug