Update build time diagrams #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update build time diagrams" | |
on: | |
schedule: | |
# Everyday at 00:45am | |
# See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule | |
- cron: "45 0 * * *" | |
workflow_dispatch: {} | |
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/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
ref: 'main' | |
path: 'main' | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v3 | |
with: | |
ref: 'gh-pages' | |
path: 'gh-pages' | |
- name: "Check for cached dependencies" | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r main/build-stats/requirements.txt | |
- name: Setup git config | |
run: | | |
git config --global user.name "Github Action Bot" | |
git config --global user.email "<>" | |
- name: "Update build stats and re-generate diagrams" | |
shell: bash -e {0} | |
run: | | |
main/build-stats/get-build-stats.py | tee -a gh-pages/build-stats.csv | |
main/build-stats/create-diagrams.py --datafile gh-pages/build-stats.csv | |
mv index.html gh-pages/index.html | |
mv fig-*.html gh-pages/ | |
cd gh-pages | |
git add build-stats.csv | |
git add index.html fig-*.html | |
git commit -m "Automatically update stats and regenerated diagrams" | |
git push origin HEAD:gh-pages |