5
5
- cron : ' 0 0 * * *'
6
6
7
7
env :
8
+ data_branch : monitoring-data
9
+ data_path : monitoring/data
10
+ aggregated_data_branch : monitoring-aggregated-data
11
+ aggregated_data_path : monitoring/aggregated_data
8
12
monitoring_properties : monitoring/monitoring.properties
9
13
output_stats : stats.json
10
- history_file : monitoring/history.json
11
- coverage_graph_file : monitoring/coverage_graph.png
12
- quantitative_graph_file : monitoring/quantitative_graph.png
13
14
KOTLIN_HOME : /usr
14
15
15
16
jobs :
16
17
build_and_run_monitoring :
17
18
runs-on : ubuntu-20.04
18
19
steps :
19
- - name : Checkout repository
20
+ - name : Checkout main
20
21
uses : actions/checkout@v3
21
22
23
+ - name : Checkout monitoring data
24
+ uses : actions/checkout@v3
25
+ with :
26
+ ref : ${{ env.data_branch }}
27
+ path : ${{ env.data_path }}
28
+
29
+ - name : Checkout aggregated monitoring data
30
+ uses : actions/checkout@v3
31
+ with :
32
+ ref : ${{ env.aggregated_data_branch }}
33
+ path : ${{ env.aggregated_data_path }}
34
+
22
35
- uses : actions/setup-java@v3
23
36
with :
24
37
java-version : ' 8'
30
43
- uses : actions/setup-python@v4
31
44
with :
32
45
python-version : ' 3.9'
33
- cache : ' pip'
34
- - name : Install matplotlib
35
- run : pip install matplotlib
36
46
37
47
- name : Build and run monitoring UTBot Java
38
48
run : |
@@ -42,23 +52,56 @@ jobs:
42
52
utbot-junit-contest/build/libs/monitoring.jar \
43
53
$output_stats
44
54
45
- - name : Update history and render graphs
46
- run : |
47
- python monitoring/draw_stats_graphs.py \
48
- $history_file \
49
- $output_stats \
50
- $coverage_graph_file \
51
- $quantitative_graph_file
52
-
53
55
- name : Get current date
54
56
id : date
55
- run : echo "::set-output name=date::$(date +'%d-%m-%Y')"
57
+ run : |
58
+ echo "::set-output name=date::$(date +'%Y-%m-%d')"
59
+ echo "::set-output name=timestamp::$(date +%s)"
60
+ echo "::set-output name=last_month::$(date --date='last month' +%s)"
56
61
57
- - name : Commit and push graphs and statistics
62
+ - name : Get commit hash
63
+ id : metadata
64
+ run : |
65
+ echo "::set-output name=commit::$(git rev-parse HEAD)"
66
+ echo "::set-output name=branch::$(git name-rev --name-only HEAD)"
67
+ echo "::set-output name=build::$(date +'%Y.%-m')"
68
+
69
+ - name : Insert metadata
70
+ run : |
71
+ python monitoring/insert_metadata.py \
72
+ $output_stats "$data_path/data-$branch-$date-$timestamp-$commit.json" \
73
+ "$commit" "$build"
74
+ env :
75
+ date : ${{ steps.date.outputs.date }}
76
+ timestamp : ${{ steps.date.outputs.timestamp }}
77
+ commit : ${{ steps.metadata.outputs.commit }}
78
+ branch : ${{ steps.metadata.outputs.branch }}
79
+ build : ${{ steps.metadata.outputs.build }}
80
+
81
+ - name : Build aggregated data (last month)
82
+ run : |
83
+ python monitoring/build_aggregated_data.py \
84
+ $data_path $aggregated_data_path/aggregated-data-$date.json \
85
+ $timestamp_from $timestamp
86
+ env :
87
+ date : ${{ steps.date.outputs.date }}
88
+ timestamp : ${{ steps.date.outputs.timestamp }}
89
+ timestamp_from : ${{ steps.date.outputs.last_month }}
90
+
91
+ - name : Commit and push statistics
58
92
uses : actions-js/push@master
59
93
with :
94
+ branch : ${{ env.data_branch }}
60
95
message : ' night-monitoring-${{ steps.date.outputs.date }}'
61
- directory : ' ./monitoring'
96
+ directory : ${{ env.data_path }}
97
+ github_token : ${{ secrets.GITHUB_TOKEN }}
98
+
99
+ - name : Commit and push aggregated statistics
100
+ uses : actions-js/push@master
101
+ with :
102
+ branch : ${{ env.aggregated_data_branch }}
103
+ message : ' night-monitoring-${{ steps.date.outputs.date }}'
104
+ directory : ${{ env.aggregated_data_path }}
62
105
github_token : ${{ secrets.GITHUB_TOKEN }}
63
106
64
107
- name : Upload logs
@@ -67,10 +110,3 @@ jobs:
67
110
with :
68
111
name : logs
69
112
path : logs/utbot.log
70
-
71
- - name : Upload statistics
72
- if : ${{ success() }}
73
- uses : actions/upload-artifact@v3
74
- with :
75
- name : statistics
76
- path : ${{ env.output_stats }}
0 commit comments