forked from Accelize/drm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
162 lines (151 loc) · 6.19 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
# 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,integration}-{debug,release,install}, coverage-debug, export-release, package-install
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 {opts} {packages}
description =
build: Accelize DRM library, build
{c,cpp}: Accelize DRM Library tests ({envname})
coverage: Combine coverage data and create report
deps =
cython
wheel
setuptools
pytest
requests
debug: pytest-cov
debug: coverage
debug: codecov
setenv =
!install: PYTHONPATH = {env:PYTHONPATH:}{:}{envdir}/build/python3_bdist{:}{toxinidir}
!install: LD_LIBRARY_PATH = /usr/local/lib64:{envdir}/build
install: LD_LIBRARY_PATH = /usr/local/lib64
{c,cpp}-debug: COVERAGE_FILE = {envdir}/build/.coverage.{envname}
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
# Tests
{c,cpp}: TOX_*
build: SDK_DIR
envdir =
debug: {toxworkdir}/debug
!debug: {toxworkdir}/release
changedir =
!install: {envdir}/build
build-install: {envdir}/build
{c,cpp,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 {toxinidir}
build-release: cmake -DPYTHON3=ON -DTESTS=ON -DDOC=ON -DPKG=ON {toxinidir} -DCPACK_PACKAGE_RELEASE={env:PACKAGES_RELEASE:1}
build-install: cmake -DPYTHON3=ON -DTESTS=ON -DDOC=ON {toxinidir}
build: make -s -j
build-install: make install prefix=/usr
# Make packages
build-release: make package
build-release: python3 {toxinidir}/deployment/sign_packages.py packages -b "{env:GPG_PUBLIC_KEY:}" -k "{env:GPG_PRIVATE_KEY:}" -p "{env:GPG_PASS_PHRASE:}"
# 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
integration-!debug: python3 -m pytest {posargs} --integration
integration-debug: python3 -m pytest {posargs} --integration --cov=accelize_drm --cov-append
# 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/*' -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
pwd
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
integration-debug: c-debug, cpp-debug, build-debug
c-release: build-release, c-debug, integration-debug
cpp-release: build-release, cpp-debug, integration-debug
integration-release: build-release, c-release, cpp-release
export-release: build-release
build-install: build-release, c-release, cpp-release, integration-release
package-install: build-install, export-release
{c,cpp}-install: build-install, package-install
integration-install: build-install, package-install, c-install, cpp-install
coverage: cpp-debug, c-debug, integration-debug