Skip to content

Do not use CodSpeedHQ/action on pull requests to a fork - #9761

Open
radarhere wants to merge 5 commits into
python-pillow:mainfrom
radarhere:benchmark
Open

Do not use CodSpeedHQ/action on pull requests to a fork#9761
radarhere wants to merge 5 commits into
python-pillow:mainfrom
radarhere:benchmark

Conversation

@radarhere

Copy link
Copy Markdown
Member

Second version of #9749

While we can configure the Benchmarks workflow in our own repositories, perhaps it is not ideal that it fails when pull requests are made to a fork? For example, akx#8. The receiving user might believe that the changes in my pull request are causing this workflow to fail.

@akx akx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be fine with just running Codspeed on pull requests to or pushes on python-pillow/Pillow?

Comment on lines +99 to +103
- name: Run CodSpeed benchmarks on pull requests to a fork
if: github.event_name == 'pull_request' && github.event.repository.fork == true
run: |
python3 -m pip install -e . pytest-codspeed
python3 -m pytest -vv --codspeed Tests/benchmarks.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this alternate is really needed. If you're not using the codspeed action (that does CPU simulation and other deep magic), you're not going to get comparable numbers anyhow.

Suggested change
- name: Run CodSpeed benchmarks on pull requests to a fork
if: github.event_name == 'pull_request' && github.event.repository.fork == true
run: |
python3 -m pip install -e . pytest-codspeed
python3 -m pytest -vv --codspeed Tests/benchmarks.py

GHA_LIBWEBP_CACHE_HIT: ${{ steps.cache-libwebp.outputs.cache-hit }}

- name: Run CodSpeed benchmarks
if: github.event_name != 'pull_request' || github.event.repository.fork == false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe simply

Suggested change
if: github.event_name != 'pull_request' || github.event.repository.fork == false
if: github.event.repository.fork == false

in conjunction with the below (see rationale there).

WDYT?

@radarhere

Copy link
Copy Markdown
Member Author

I'd be fine with just running Codspeed on pull requests to or pushes on python-pillow/Pillow?

This seems like the same thinking as #9946?

@akx

akx commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This seems like the same thinking as #9946?

Not really... looks like the CodSpeed action doesn't report anything on fork runs, see e.g. https://github.com/akx/Pillow/actions/runs/33734366520/job/100581356953, it just churns through running the benchmarks and then crashes and fails the run.

@hugovk

hugovk commented Sep 3, 2026

Copy link
Copy Markdown
Member

Depends if you've enabled CodSpeed on your fork, compare:

https://github.com/hugovk/Pillow/actions/runs/33500798014/job/99833423587

Can we have it not fail the run when it's not enabled?

@akx

akx commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Can we have it not fail the run when it's not enabled?

I can suggest a PR for the action, an input where we could feed ${{ github.event.repository.fork == false }} here.

But if it doesn't otherwise report the benchmark results, then it's just doing 20+ minutes of work for every push just to drop the results on the floor. (I guess it could maybe do a GitHub Step Summary instead...)

EDIT: Tuumasta toimeen, as they say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants