Skip to content

Update build time diagrams #150

Update build time diagrams

Update build time diagrams #150

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-bootstrap-`date '+%Y%m%d'` | tee -a gh-pages/build-stats-bootstrap.csv
git -C gh-pages add build-stats.csv build-stats-big-merge.csv build-stats-bootstrap.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-bootstrap gh-pages/build-stats-bootstrap.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