From 88f770744ab2057cf7d88a0616aaf561c71e768f Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Mon, 9 Jan 2023 15:26:46 +0100 Subject: [PATCH] Update weekly_stats.yaml --- .github/workflows/weekly_stats.yaml | 51 ++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/.github/workflows/weekly_stats.yaml b/.github/workflows/weekly_stats.yaml index f77fd3213..4b1f6bd8b 100644 --- a/.github/workflows/weekly_stats.yaml +++ b/.github/workflows/weekly_stats.yaml @@ -105,11 +105,14 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Create stats + - name: Install apps + run: | + sudo apt-get install gawk -y + sudo apt-get install gnuplot-nox -y + - name: Create global stats run: | # Prepare data cp Stats Stats3 - sudo apt-get install gawk -y # Inverse file gawk -i inplace '{for(i=NF;i>1;i--)printf "%s ",$i;printf "%s",$1;print ""}' Stats3 # Only totals @@ -133,23 +136,61 @@ jobs: }' Stats3 > StatsTmp && mv StatsTmp Stats3 sed -i "1d" Stats3 # Plot graph - sudo apt-get install gnuplot-nox -y gnuplot-nox -persist <<-EOFMarker set title 'Total addons' set ylabel 'Number of installations' - #set xlabel 'Día' set xdata time set timefmt "%Y-%m-%d" set format x "%y-%m-%d" set datafile sep ' ' set key top left autotitle columnheader - #set grid set autoscale set terminal png size 500,300 set output 'stats.png' plot 'Stats3' using 1:2 lt rgb 'red' w l title 'Total addons' EOFMarker rm Stats3 + - name: Create addons stats + run: | + # Prepare data + cp Stats Stats3 + # Remove Totals + sed -i "2d" Stats3 + # Inverse file + gawk -i inplace '{for(i=NF;i>1;i--)printf "%s ",$i;printf "%s",$1;print ""}' Stats3 + # Transpose data + awk ' + { + for (i=1; i<=NF; i++) { + a[NR,i] = $i + } + } + NF>p { p = NF } + END { + for(j=1; j<=p; j++) { + str=a[1,j] + for(i=2; i<=NR; i++){ + str=str" "a[i,j]; + } + print str + } + }' Stats3 > StatsTmp && mv StatsTmp Stats3 + sed -i "1d" Stats3 + # Plot graph + gnuplot-nox -persist <<-EOFMarker + set title 'Total addons' + set ylabel 'Number of installations' + set xdata time + set timefmt "%Y-%m-%d" + set format x "%y-%m-%d" + set datafile sep ' ' + set key top left autotitle columnheader + set autoscale + set terminal png size 500,300 + set output 'stats_addons.png' + plot for [i=1:*] 'Stats3' using 0:i + EOFMarker + rm Stats3 - name: Commit if needed uses: EndBug/add-and-commit@v9 with: