forked from the-blue-alliance/the-blue-alliance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pavement.py
97 lines (73 loc) · 2.52 KB
/
pavement.py
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
# Easy paver commands for less command typing and more coding.
# Visit http://paver.github.com/paver/ to get started. - @brandondean Sept. 30
import subprocess
import json
import time
from paver.easy import *
path = path("./")
@task
def javascript():
"""Combine Compress Javascript"""
print("Combining and Compressing Javascript")
sh("python do_compress.py js")
@task
def less():
"""Build and Combine CSS"""
print("Building and Combining CSS")
sh("lessc static/css/less_css/tba_style.main.less static/css/less_css/tba_style.main.css")
sh("lessc static/css/less_css/tba_style.gameday.less static/css/less_css/tba_style.gameday.css")
sh("python do_compress.py css")
@task
def lint():
sh("python linter.py")
@task
def make():
javascript()
less()
git_branch_name = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"])
git_last_commit = subprocess.check_output(["git", "log", "-1"])
build_time = time.ctime()
data = {'git_branch_name': git_branch_name,
'git_last_commit': git_last_commit,
'build_time': build_time}
with open('version_info.json', 'w') as f:
f.write(json.dumps(data))
@task
def preflight():
"""Prep a prod push"""
test_function([])
make()
@task
def setup():
"""Set up for development environments."""
setup_function()
@task
@consume_args
def test(args):
"""Run tests. Accepts an argument to match subnames of tests"""
test_function(args)
@task
def test_fast():
"""Run tests that don't require HTTP"""
print("Running Fast Tests")
sh("python run_tests.py --test_pattern=test_math_*.py")
sh("python run_tests.py --test_pattern=test_*parser*.py")
sh("python run_tests.py --test_pattern=test_*manipulator.py")
sh("python run_tests.py --test_pattern=test_*api.py")
sh("python run_tests.py --test_pattern=test_event.py")
sh("python run_tests.py --test_pattern=test_match_cleanup.py")
sh("python run_tests.py --test_pattern=test_event_group_by_week.py")
sh("python run_tests.py --test_pattern=test_event_team_repairer.py")
sh("python run_tests.py --test_pattern=test_event_team_updater.py")
sh("python run_tests.py --test_pattern=test_event_get_short_name.py")
def setup_function():
make()
print("Set up test data at http://localhost:8088/admin/")
print("1/ Click 'Get Teams' and 'Create Test Events'")
print("2/ Click 'Create Test Events'")
def test_function(args):
print("Running Tests")
test_pattern = ""
if len(args) > 0:
test_pattern = " --test_pattern=*%s*" % args[0]
sh("python run_tests.py%s" % test_pattern)