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

Pants CI: Run all unit and pack tests #6269

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
39 changes: 33 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
git submodule foreach 'git tag'

- name: 'Set up Python (${{ matrix.python-version }})'
id: python
uses: actions/setup-python@v5
with:
python-version: '${{ matrix.python-version }}'
Expand All @@ -102,19 +103,45 @@ jobs:
# To ignore a bad cache, bump the cache* integer.
gha-cache-key: cache0-py${{ matrix.python-version }}

- name: Test
- name: Test pants-plugins
if: ${{ matrix.python-version-short == '3.9' }}
env:
# Github Actions uses the 'runner' user, so use that instead of stanley.
ST2TESTS_SYSTEM_USER: 'runner'
# We do not support running pytest everywhere yet. When we do it will be simply:
# pants test ::
# Until then, we need to manually adjust this command line to test what we can.
run: |
pants test pylint_plugins/:: pants-plugins/::
pants test pants-plugins/::

# We do not support running pytest everywhere yet. When we do it will be simply:
# pants test ::
# Until then, we need to manually adjust this command line to test what we can.
# So far, this includes unit, pack, and pants-plugins tests.
# TODO: run integration tests

- name: Unit Tests
env:
# Github Actions uses the 'runner' user, so use that instead of stanley.
ST2TESTS_SYSTEM_USER: 'runner'
run: >
pants
--python-bootstrap-search-path=[]
--python-bootstrap-search-path=${{ steps.python.outputs.python-path }}
--tag=unit
test '::'
Copy link
Member Author

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.


- name: Pack Tests
env:
# Github Actions uses the 'runner' user, so use that instead of stanley.
ST2TESTS_SYSTEM_USER: 'runner'
run: >
pants
--python-bootstrap-search-path=[]
--python-bootstrap-search-path=${{ steps.python.outputs.python-path }}
--tag=pack
test '::'
Comment on lines +305 to +306
Copy link
Member Author

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.


- name: Upload pants log
uses: actions/upload-artifact@v4
with:
name: pants-log-py${{ matrix.python-version }}
path: .pants.d/pants.log
if: always() # We want the log even on failures.
if: ${{ always() }} # We want the log even on failures.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Added
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
to pants' use of PEX lockfiles. This is not a user-facing addition.
#6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244 #6251 #6253
#6254 #6258 #6259 #6260
#6254 #6258 #6259 #6260 #6269
Contributed by @cognifloyd
* Build of ST2 EL9 packages #6153
Contributed by @amanda11
Expand Down
1 change: 1 addition & 0 deletions pylint_plugins/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ python_sources()

python_tests(
name="tests",
tags=["unit"],
Copy link
Member Author

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.

dependencies=[
"./fixtures",
"!//conftest.py:test_utils",
Expand Down
Loading