-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtasks.py
More file actions
72 lines (54 loc) · 2.01 KB
/
tasks.py
File metadata and controls
72 lines (54 loc) · 2.01 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
from invoke import task
import os
import shutil
import platform
@task
def release(c, part):
# Refresh Python --init__.py in screamer directory
c.run("python devtools/generate_screamer__init__.py")
"""Bump version, commit, tag, and push."""
# Bump the version
c.run(f"bump2version {part}", pty=True)
# Push commits
c.run("git push origin main", pty=True)
# Push tags
c.run("git push origin --tags", pty=True)
@task
def test(c):
"""Build and run C++ tests in a cross-platform way."""
# Remove build directory if it exists
if os.path.exists('build'):
shutil.rmtree('build')
# Create build directory
os.mkdir('build')
# Change to build directory
with c.cd('build'):
# Run CMake configuration
c.run('cmake .. -DCMAKE_BUILD_TYPE=Release')
# Build the project
if platform.system() == 'Windows':
# On Windows, specify the build configuration (Debug/Release)
c.run('cmake --build . --config Release')
c.run('copy screamer_bindings*.so ..\\screamer\\')
else:
# On Unix-like systems
c.run('cmake --build .')
c.run('cp screamer_bindings*.so ../screamer/')
# Refresh Python --init__.py in screamer directory
c.run("python devtools/generate_screamer__init__.py")
c.run('pip install -e .')
c.run('pytest', pty=True)
c.run('python devtools/report_baselines.py', pty=True)
@task
def docs(c):
with c.cd('docs'):
c.run('make clean')
c.run('make html')
@task(optional=['func', 'lib', 'repeat'])
def benchmark(c, func=None, lib=None, repeat=None):
func_arg = f' --func {func}' if func else ''
lib_arg = f' --lib {lib}' if lib else ''
repeat_arg = f' --repeat {repeat}' if repeat else ''
c.run(f'python benchmarks/run_benchmarks.py {func_arg}{lib_arg}{repeat_arg}', pty=True)
c.run(f'python benchmarks/make_plots.py {func_arg}', pty=True)
c.run(f'python benchmarks/make_rank_plot.py', pty=True)