-
Notifications
You must be signed in to change notification settings - Fork 8
114 lines (101 loc) · 3.64 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
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:
regressions: ${{ steps.regressions.outputs.REGRESSIONS }}
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
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'
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);
if (regressions.length == 0)
return;
regressions.forEach(function(value){
comment = comment + `- [ ] [${value.name}](${value.url})\n`
});
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(issue);
bisect-failures:
if: github.repository_owner == 'fedora-llvm-team'
needs:
- check-for-rebuild
strategy:
max-parallel: 1
fail-fast: false
matrix:
include: ${{ fromJson(needs.check-for-rebuild.outputs.regressions) }}
uses: ./.github/workflows/mass-rebuild-bisect.yml
with:
pkg: ${{ matrix.name }}