Skip to content

Commit

Permalink
Add Python 3.13 test coverage
Browse files Browse the repository at this point in the history
#test-continuous

PiperOrigin-RevId: 690740783
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Oct 28, 2024
1 parent 89533c7 commit 7060d3d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 18 deletions.
14 changes: 8 additions & 6 deletions .github/scripts/validate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@
elif 'with' in step and 'name' in step['with']:
name = step['with']['name']
else:
raise ValueError('Step in job %s does not have a name.' % job)
raise ValueError(
'Step in job %s from file %s does not have a name.' % (job, file)
)
if continuous_condition and 'continuous-run' not in step.get('if', ''):
raise ValueError(
'Step %s in job %s does not check the continuous-run condition'
% (name, job)
'Step %s in job %s from file %s does not check the continuous-run'
' condition' % (name, job, file)
)
if not continuous_condition and 'continuous-run' in step.get('if', ''):
raise ValueError(
'Step %s in job %s checks the continuous-run condition but '
'the job does not contain the continuous-prefix'
% (name, job)
'Step %s in job %s from file %s checks the continuous-run'
' condition but the job does not contain the continuous-prefix'
% (name, job, file)
)
print('PASSED: All steps in all jobs check the continuous-run condition.')
15 changes: 10 additions & 5 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
type: [ Pure, C++]
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
include:
- type: Pure
targets: //python/... //python:python_version_test
Expand All @@ -48,6 +48,10 @@ jobs:
- version: "3.10"
continuous-only: true
- version: "3.11"
continuous-only: true
- version: "3.12"
continuous-only: true
- version: "3.13"

name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.type }} ${{ matrix.version }}
runs-on: ubuntu-latest
Expand All @@ -61,7 +65,7 @@ jobs:
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel-docker@v3
with:
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:6.4.0-{0}-27cf7b86212020d7e552bc13b1e084abb971da75', matrix.version) }}
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:6.4.0-{0}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82', matrix.version) }}
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }}
bazel: test ${{ matrix.targets }} ${{ matrix.flags }} --test_env=KOKORO_PYTHON_VERSION
Expand All @@ -73,14 +77,15 @@ jobs:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
type: [ Pure, C++]
# TODO Consider expanding this set of versions.
version: [ "3.12" ]
version: [ "3.12", "3.13" ]
include:
- type: Pure
targets: //python/... //python:python_version_test
- type: C++
targets: //python/... //python:python_version_test
flags: --define=use_fast_cpp_protos=true
- version: "3.13"
continuous-only: true

name: MacOS ${{ matrix.type }} ${{ matrix.version }}
runs-on: macos-13
Expand All @@ -91,7 +96,7 @@ jobs:
ref: ${{ inputs.safe-checkout }}

- name: Pin Python version
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f #v5.1.1
with:
python-version: ${{ matrix.version }}
cache: pip
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/test_upb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
uses: protocolbuffers/protobuf-ci/checkout@v3
with:
ref: ${{ inputs.safe-checkout }}
- name: "Setup Python"
- name: Setup Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
cache: pip
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
uses: protocolbuffers/protobuf-ci/checkout@v3
with:
ref: ${{ inputs.safe-checkout }}
- name: "Setup Python"
- name: Setup Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: 3.12
Expand Down Expand Up @@ -189,25 +189,29 @@ jobs:
# supported Python versions and assume this gives us sufficient test
# coverage.
- { os: ubuntu-latest, python-version: "3.8", architecture: x64, type: 'binary' }
- { os: macos-13, python-version: "3.8", architecture: x64, type: 'binary' }
- { os: macos-12, python-version: "3.8", architecture: x64, type: 'binary' }
- { os: ubuntu-latest, python-version: "3.12", architecture: x64, type: 'binary' }
- { os: macos-13, python-version: "3.12", architecture: x64, type: 'binary' }
- { os: ubuntu-latest, python-version: "3.8", architecture: x64, type: 'source', continuous-only: true }
- { os: macos-13, python-version: "3.8", architecture: x64, type: 'source', continuous-only: true }
- { os: ubuntu-latest, python-version: "3.12", architecture: x64, type: 'source', continuous-only: true }
- { os: macos-13, python-version: "3.12", architecture: x64, type: 'source', continuous-only: true }
- { os: ubuntu-latest, python-version: "3.13", architecture: x64, type: 'source', continuous-only: true }
- { os: macos-13, python-version: "3.13", architecture: x64, type: 'source', continuous-only: true }

# Windows uses the full API up until Python 3.10.
- { os: windows-2019, python-version: "3.8", architecture: x86, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.9", architecture: x86, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.10", architecture: x86, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.11", architecture: x86, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.12", architecture: x86, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.13", architecture: x86, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.8", architecture: x64, type: 'binary' }
- { os: windows-2019, python-version: "3.9", architecture: x64, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.10", architecture: x64, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.11", architecture: x64, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.12", architecture: x64, type: 'binary' }
- { os: windows-2019, python-version: "3.12", architecture: x64, type: 'binary', continuous-only: true }
- { os: windows-2019, python-version: "3.13", architecture: x64, type: 'binary' }
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Test Wheels Python ${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.architecture }} ${{ matrix.type }}
needs: build_wheels
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -279,7 +283,7 @@ jobs:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
python-version: ["3.8", "3.12"]
python-version: ["3.8", "3.13"]
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request_target' }}
steps:
Expand All @@ -290,7 +294,7 @@ jobs:
path: wheels
- name: Delete Binary Wheels
run: find wheels -type f | grep -v none-any | xargs rm
- name: "Setup Python"
- name: Setup Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: ${{ matrix.python-version }}
Expand Down
2 changes: 2 additions & 0 deletions python/dist/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ py_wheel(
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
distribution = "protobuf",
extra_distinfo_files = {
Expand Down Expand Up @@ -376,6 +377,7 @@ py_wheel(
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
distribution = "protobuf",
extra_distinfo_files = {
Expand Down
1 change: 1 addition & 0 deletions python/dist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def GetVersion():
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
],
namespace_packages=['google'],
packages=find_packages(),
Expand Down
1 change: 1 addition & 0 deletions python/protobuf_distutils/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Topic :: Software Development :: Code Generators',
],
description=(
Expand Down
2 changes: 1 addition & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
numpy<=1.26.1
numpy<=2.1.0
setuptools<=70.3.0

0 comments on commit 7060d3d

Please sign in to comment.