Skip to content

Commit 6ec42d7

Browse files
committed
Add post-merge analysis CI workflow
1 parent ac951d3 commit 6ec42d7

File tree

7 files changed

+975
-13
lines changed

7 files changed

+975
-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

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub struct Test {
7474
pub outcome: TestOutcome,
7575
}
7676

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

0 commit comments

Comments
 (0)