Pants CI: Run all unit and pack tests#6269
Conversation
|
|
||
| python_tests( | ||
| name="tests", | ||
| tags=["unit"], |
There was a problem hiding this comment.
This allowed me to run all unit tests without explicitly running the pylint_plugins tests.
| --tag=unit | ||
| test '::' |
There was a problem hiding this comment.
:: is a glob that means everything. Using --tag=unit filters everything down to only those test targets that are tagged with unit.
| --tag=pack | ||
| test '::' |
There was a problem hiding this comment.
:: is a glob that means everything. Using --tag=pack filters everything down to only those test targets that are tagged with pack.
Using the Merge OK jobs simplifies setting up the branch protection rules.
4491f12 to
8f16a19
Compare
|
|
This will hopefully help people (like me) who forget to set these vars.
26dd9f8 to
df96ef0
Compare
d9421e8 to
37125e7
Compare
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # a test uses a submodule, and pants needs access to it to calculate deps. | ||
| submodules: 'recursive' | ||
| # sadly, the submodule will only have fetch-depth=1, which is what we want | ||
| # for st2.git, but not for the submodules. We still want actions/checkout | ||
| # to do the initial checkout, however, so that it adds auth for fetching | ||
| # in the submodule. | ||
|
|
||
| - name: Fetch repository submodules | ||
| run: | | ||
| git submodule status | ||
| git submodule foreach 'git fetch --all --tags' | ||
| git submodule foreach 'git tag' |
There was a problem hiding this comment.
I tried turning this block into a local action, but checkout has to happen first, before using local actions, so that did not work.
There is hope for a less repetitive workflow, however. actions/runner#1182 says YAML anchor/alias support for GHA workflows is on the roadmap for 2025.
This PR updates pants CI so pants+pytest will run all unit and pack tests in CI.
Other things in this PR:
ST2TESTS_REDIS_HOSTandST2TESTS_REDIS_PORTenv vars to error/warning messages when coordination backend isn't configured or whenpants-plugins/uses_servicescan't find a running redis service. I added this because I forgot about that, which made tests fail.ensure_indexes = Trueon one st2api triggertypes test that was failing because the index wasn't in mongo. My best guess is that the test relied on another test to create the indexes.This cherry-picks the last changes from #6202 which I will leave as-is for historical reference.
Closes #6202