Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
85 lines (73 loc) · 1.81 KB
/
Copy pathindex.js
File metadata and controls
85 lines (73 loc) · 1.81 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
const { getInputArray } = require('./src/utils');
const DVC = require('./src/dvc');
const CI = require('./src/ci');
const Report = require('./src/report');
const {
METRICS_FORMAT,
BASELINE,
DVC_TAG_PREFIX,
REPRO_TARGETS
} = require('./src/settings');
const {
git_fetch_all,
check_ran_ref,
handle_error,
ref_parser,
publish_report,
is_pr,
ref,
head_sha,
user_email,
user_name,
remote
} = process.env.GITHUB_ACTION
? require('./src/github')
: require('./src/gitlab');
const run = async () => {
const {
baseline = BASELINE,
metrics_format = METRICS_FORMAT,
tag_prefix = DVC_TAG_PREFIX
} = process.env;
const repro_targets = getInputArray('repro_targets', REPRO_TARGETS);
const metrics_diff_targets = getInputArray('metrics_diff_targets');
const dvc_pull = getInputArray('dvc_pull');
Report.DVC_TAG_PREFIX = metrics_format;
CI.DVC_TAG_PREFIX = tag_prefix;
if (await CI.commit_skip_ci()) {
console.log(`${CI.CI_SKIP_MESSAGE} found; skipping task`);
return;
}
if (is_pr && (await check_ran_ref({ ref }))) {
console.log(
'This ref is running or has runned another check. Cancelling...'
);
return;
}
console.log('Fetch all history for all tags and branches');
await git_fetch_all();
await DVC.setup();
await DVC.setup_remote({ dvc_pull });
const repro_sha = await CI.run_dvc_repro_push({
user_email,
user_name,
remote,
ref,
repro_targets
});
console.log('Generating DVC Report');
const to = repro_sha || head_sha;
const dvc_report_out = await CI.dvc_report({
from: baseline,
to,
metrics_diff_targets,
ref_parser
});
console.log('Publishing Report');
await publish_report({
repro_sha,
head_sha: repro_sha || head_sha,
report: dvc_report_out.md
});
};
run().catch(e => handle_error(e));