Update build time diagrams #8
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: | |
# # At every 60th minute. | |
# # See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule | |
# - cron: "*/60 * * * *" | |
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" | |
shell: bash -e {0} | |
run: | | |
pip list | |
echo "import sys; print(sys.path)" | python | |
echo "import sys; print(sys.path)" | python3 | |
echo $PYTHONPATH | |
main/build-stats/get-build-stats.py | tee -a gh-pages/build-stats.csv | |
cd gh-pages | |
git add build-stats.csv | |
git commit -m "Automatically updated build-stats.csv" | |
git push origin HEAD:gh-pages | |
cd - | |
- name: "Re-generate diagrams" | |
shell: bash -e {0} | |
run: | | |
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 index.html fig-*.html | |
git commit -m "Automatically regenerated diagrams" | |
git push origin HEAD:gh-pages | |
cd - |