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

upgrade GitHub Actions image used for most CI jobs and remove Python 2.7 CI testing #21396

Merged
merged 13 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
needs:
- release_info
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
needs:
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -373,7 +373,7 @@ jobs:
needs:
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3
Expand Down Expand Up @@ -563,7 +563,7 @@ jobs:
if: github.repository_owner == 'pantsbuild'
name: Ensure PR has a category label
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -581,7 +581,7 @@ jobs:
needs:
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -608,7 +608,7 @@ jobs:
release: ${{ steps.classify.outputs.release }}
rust: ${{ steps.classify.outputs.rust }}
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -630,7 +630,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -684,7 +684,7 @@ jobs:
needs:
- set_merge_ok
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- run: "merge_ok=\"${{ needs.set_merge_ok.outputs.merge_ok }}\"\nif [[ \"${merge_ok}\" == \"true\" ]]; then\n echo\
\ \"Merge OK\"\n exit 0\nelse\n echo \"Merge NOT OK\"\n exit 1\nfi\n"
Expand Down Expand Up @@ -721,7 +721,7 @@ jobs:
outputs:
merge_ok: ${{ steps.set_merge_ok.outputs.merge_ok }}
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- id: set_merge_ok
run: echo 'merge_ok=true' >> ${GITHUB_OUTPUT}
Expand Down Expand Up @@ -790,7 +790,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -882,7 +882,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -974,7 +974,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -1066,7 +1066,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -1158,7 +1158,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -1250,7 +1250,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -1342,7 +1342,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -1434,7 +1434,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -1526,7 +1526,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -1618,7 +1618,7 @@ jobs:
- bootstrap_pants_linux_x86_64
- classify_changes
runs-on:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
7 changes: 6 additions & 1 deletion docs/notes/2.24.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ We offer [formal sponsorship tiers for companies](https://www.pantsbuild.org/spo

### Deprecations

- **Python 2.7**: As announced in the v2.23.x release series, Pants v2.24 and later are not proactively tested in CI with Python 2.7 since [Python 2.7 is no longer supported by its maintainers as of 1 January 2020](https://www.python.org/doc/sunset-python-2/). While Pants may continue to work with Python 2.7 in the near term, Pants no longer officially supports use of Python 2.7, and, consequently, any remaining support for Python 2.7 may "bit rot" and diverge over time. Contributions to fix issues with Python 2.7 support will continue to be accepted, but will depend on any community contributions and will not consitute continued official support for Python 2.7.
tdyas marked this conversation as resolved.
Show resolved Hide resolved


### General
Expand All @@ -26,7 +27,11 @@ We offer [formal sponsorship tiers for companies](https://www.pantsbuild.org/spo

#### Python

The default lockfiles bundled with Pants for various tools (ex: to run `black`) no longer support Python 3.7. The minimum Python version is now 3.8. Pants still supports running Python 3.7 (and earlier!) user code, but you will need to [generate your own lockfiles](https://www.pantsbuild.org/stable/docs/python/overview/lockfiles#lockfiles-for-tools). See the announcement at <https://www.pantsbuild.org/blog/2024/08/24/venerable-pythons> for further context.
Deprecations:

- Pants v2.24 and later are not proactively tested in CI with Python 2.7 since [Python 2.7 is no longer supported by its maintainers as of 1 January 2020](https://www.python.org/doc/sunset-python-2/). While Pants may continue to work with Python 2.7 in the near term, Pants no longer officially supports use of Python 2.7, and, consequently, any remaining support for Python 2.7 may "bit rot" and diverge over time. Contributions to fix issues with Python 2.7 support will continue to be accepted, but will depend on any community contributions and will not constitute continued official support for Python 2.7.

- The default lockfiles bundled with Pants for various tools (ex: to run `black`) no longer support Python 3.7. The minimum Python version is now 3.8. Pants still supports running Python 3.7 (and earlier!) user code, but you will need to [generate your own lockfiles](https://www.pantsbuild.org/stable/docs/python/overview/lockfiles#lockfiles-for-tools). See the announcement at <https://www.pantsbuild.org/blog/2024/08/24/venerable-pythons> for further context.

As a consequence of the lockfile generation, newer versions of many tools are now included in the default lockfiles.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from pants.core.util_rules import stripped_source_files
from pants.engine.addresses import Address
from pants.testutil.python_interpreter_selection import (
skip_unless_python27_present,
skip_unless_python38_present,
skip_unless_python39_present,
)
Expand Down Expand Up @@ -439,52 +438,6 @@ def test_handle_unicode(rule_runner: RuleRunner) -> None:
assert_deps_parsed(rule_runner, "x = 'äbç'", expected_imports={})


@skip_unless_python27_present
def test_works_with_python2(rule_runner: RuleRunner) -> None:
content = dedent(
"""\
# -*- coding: utf-8 -*-
print "Python 2 lives on."

import demo
from project.demo import Demo

__import__(u"pkg_resources")
__import__(b"treat.as.a.regular.import.not.a.string.import")
__import__(u"{}".format("interpolation"))

importlib.import_module(b"dep.from.bytes")
importlib.import_module(u"dep.from.str")
importlib.import_module(u"dep.from.str_狗")

b"\\xa0 a non-utf8 string, make sure we ignore it"

try: import weak1
except ImportError: import strong1
else: import strong2
finally: import strong3
"""
)
assert_deps_parsed(
rule_runner,
content,
constraints="==2.7.*",
expected_imports={
"demo": ImpInfo(lineno=4, weak=False),
"project.demo.Demo": ImpInfo(lineno=5, weak=False),
"pkg_resources": ImpInfo(lineno=7, weak=False),
"treat.as.a.regular.import.not.a.string.import": ImpInfo(lineno=8, weak=False),
"dep.from.bytes": ImpInfo(lineno=11, weak=True),
"dep.from.str": ImpInfo(lineno=12, weak=True),
"dep.from.str_狗": ImpInfo(lineno=13, weak=True),
"weak1": ImpInfo(lineno=17, weak=True),
"strong1": ImpInfo(lineno=18, weak=False),
"strong2": ImpInfo(lineno=19, weak=False),
"strong3": ImpInfo(lineno=20, weak=False),
},
)


@skip_unless_python38_present
def test_works_with_python38(rule_runner: RuleRunner) -> None:
content = dedent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from pants.engine.rules import QueryRule
from pants.engine.target import InferredDependencies
from pants.testutil.python_interpreter_selection import (
skip_unless_python27_present,
skip_unless_python38_present,
skip_unless_python39_present,
)
Expand Down Expand Up @@ -170,12 +169,6 @@ def do_test_implicit_app_dependencies(rule_runner: RuleRunner, constraints: str)
}


@skip_unless_python27_present
def test_works_with_python2(rule_runner: RuleRunner) -> None:
do_test_migration_dependencies(rule_runner, constraints="CPython==2.7.*")
do_test_implicit_app_dependencies(rule_runner, constraints="CPython==2.7.*")


@skip_unless_python38_present
def test_works_with_python38(rule_runner: RuleRunner) -> None:
do_test_migration_dependencies(rule_runner, constraints="CPython==3.8.*")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
from pants.core.util_rules import stripped_source_files
from pants.engine.environment import EnvironmentName
from pants.testutil.python_interpreter_selection import (
PY_27,
PY_38,
PY_39,
skip_unless_all_pythons_present,
skip_unless_python27_present,
skip_unless_python37_present,
skip_unless_python38_present,
skip_unless_python39_present,
Expand Down Expand Up @@ -52,10 +51,6 @@ def assert_apps_detected(
py3_only = "async def i_will_parse_on_python3_not_on_python2():\n pass"
else:
py3_only = ""
if "2.7" in constraints2:
py2_only = "print 'I will parse on Python 2.7, not on Python 3'"
else:
py2_only = ""
rule_runner.write_files(
{
"path/to/app1/BUILD": softwrap(
Expand Down Expand Up @@ -84,9 +79,7 @@ class App1AppConfig(AppConfig):
"""
),
"another/path/app2/apps.py": softwrap(
f"""\
{py2_only}

"""\
class App2AppConfig(AppConfig):
name = "another.path.app2"
label = "app2_label"
Expand Down Expand Up @@ -124,11 +117,6 @@ class App3AppConfig(AppConfig):
)


@skip_unless_python27_present
def test_works_with_python2(rule_runner: RuleRunner) -> None:
assert_apps_detected(rule_runner, constraints1="CPython==2.7.*")


@skip_unless_python37_present
def test_works_with_python37(rule_runner: RuleRunner) -> None:
assert_apps_detected(rule_runner, constraints1="CPython==3.7.*")
Expand All @@ -144,6 +132,6 @@ def test_works_with_python39(rule_runner: RuleRunner) -> None:
assert_apps_detected(rule_runner, constraints1="CPython==3.9.*")


@skip_unless_all_pythons_present(PY_27, PY_39)
tdyas marked this conversation as resolved.
Show resolved Hide resolved
@skip_unless_all_pythons_present(PY_38, PY_39)
def test_partitioning_by_ics(rule_runner: RuleRunner) -> None:
assert_apps_detected(rule_runner, constraints1="CPython==3.9.*", constraints2="CPython==2.7.*")
assert_apps_detected(rule_runner, constraints1="CPython==3.8.*", constraints2="CPython==3.9.*")
Loading
Loading