Skip to content

Commit c40b798

Browse files
committed
Add post-merge analysis CI workflow
1 parent 74c9102 commit c40b798

File tree

7 files changed

+973
-13
lines changed

7 files changed

+973
-13
lines changed

.github/workflows/post-merge.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Workflow that runs after a merge to master, analyses changes in test executions
2+
# and posts the result to the merged PR.
3+
4+
name: Post merge analysis
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
analysis:
13+
runs-on: ubuntu-24.04
14+
if: github.repository == 'rust-lang/rust'
15+
permissions:
16+
pull-requests: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Perform analysis and send PR
20+
run: |
21+
# Get closest bors merge commit
22+
PARENT_COMMIT=`git rev-list --author='bors <bors@rust-lang.org>' -n1 --first-parent HEAD^1`
23+
24+
# Find PRs for current and parent commit
25+
HEAD_PR=`gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number'`
26+
27+
echo "Parent: ${PARENT_COMMIT}"
28+
echo "HEAD: ${{ github.sha }} (#${HEAD_PR})"
29+
30+
cd src/ci/citool
31+
32+
echo "Post-merge analysis result" > output.log
33+
cargo run --release post-merge-analysis ${PARENT_COMMIT} ${{ github.sha }} >> output.log
34+
cat output.log
35+
36+
gh pr comment ${HEAD_PR} -F output.log

src/build_helper/src/metrics.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct JsonRoot {
1515
#[serde(rename_all = "snake_case")]
1616
pub struct JsonInvocation {
1717
// Remembers the command-line invocation with which was bootstrap invoked.
18+
#[serde(default)]
1819
pub cmdline: String,
1920
// Unix timestamp in seconds
2021
//
@@ -74,7 +75,7 @@ pub struct Test {
7475
pub outcome: TestOutcome,
7576
}
7677

77-
#[derive(Serialize, Deserialize)]
78+
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
7879
#[serde(tag = "outcome", rename_all = "snake_case")]
7980
pub enum TestOutcome {
8081
Passed,

0 commit comments

Comments
 (0)