Skip to content

Commit

Permalink
[summary] Track CI job runtime (#2936)
Browse files Browse the repository at this point in the history
## Motivation

It would be nice to see CI runtime regressions or improvements in the PRs.

## Proposal

Create Rust CLI tool that checks runtimes, compares against base ref, and comments on the PR with a summary of the changes.
This works, but as you guys can see it's pretty ugly for now, we're just posting the JSON 😅
We're also commenting for every successful workflow run in CI.

The PR is already pretty big so I will do the following follow ups:
- [x] Markdown format this in a pretty way (done in #2946)
- [x] Add the performance summary markdown as a [job summary](https://github.blog/news-insights/product-news/supercharging-github-actions-with-job-summaries/) of the job, so people have access to historical versions of this (done in #2948)
- [x] Find if there's already a performance summary comment, and edit it instead of always posting a new one (done in #2953)
- [ ] Might make sense to only post if the change exceeds some percentage threshold for now. Open to suggestions

Other follow ups are tracked in the issue for this: #2834

## Test Plan

Triggered a modified version of this manually with workflow dispatch, it works, but we can unfortunately only know for sure this works by merging :/ 

## Release Plan

- Nothing to do / These changes follow the usual release cycle.
  • Loading branch information
ndr-ds authored Nov 26, 2024
1 parent c5eb96f commit d752ee0
Show file tree
Hide file tree
Showing 12 changed files with 868 additions and 12 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/performance_summary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Performance Summary

on:
workflow_run:
workflows:
- Rust
types:
- completed
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs on pull-requests
concurrency:
group: '${{ github.workflow }} @ ${{ github.head_ref || github.event.workflow_run.head_commit.id || github.event.workflow_run.id || github.run_id }}'
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
performance-summary:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Post Performance Summary comment on PR
if: ${{ github.event.workflow_run.event == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
GITHUB_BASE_BRANCH: ${{ github.event.workflow_run.pull_requests[0].base.ref}}
GITHUB_PR_BRANCH: ${{ github.event.workflow_run.pull_requests[0].head.ref }}
GITHUB_PR_COMMIT_HASH: ${{ github.event.workflow_run.pull_requests[0].head.sha }}
# The list of workflows that trigger this need to be hardcoded above.
# Make sure you have the same comma separated list of workflows here.
run: cargo run -p linera-summary -- --workflows "Rust" ci
Loading

0 comments on commit d752ee0

Please sign in to comment.