-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add path filter to workflows? #1336
Comments
Unit tests are actually running within 5 seconds :). It's the integration tests that take longer. However BentiGorlich recently combined the two into a single workflow: #1300 (comment). But yes the integration test is running for like 22 mins. On Matrix chat we were already discussion to get it paratest working in the future. But again the issue is NOT unit tests, the issue is integration tests which takes 99% of the time. There is often no easy way to determine whether or not you will need to run integration (or unit) test for a specific file changed. However, we could maybe come-up with a plan to skip the integration on PRs if the |
My mistake, I meant integration tests. |
Yes makes sense to me. And just be sure always run it on the main branch as well? |
As opposed to … running it on PRs? |
Always run it on the main branch. And only run it on PRs in case of changes, is what I mean to say. |
Ah ok, I think I understand now. Apply path filters to PR runs only. |
I was just looking through the docs about path filters, and I found this:
So for this to work, the automated-tests job would have to be set as not required. Hmm... thoughts? The only way around this limitation would be to always run the job, but somehow make a path/branch filter inside the job that would just immediately pass the test if no relevant changes are found. I feel like this should be possible, but I'd have to do more research to find out how to do it. |
Split the workflow again like it was. Create a separate workflow for integration test. Making this workflow optional. While the unit test is always required. |
I don't think that we should consider not marking the integration tests as required... If there is no way to do it, then I'd just not do it... |
Double negative.. Which makes it very hard to understand it for me 😖 . You mean, you do want to keep integration tests required? |
Yes, I think that’s what he meant, and I can understand that position and I anticipated it. That’s why I mentioned a workaround. |
You can skip steps in a workflow yes. Using a |
Oh, this is good info. Thanks, I’ll look over it. |
Great! Also.. you can use a previous step to determine whether or not to run the integration test and use for example "an output parameter": https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-output-parameter. When you then use in the follow-up |
This is proving to be challenging 😅 I do have a question about how we want to handle this. Let me lay out a scenario:
Should we:
|
My logical answer would be option 2. Also because we will run integration tests again on the main branch as well, so we will detect it no matter what. But yea.. in theory any file change apart from PHP files could lead to failing tests of course. A simple package.json file update or any other config file. |
Of course this partly depends on what info is easiest to access about the event triggering the test run. I am debugging that on a different PR right now.
|
I see.. Hm, maybe we are making it unnecessary complex for us. What about: https://github.com/marketplace/actions/changed-files? Example from above link: on:
pull_request:
branches:
- main
jobs:
automated-tests:
runs-on: ubuntu-latest
name: Automated tests
permissions:
pull-requests: read
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45 That will show all changes.. So we can also check for only files (these are all PHP files anyway) that are changed in the - name: Get all src files that have changed
id: changed-src-files
uses: tj-actions/changed-files@v45
with:
files: |
src/** Then, the outputs we could leverage, could be: A simple if check can be enough for the integration test (didn't test it): - name: Integration test
if: steps.changed-src-files.outputs.all_changed_files_count != '0'
[...] |
Is your feature request related to a problem? Please describe.
It would be nice if the workflow that runs unit tests would only run if PHP or Composer files have changed in a given PR.
Describe the solution you'd like
I’d like to add path filters to the workflow to keep it from running if relevant files haven’t changed.
Describe alternatives you've considered
None
Additional context
Getting unit tests to run in parallel would help it to be less of a blocker, but it would still take time to run that might could be avoided.
The text was updated successfully, but these errors were encountered: