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: skip js/py workflows if sources are unchanged #5140

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

p2edwards
Copy link
Contributor

@p2edwards p2edwards commented Oct 1, 2024

(TESTING)

  • verify with test commits
    • initial commit skipped the workflows
    • test a python change
    • test a js change
    • test a config change
    • test with a markdown-only commit
  • screenshot test commits
  • remove test commits
  • PR review
  • clarify skipping behavior (pr vs commit vs push)

Description

Make Pull Requests CI workflows for pytest, npm-test, and darker only run when related files are updated.

Details

  • Faster merge if waiting for CI
  • Use fewer build CI minutes

Changes

  • pytest workflow — runs on changes to the Python dependencies, files under kpi, kobo and hub, or other scripts.
  • darker workflow — runs on changes to Python files it wants to lint, or the linter configuration.
  • npm-test workflow — runs on changes to the frontend files, npm dependencies, build system, or linter config.
  • all of the above workflows — Markdown-only changes will not trigger a check.

Not changed

  • all of the above — all workflows still run on push: branches: [ main ] regardless of files changed
  • npm-test node_modules are still cached between runs (keyed on package-lock.json, patches, node version, OS version)

Tradeoffs

  • Future additions — New config files, build systems or top-level source folders would need to be included/excluded by the paths in .github/workflows to avoid unnecessary runs or skips.

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Run ./python-format.sh to make sure that your code lints and that you've followed our coding style
  5. Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes

- on pull request, skip unrelated CI checks
- always run js/py test workflows on push [ main ]
@p2edwards p2edwards added workflow Related to development process Back end Front end labels Oct 1, 2024
@Akuukis Akuukis self-assigned this Oct 2, 2024
@Akuukis
Copy link
Contributor

Akuukis commented Oct 2, 2024

See kalvis/checks-selectively branch for alternative approach draft that likely does the same, except with the improvement of visibly marking check as skipped instead of silently skipping it altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Back end Front end workflow Related to development process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants