Skip to content
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

ci: run github actions on pull requests #1315

Closed
wants to merge 2 commits into from
Closed

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Dec 3, 2024

Closes #1308

There is some subtlety here:

What has been done to verify that this works as intended?

It's not always 100% possible to test github actions config without merging it.

Why is this the best possible solution? Were any other approaches considered?

See #1308 for alternative suggestions(s).

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

No.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

No.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

@alxndrsn alxndrsn requested a review from lognaturel December 3, 2024 03:42
@lognaturel
Copy link
Member

Won't this end up with duplicate runs for the branches that are marked as exceptions? Why not one of the alternatives in the issue?

alxndrsn pushed a commit to alxndrsn/odk-central-backend that referenced this pull request Dec 4, 2024
Spun off from getodk#1315.

Soak tests are slow, and are only likely to break occasionally.  Re-enabling them on branches when working on specific features, e.g. `slonik` or `pg` upgrades, would be sensible.
@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 4, 2024

Won't this end up with duplicate runs for the branches that are marked as exceptions?

Yes

Why not one of the alternatives in the issue?

I think the approach taken in this PR is an improvement on the current state. It's also quick to implement, and should be easy to understand how it affects job runs and how to modify configuration if it's not acceptable.

Alternatives suggested in the issue:

skip-duplicate-actions Action

This looks very powerful, and also potentially useful for more complicated build configurations in future.

Example PR: #1322

job conditionals

This looks like a blunt instrument, and will presumably trigger actions but not individual jobs within them.

Example PR: #1321


I think we just live with the double runs like we do with pyxform.

Double-runs could also be avoided if this repo is not used for individuals' development branches.

Example PR without branch restrictions: #1324


I'll open alternative PRs for the different approaches and see how they look.

As mentioned above, it may not be possible to properly test each approach without merging changes to master.

I've opened example PRs against a fork of this repo and shared screenshots & links to show how they behave.

alxndrsn pushed a commit to alxndrsn/odk-central-backend that referenced this pull request Dec 4, 2024
alxndrsn pushed a commit to alxndrsn/odk-central-backend that referenced this pull request Dec 4, 2024
@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 4, 2024

With this PR on master, and another PR opened against it from ktuite/... (alxndrsn#25):

PR View

Screenshot_2024-12-04_10-42-08

Actions View

Screenshot_2024-12-04_10-41-23

@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 4, 2024

After running through test PRs with the different configuration options, #1324 looks like the cleanest solution (simplest code, least clutter in actions & PR checks list). It has one downside, which is that branches pushed to getodk/central-backend without open PRs will not have actions run for them.

@lognaturel
Copy link
Member

lognaturel commented Dec 4, 2024

branches pushed to getodk/central-backend without open PRs will not have actions run for them.

And to forks as well, right? Right, that's the current behavior.

Let's start with that and if we find that we miss having runs on push we can take out the branch restriction and accept the double runs as we do for pyxform and other repos.

alxndrsn added a commit that referenced this pull request Dec 5, 2024
Spun off from #1315.

Soak tests are slow, and are only likely to break occasionally.  Re-enabling them on branches when working on specific features, e.g. `slonik` or `pg` upgrades, would be sensible.
@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 5, 2024

And to forks as well, right? Right, that's the current behavior.

No, I think your struck-out comment is correct! I think this will change:

from current:

  • fork branches:
    • ✅ no PR: runs once per push
    • ❌ PR open: does not run (on PR-target-repo; still runs once-per-push on source-repo)
  • local branches:
    • ✅ no PR: runs once per push
    • ✅ PR open: runs once per push

to (#1324)

  • fork branches:
    • ❌ no PR: does not run
    • ✅ PR open: runs once per push
  • local branches:
    • ✅ PR not open: runs once per push
    • ✅ PR open: runs once per push

@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 5, 2024

I'm now thinking this is the best compromise:

on:
  push:
  pull_request:

which should give us:

  • fork branches:
    • ✅ no PR: runs once per push
    • ✅ PR open: runs once per push
  • local branches:
    • ✅ no PR: runs once per push
    • ⚠️ PR open: runs twice per push

Update: I've opened #1335 which implements this approach.

alxndrsn pushed a commit to alxndrsn/odk-central-backend that referenced this pull request Dec 9, 2024
@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 9, 2024

Closing in favour of #1335

@alxndrsn alxndrsn closed this Dec 9, 2024
alxndrsn added a commit that referenced this pull request Dec 10, 2024
This may introduce duplicate builds for PRs from branches within the same repo.  For extended discussion on this issue, see #1315 

Closes #1308
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.

Github actions don't run on PRs from forks
2 participants