Skip to content

Comments

Run Extra Tests with only a label#2907

Merged
zuiderkwast merged 4 commits intovalkey-io:unstablefrom
sarthakaggarwal97:run-extra-tests-on-label
Dec 23, 2025
Merged

Run Extra Tests with only a label#2907
zuiderkwast merged 4 commits intovalkey-io:unstablefrom
sarthakaggarwal97:run-extra-tests-on-label

Conversation

@sarthakaggarwal97
Copy link
Contributor

@sarthakaggarwal97 sarthakaggarwal97 commented Dec 4, 2025

Change the behaviour of the CI job triggered by the run-extra-tests label.

Run the tests immediately when applying the run-extra-tests label to a PR, without requiring an extra commit to be pushed to trigger the test run.

When the extra tests have run, the job removes the label.

@sarthakaggarwal97 sarthakaggarwal97 added the run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) label Dec 4, 2025
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.46%. Comparing base (8ab0152) to head (6b3985d).
⚠️ Report is 13 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #2907      +/-   ##
============================================
+ Coverage     72.28%   72.46%   +0.17%     
============================================
  Files           129      129              
  Lines         70540    70540              
============================================
+ Hits          50993    51116     +123     
+ Misses        19547    19424     -123     

see 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sarthakaggarwal97 sarthakaggarwal97 added the enhancement New feature or request label Dec 4, 2025
@sarthakaggarwal97 sarthakaggarwal97 removed enhancement New feature or request run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) labels Dec 6, 2025
@sarthakaggarwal97 sarthakaggarwal97 added run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) and removed run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) labels Dec 6, 2025
@sarthakaggarwal97 sarthakaggarwal97 added run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) and removed run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) labels Dec 9, 2025
@sarthakaggarwal97 sarthakaggarwal97 added run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) and removed run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) labels Dec 10, 2025
@sarthakaggarwal97 sarthakaggarwal97 added run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) and removed run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) labels Dec 10, 2025
@sarthakaggarwal97 sarthakaggarwal97 added run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) and removed run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) labels Dec 10, 2025
@sarthakaggarwal97 sarthakaggarwal97 force-pushed the run-extra-tests-on-label branch 2 times, most recently from 71526c6 to 19e1fa4 Compare December 10, 2025 05:32
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
@sarthakaggarwal97 sarthakaggarwal97 force-pushed the run-extra-tests-on-label branch 2 times, most recently from 91e998e to 82623b0 Compare December 17, 2025 22:38
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Copy link
Member

@roshkhatri roshkhatri left a comment

Choose a reason for hiding this comment

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

LGTM, just added a thought/suggestion if we would like to add.

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

Let's merge this and test it on real PRs.

@zuiderkwast zuiderkwast merged commit 7385586 into valkey-io:unstable Dec 23, 2025
24 checks passed
jdheyburn pushed a commit to jdheyburn/valkey that referenced this pull request Jan 8, 2026
Change the behaviour of the CI job triggered by the run-extra-tests
label.

Run the tests immediately when applying the run-extra-tests label to a
PR, without requiring an extra commit to be pushed to trigger the test
run.

When the extra tests have run, the job removes the label.

---------

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
madolson pushed a commit that referenced this pull request Jan 12, 2026
The patch fixes the error by adding `pull‑requests: write` to the
permissions block of `weekly.yml`. Github rejects if the reusable
workflow's (here daily.yml) permissions are not provided.

We recently changed the permissions in `daily.yml` where we gave write
permissions in #2907
With this change, we bring parity to the permissions since `weekly.yml`
uses calls `daily.yml` workflow call method.

Fixes: https://github.com/valkey-io/valkey/actions/runs/20890545320

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
@madolson
Copy link
Member

madolson commented Jan 21, 2026

Let's merge this and test it on real PRs.

I don't like this change. Now we have to keep re-adding the run-extra tests label.

