Skip to content

Commit ba59526

Browse files
authored
Night Statistics Monitoring (#701)
1 parent 7aebf61 commit ba59526

File tree

22 files changed

+1398
-164
lines changed

22 files changed

+1398
-164
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: "UTBot Java: night statistics monitoring"
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
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
12+
monitoring_properties: monitoring/monitoring.properties
13+
output_stats: stats.json
14+
15+
jobs:
16+
build_and_run_monitoring:
17+
runs-on: ubuntu-20.04
18+
container: unittestbot/java-env:java11-zulu-jdk-fx-gradle7.4.2-kotlinc1.7.0
19+
steps:
20+
- name: Install git
21+
run: |
22+
apt-get upgrade -y
23+
apt-get update -y
24+
apt-get install git -y
25+
git config --global --add safe.directory $(pwd)
26+
27+
- name: Checkout main
28+
uses: actions/checkout@v3
29+
30+
- name: Checkout monitoring data
31+
uses: actions/checkout@v3
32+
with:
33+
ref: ${{ env.data_branch }}
34+
path: ${{ env.data_path }}
35+
36+
- name: Checkout aggregated monitoring data
37+
uses: actions/checkout@v3
38+
with:
39+
ref: ${{ env.aggregated_data_branch }}
40+
path: ${{ env.aggregated_data_path }}
41+
42+
- uses: actions/setup-python@v4
43+
with:
44+
python-version: '3.9'
45+
46+
- name: Build and run monitoring UTBot Java
47+
run: |
48+
gradle :utbot-junit-contest:monitoringJar
49+
java -jar \
50+
-Dutbot.monitoring.settings.path=$monitoring_properties \
51+
utbot-junit-contest/build/libs/monitoring.jar \
52+
$output_stats
53+
54+
- name: Get current date
55+
id: date
56+
run: |
57+
echo "::set-output name=date::$(date +'%Y-%m-%d')"
58+
echo "::set-output name=timestamp::$(date +%s)"
59+
echo "::set-output name=last_month::$(date --date='last month' +%s)"
60+
61+
- name: Get metadata
62+
id: metadata
63+
run: |
64+
echo "::set-output name=commit::$(git rev-parse HEAD)"
65+
echo "::set-output name=short_commit::$(git rev-parse --short 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+
--stats_file $output_stats \
73+
--output_file "$data_path/data-$branch-$date-$timestamp-$short_commit.json" \
74+
--commit $commit \
75+
--branch $branch \
76+
--build "$build" \
77+
--timestamp $timestamp \
78+
--source_type "github-action" \
79+
--source_id $run_id
80+
env:
81+
date: ${{ steps.date.outputs.date }}
82+
timestamp: ${{ steps.date.outputs.timestamp }}
83+
commit: ${{ steps.metadata.outputs.commit }}
84+
short_commit: ${{ steps.metadata.outputs.short_commit }}
85+
branch: ${{ steps.metadata.outputs.branch }}
86+
build: ${{ steps.metadata.outputs.build }}
87+
run_id: ${{ github.run_id }}
88+
89+
- name: Build aggregated data (last month)
90+
run: |
91+
python monitoring/build_aggregated_data.py \
92+
--input_data_dir $data_path \
93+
--output_file $aggregated_data_path/aggregated-data-$date.json \
94+
--timestamp_from $timestamp_from \
95+
--timestamp_to $timestamp
96+
env:
97+
date: ${{ steps.date.outputs.date }}
98+
timestamp: ${{ steps.date.outputs.timestamp }}
99+
timestamp_from: ${{ steps.date.outputs.last_month }}
100+
101+
- name: Commit and push statistics
102+
uses: actions-js/push@master
103+
with:
104+
branch: ${{ env.data_branch }}
105+
message: 'night-monitoring-${{ steps.date.outputs.date }}'
106+
directory: ${{ env.data_path }}
107+
github_token: ${{ secrets.GITHUB_TOKEN }}
108+
109+
- name: Commit and push aggregated statistics
110+
uses: actions-js/push@master
111+
with:
112+
branch: ${{ env.aggregated_data_branch }}
113+
message: 'night-monitoring-${{ steps.date.outputs.date }}'
114+
directory: ${{ env.aggregated_data_path }}
115+
github_token: ${{ secrets.GITHUB_TOKEN }}
116+
117+
- name: Upload logs
118+
if: ${{ always() }}
119+
uses: actions/upload-artifact@v3
120+
with:
121+
name: logs
122+
path: logs/utbot.log

0 commit comments

Comments
 (0)