-
Notifications
You must be signed in to change notification settings - Fork 9
147 lines (132 loc) · 4.77 KB
/
mass-rebuild-reporter.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: "Mass Rebuild Reporter"
on:
schedule:
# Hourly at minute 40, e.g. 2024-12-18 00:40:00
- cron: "40 * * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
check-for-rebuild:
if: github.repository_owner == 'fedora-llvm-team'
runs-on: ubuntu-24.04
permissions:
issues: write
container:
image: "registry.fedoraproject.org/fedora:41"
outputs:
bisect-list: ${{ steps.report.outputs.bisect-list }}
issue-id: ${{ steps.report.outputs.issue-id }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts/rebuilder.py
sparse-checkout-cone-mode: false
- name: Check for last report
uses: actions/github-script@v7
id: last-report
with:
result-encoding: string
script: |
const issues = await github.rest.search.issuesAndPullRequests({
q: "repo:" + process.env.GITHUB_REPOSITORY + "+label:mass-rebuild+is:issue",
sort: "created",
order: "desc",
per_page: 1
});
console.log(issues)
if (issues.data.total_count == 0)
return 0;
const issue = issues.data.items[0];
console.log(issue);
return issue.created_at
- name: Check if a new rebuild has completed
id: new-rebuild
run: |
sudo dnf install -y python3-dnf python3-copr python3-koji
if python3 scripts/rebuilder.py rebuild-in-progress; then
echo "completed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
last_rebuild=$(date +%s -d "${{ steps.last-report.outputs.result }}")
current_snapshot=$(date +%s -d "$(python3 scripts/rebuilder.py get-snapshot-date)")
echo "last_rebuild: $last_rebuild current_snapshot: $current_snapshot"
if [ "$last_rebuild" -gt "$current_snapshot" ]; then
echo "completed=false" >> "$GITHUB_OUTPUT"
else
echo "completed=true" >> "$GITHUB_OUTPUT"
fi
- name: Collect Regressions
if: steps.new-rebuild.outputs.completed == 'true'
id: regressions
run: |
python3 scripts/rebuilder.py get-regressions --start-date ${{ steps.last-report.outputs.result }} > regressions
echo "REGRESSIONS=$(cat regressions)" >> "$GITHUB_OUTPUT"
- name: Create Report
if: steps.new-rebuild.outputs.completed == 'true'
id: report
uses: actions/github-script@v7
env:
REGRESSIONS: ${{ steps.regressions.outputs.REGRESSIONS }}
with:
script: |
var fs = require('fs');
const regressions = await JSON.parse(fs.readFileSync('./regressions'));
comment = "During the last mass rebuild, some packages failed:\n";
console.log(regressions);
bisect_list = [];
if (regressions.length == 0)
return;
regressions.forEach(function(value){
arches = value.failed_chroots.map((value) => value.split('-')[2]);
comment = comment + `- [ ] [${value.name}](${value.url.replace('@','g/')}) (${arches})\n`
if (arches.includes('x86_64')) {
bisect_list.push(value.name)
}
});
console.log(comment);
const issue = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Mass Rebuild Report",
labels: ['mass-rebuild'],
body: comment
});
console.log(bisect_list);
core.setOutput("bisect-list", JSON.stringify(bisect_list))
core.setOutput("issue-id", issue.data.number)
bisect-failures:
if: github.repository_owner == 'fedora-llvm-team'
needs:
- check-for-rebuild
permissions:
contents: read
issues: write
strategy:
max-parallel: 1
fail-fast: false
matrix:
name: ${{ fromJson(needs.check-for-rebuild.outputs.bisect-list) }}
uses: ./.github/workflows/mass-rebuild-bisect.yml
with:
pkg: ${{ matrix.name }}
issue: ${{ needs.check-for-rebuild.outputs.issue-id }}
notify-bisect-complete:
if: always() && github.repository_owner == 'fedora-llvm-team'
runs-on: ubuntu-24.04
needs:
- check-for-rebuild
- bisect-failures
permissions:
issues: write
steps:
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: '${{ needs.check-for-rebuild.outputs.issue-id }}',
body: "Bisect Complete"
})