madolson pushed a commit that referenced this pull request Jan 21, 2026
…table (#3092)

Thanks madolson for pointing out the issue with
#2907.

Whenever we were using the label, it was picking up the head of the
unstable instead of the PR. The reason was that we changed the target to
`pull_request_target`. We had to do that since we wanted to remove the
label after the run is completed.

With this change, it correctly picks up the commit hash of the PR and
checks it out.

To test this, I merged the changes in my forked repository's
[unstable](unstable...sarthakaggarwal97:valkey:unstable),
created a dummy
[PR](sarthakaggarwal97#61), and was able
to verify that the commit of the PR is being checked out in the
[action](https://github.com/sarthakaggarwal97/valkey/actions/runs/21229598167/job/61084986422?pr=61#step:3:81).

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
arshidkv12 pushed a commit to arshidkv12/valkey that referenced this pull request Jan 23, 2026
…table (valkey-io#3092)

Thanks madolson for pointing out the issue with
valkey-io#2907.

Whenever we were using the label, it was picking up the head of the
unstable instead of the PR. The reason was that we changed the target to
`pull_request_target`. We had to do that since we wanted to remove the
label after the run is completed.

With this change, it correctly picks up the commit hash of the PR and
checks it out.

To test this, I merged the changes in my forked repository's
[unstable](valkey-io/valkey@unstable...sarthakaggarwal97:valkey:unstable),
created a dummy
[PR](sarthakaggarwal97#61), and was able
to verify that the commit of the PR is being checked out in the
[action](https://github.com/sarthakaggarwal97/valkey/actions/runs/21229598167/job/61084986422?pr=61#step:3:81).

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
Signed-off-by: arshidkv12 <arshidkv12@gmail.com>
@zuiderkwast
Copy link
Contributor

zuiderkwast commented Jan 30, 2026

Let's merge this and test it on real PRs.

I don't like this change. Now we have to keep re-adding the run-extra tests label.

@madolson Yeah, this is not perfect. The good thing is that we don't have to push a fake commit to make it run the first time.

If the workflow doesn't delete the label, it will run again whenever we do some small change to the PR such as adding another label (release-notes, needs-doc-pr, etc.).

If we can make it run only when there is a code change, and not when a label is added/removed (except the run-extra-tests label), that would be better. @sarthakaggarwal97 Do you want to experiment with this more?

@sarthakaggarwal97
Copy link
Contributor Author

@zuiderkwast I can take a stab at it next week.

To understand it clearly, we want to run the extra tests when

  1. Either run-extra-tests is newly applied
  2. If there is a code change and run-extra-tests is already there

Is that correct?

@zuiderkwast
Copy link
Contributor

@sarthakaggarwal97 yes that'd be ideal

@zuiderkwast
Copy link
Contributor

If we do like this, we don't have to remove the label after running.

on:
  pull_request:
    types: [ labeled, ... ]

jobs:
  test:
    if: ${{ github.event.action == 'labeled' && github.event.label.name == 'run-extra-test' }}
    ...

Idea from https://stackoverflow.com/a/62331521

We'd also not need to use pull_request_target. We can use pull_request instead which is more practical because we can modify/test the actual job in the same PR.

Comment on lines +52 to +53
(github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'unstable') ||
(github.event_name == 'pull_request_target' && github.event.label.name == 'run-extra-tests')) &&
Copy link
Contributor

@zuiderkwast zuiderkwast Feb 7, 2026

Choose a reason for hiding this comment

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

Suggested change
(github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'unstable') ||
(github.event_name == 'pull_request_target' && github.event.label.name == 'run-extra-tests')) &&
(github.event_name == 'pull_request' &&
(github.event.pull_request.base.ref != 'unstable') ||
(github.event.action == 'labeled' && github.event.label.name == 'run-extra-tests') ||
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'run-extra-tests'))) &&

Like this?

  • The event is 'labeled' and the label is 'run-extra-tests', or
  • The event is something else (e.g. push a commit) and the PR already has the label

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense. This could solve our problem. I will try this out soon. It's a little harder to test (few steps to test in forked repo) but I can come up with a change next week.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's easier to test when we don't use pull_request_target anymore. It doesn't need to be merged for testing it.

We can test it using another label name, temporarily, to prevent the pull_request_target job in unstable from picking it up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's easier to test when we don't use pull_request_target anymore.

Ah that's true yes.

harrylin98 pushed a commit to harrylin98/valkey_forked that referenced this pull request Feb 19, 2026
The patch fixes the error by adding `pull‑requests: write` to the
permissions block of `weekly.yml`. Github rejects if the reusable
workflow's (here daily.yml) permissions are not provided.

We recently changed the permissions in `daily.yml` where we gave write
permissions in valkey-io#2907
With this change, we bring parity to the permissions since `weekly.yml`
uses calls `daily.yml` workflow call method.

Fixes: https://github.com/valkey-io/valkey/actions/runs/20890545320

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
harrylin98 pushed a commit to harrylin98/valkey_forked that referenced this pull request Feb 19, 2026
…table (valkey-io#3092)

Thanks madolson for pointing out the issue with
valkey-io#2907.

Whenever we were using the label, it was picking up the head of the
unstable instead of the PR. The reason was that we changed the target to
`pull_request_target`. We had to do that since we wanted to remove the
label after the run is completed.

With this change, it correctly picks up the commit hash of the PR and
checks it out.

To test this, I merged the changes in my forked repository's
[unstable](valkey-io/valkey@unstable...sarthakaggarwal97:valkey:unstable),
created a dummy
[PR](sarthakaggarwal97#61), and was able
to verify that the commit of the PR is being checked out in the
[action](https://github.com/sarthakaggarwal97/valkey/actions/runs/21229598167/job/61084986422?pr=61#step:3:81).

Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
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.

4 participants