-
Notifications
You must be signed in to change notification settings - Fork 8
82 lines (73 loc) · 2.94 KB
/
update-build-time-diagrams.yml
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
name: "Update build time diagrams"
on:
schedule:
# At 23:00
# See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule
- cron: "0 23 * * *"
workflow_dispatch:
inputs:
get_stats:
description: 'Get stats'
default: true
required: false
type: boolean
create_diagrams:
description: 'Create diagrams'
default: true
required: false
type: boolean
permissions:
# This should allow the workflow to create github pages
pages: write
# This should allow the workflow to create a new commit in the gh-branch
contents: write
jobs:
update-build-time-diagrams:
runs-on: ubuntu-latest
steps:
- name: Setup Copr config file
env:
# You need to have those secrets in your repo.
# See also: https://copr.fedorainfracloud.org/api/.
COPR_CONFIG_FILE: ${{ secrets.COPR_CONFIG }}
run: |
mkdir -p ~/.config
printf "$COPR_CONFIG_FILE" > ~/.config/copr
- uses: actions/checkout@v4
with:
path: main
- uses: ./main/.github/actions/prepare-python
with:
checkout-path: main
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: 'gh-pages'
path: 'gh-pages'
- name: Setup git config
run: |
git config --global user.name "Github Actions Bot"
git config --global user.email "<>"
- name: "Update build stats and re-generate diagrams"
shell: bash -e {0}
env:
get_stats: ${{ github.event_name == 'schedule' && true || github.event.inputs.get_stats }}
create_diagrams: ${{ github.event_name == 'schedule' && true || github.event.inputs.create_diagrams }}
run: |
if ${{ env.get_stats }}; then
main/scripts/get-build-stats.py --copr-projectname llvm-snapshots-incubator-`date '+%Y%m%d'` | tee -a gh-pages/build-stats.csv
main/scripts/get-build-stats.py --copr-projectname llvm-snapshots-big-merge-`date '+%Y%m%d'` | tee -a gh-pages/build-stats-big-merge.csv
main/scripts/get-build-stats.py --copr-projectname llvm-snapshots-pgo-`date '+%Y%m%d'` | tee -a gh-pages/build-stats-pgo.csv
git -C gh-pages add build-stats.csv build-stats-big-merge.csv build-stats-pgo.csv
fi
if ${{ env.create_diagrams }}; then
main/scripts/create-diagrams.py --datafile gh-pages/build-stats.csv --datafile-big-merge gh-pages/build-stats-big-merge.csv --datafile-pgo gh-pages/build-stats-pgo.csv
mv index.html gh-pages/index.html
mv fig-*.html gh-pages/
git -C gh-pages add index.html fig-*.html
fi
if [[ ${{ env.get_stats }} || ${{ env.create_diagrams }} ]]; then
cd gh-pages
git commit -m "Automatically update build stats"
git push origin HEAD:gh-pages
fi