-
-
Notifications
You must be signed in to change notification settings - Fork 747
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
Pants CI: Run all unit and pack tests #6269
Conversation
@@ -8,6 +8,7 @@ python_sources() | |||
|
|||
python_tests( | |||
name="tests", | |||
tags=["unit"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allowed me to run all unit tests without explicitly running the pylint_plugins tests.
.github/workflows/test.yaml
Outdated
--tag=unit | ||
test '::' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_HOST
andST2TESTS_REDIS_PORT
env vars to error/warning messages when coordination backend isn't configured or whenpants-plugins/uses_services
can't find a running redis service. I added this because I forgot about that, which made tests fail.ensure_indexes = True
on 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