-
Notifications
You must be signed in to change notification settings - Fork 8
80 lines (72 loc) · 2.83 KB
/
update-latest-report.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
#
# This workflow is run either by a manual workflow dispatch, or
# as part of a daily build.
#
# We assume that we have run the test suite for all packages and
# generated a report by calling the test-all YML workflow beforehand.
# The report is uploaded to the data branch on the repository
# and the symlink pointing to the latest report is updated there.
# In addition, the badge for the latest workflow is generated and
# is uploaded to the data branch as well. Finally, the html
# redirect pointing to the latest report is updated and uploaded
# to the gh-pages branch on the repository.
#
# TODO: Create a Slack notification if a package is failing only
# on the current run.
#
name: "Update latest report"
on:
workflow_call:
inputs:
which-gap:
description: 'Either a GAP branch name or a GAP version'
required: true
type: string
default: master # or 4.11.1 or ...
jobs:
update-latest:
name: "Upload report"
runs-on: ubuntu-20.04
steps:
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/checkout@v4
- name: "Install package distribution tools"
run: python -m pip install -r tools/requirements.txt
- name: "Download report"
uses: actions/download-artifact@v4
with:
name: report-${{ github.event.inputs.which-gap || inputs.which-gap }}
path: _report
- name: "Create data and gh-pages worktree"
run: |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
git fetch
git branch --track data origin/data
git worktree add data data
git branch --track gh-pages origin/gh-pages
git worktree add gh-pages gh-pages
- name: "Update latest report"
run: |
ROOT="data/reports"
DIR_REL=$(jq -r '.id' < '_report/test-status.json')
DIR="${ROOT}/${DIR_REL}"
mkdir -p ${DIR}
mv _report/* ${DIR}
tools/update_latest_report.py ${DIR_REL} latest-${{ github.event.inputs.which-gap || inputs.which-gap }}
- name: "Push report"
id: push-report
run: |
git config --global user.name 'gap-package-distribution-bot'
# https://api.github.com/users/gap-package-distribution-bot%5Bbot%5D
git config --global user.email '100730870+gap-package-distribution-bot[bot]@users.noreply.github.com'
cd data
git add -A
git commit -m "Automated report for ${{ github.event.inputs.which-gap || inputs.which-gap }}"
git pull --rebase && git push
cd ../gh-pages
git add -A
git commit -m "Automated redirect for ${{ github.event.inputs.which-gap || inputs.which-gap }}"
git pull --rebase && git push