Protocol Buffers - Google's data interchange format (grpc依赖) https://developers.google.com/protocol-buffers/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.5 KiB

name: Python Tests
on:
workflow_call:
inputs:
safe-checkout:
required: true
description: "The SHA key for the commit we want to run over"
type: string
permissions:
contents: read
jobs:
linux:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
type: [ Pure, C++]
version: [ "3.7", "3.8", "3.9", "3.10" ]
include:
- type: Pure
targets: //python/... //upb/python/... //python:python_version_test
flags: --define=use_fast_cpp_protos=false
- type: C++
targets: //python/... //python:python_version_test
flags: --define=use_fast_cpp_protos=true
- type: C++
version: aarch64
targets: //python/... //python:aarch64_test
# TODO Enable this once conformance tests are fixed.
flags: --define=use_fast_cpp_protos=true --test_tag_filters=-conformance
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-63dd26c0c7a808d92673a3e52e848189d4ab0f17
name: Linux ${{ matrix.type }} ${{ matrix.version }}
runs-on: ubuntu-latest
steps:
- name: Checkout pending changes
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ inputs.safe-checkout }}
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
with:
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:{0}-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea', 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
macos:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
type: [ Pure, C++]
# TODO Consider expanding this set of versions.
version: [ "3.10" ]
include:
- type: Pure
targets: //python/... //upb/python/... //python:python_version_test
- type: C++
targets: //python/... //python:python_version_test
flags: --define=use_fast_cpp_protos=true
name: MacOS ${{ matrix.type }} ${{ matrix.version }}
runs-on: macos-12
steps:
- name: Checkout pending changes
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ inputs.safe-checkout }}
- name: Pin Python version
Bump actions/setup-python from 4.5.0 to 4.7.0 (#13766) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.5.0 to 4.7.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/setup-python/releases">actions/setup-python's releases</a>.</em></p> <blockquote> <h2>v4.7.0</h2> <p>In scope of this release, the support for reading python version from pyproject.toml was added (<a href="https://redirect.github.com/actions/setup-python/pull/669">actions/setup-python#669</a>).</p> <pre lang="yaml"><code> - name: Setup Python uses: actions/setup-python@v4 with: python-version-file: pyproject.toml </code></pre> <h3>Besides, it includes such changes as:</h3> <ul> <li>Bump tough-cookie and <code>@​azure/ms-rest-js</code> by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/697">actions/setup-python#697</a></li> <li>Bump semver from 7.3.8 to 7.5.2 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/692">actions/setup-python#692</a></li> <li>Fix typos found by codespell by <a href="https://github.com/DimitriPapadopoulos"><code>@​DimitriPapadopoulos</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/650">actions/setup-python#650</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/dariocurr"><code>@​dariocurr</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/669">actions/setup-python#669</a></li> <li><a href="https://github.com/DimitriPapadopoulos"><code>@​DimitriPapadopoulos</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/650">actions/setup-python#650</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/setup-python/compare/v4...v4.7.0">https://github.com/actions/setup-python/compare/v4...v4.7.0</a></p> <h2>v4.6.1</h2> <h2>What's Changed</h2> <ul> <li>Fix <code>allow-prereleases</code> sample configuration by <a href="https://github.com/mayeut"><code>@​mayeut</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/615">actions/setup-python#615</a></li> <li>Fix a incorrect link advanced-usage.md by <a href="https://github.com/siyuan0322"><code>@​siyuan0322</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/657">actions/setup-python#657</a></li> <li>Remove implicit dependency by <a href="https://github.com/nikolai-laevskii"><code>@​nikolai-laevskii</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/668">actions/setup-python#668</a></li> <li>Automatic update of configuration files from 05/23/2023 by <a href="https://github.com/github-actions"><code>@​github-actions</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/671">actions/setup-python#671</a></li> <li>Add warning for python 2.7 on release/v4 by <a href="https://github.com/dmitry-shibanov"><code>@​dmitry-shibanov</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/673">actions/setup-python#673</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/siyuan0322"><code>@​siyuan0322</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/657">actions/setup-python#657</a></li> <li><a href="https://github.com/nikolai-laevskii"><code>@​nikolai-laevskii</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/668">actions/setup-python#668</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/setup-python/compare/v4...v4.6.1">https://github.com/actions/setup-python/compare/v4...v4.6.1</a></p> <h2>Add allow-prereleases input</h2> <p>In scope of this release we added a new input (<code>allow-prereleases</code>) to allow <a href="https://redirect.github.com/actions/setup-python/pull/414">falling back to pre-release versions of Python when a matching GA version of Python is not available</a></p> <pre lang="yaml"><code>steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: 3.12 allow-prereleases: true </code></pre> <p>Besides, we added such changes as:</p> <ul> <li>Fix bug to trim new line for PyPy version: <a href="https://redirect.github.com/actions/setup-python/pull/610">actions/setup-python#610</a></li> <li>Added pip dependency file to generate hash from it: <a href="https://redirect.github.com/actions/setup-python/pull/604">actions/setup-python#604</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/actions/setup-python/commit/61a6322f88396a6271a6ee3565807d608ecaddd1"><code>61a6322</code></a> Fix typos found by codespell (<a href="https://redirect.github.com/actions/setup-python/issues/650">#650</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/ea5b57fccc93aea0d77e6225efa19adaec3fce0d"><code>ea5b57f</code></a> Bump semver from 7.3.8 to 7.5.2 (<a href="https://redirect.github.com/actions/setup-python/issues/692">#692</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/014d32a83013b439dd2a147051d855831576a3ef"><code>014d32a</code></a> Bump tough-cookie and <code>@​azure/ms-rest-js</code> (<a href="https://redirect.github.com/actions/setup-python/issues/697">#697</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/c16c4b8d1828103eda022b2cade091238fe08311"><code>c16c4b8</code></a> Fix pipenv jobs (<a href="https://redirect.github.com/actions/setup-python/issues/699">#699</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/0d5da6a89a3aa5b4dbd48e38b0c9d678b0caa0e5"><code>0d5da6a</code></a> Read python version from pyproject.toml (fix <a href="https://redirect.github.com/actions/setup-python/issues/542">#542</a>) (<a href="https://redirect.github.com/actions/setup-python/issues/669">#669</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/3f824b7ca6388f5e27e362d31352e6456c8e3bfb"><code>3f824b7</code></a> remove python 2.7 from the tests (<a href="https://redirect.github.com/actions/setup-python/issues/687">#687</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/bd6b4b6205c4dbad673328db7b31b7fab9e241c0"><code>bd6b4b6</code></a> Add warning for python 2.7 (<a href="https://redirect.github.com/actions/setup-python/issues/673">#673</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/0cbcb9a3d7c0b228a2c4fbde82b6e8855233cd92"><code>0cbcb9a</code></a> Merge pull request <a href="https://redirect.github.com/actions/setup-python/issues/668">#668</a> from akv-platform/disallow-implicit-dependencies</li> <li><a href="https://github.com/actions/setup-python/commit/669664dac1a46a4bb872089e1a90e4ad5dc232a6"><code>669664d</code></a> Merge branch 'tool-config-auto-update' into disallow-implicit-dependencies</li> <li><a href="https://github.com/actions/setup-python/commit/9cbf792a3cbbd9c37749da21d3b171b927451bb0"><code>9cbf792</code></a> Update configuration files</li> <li>Additional commits viewable in <a href="https://github.com/actions/setup-python/compare/d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435...61a6322f88396a6271a6ee3565807d608ecaddd1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/setup-python&package-manager=github_actions&previous-version=4.5.0&new-version=4.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Closes #13766 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13766 from protocolbuffers:dependabot/github_actions/actions/setup-python-4.7.0 5e427982474c6dfb5304e50662f45d585acad73d PiperOrigin-RevId: 561416587
1 year ago
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: ${{ matrix.version }}
cache: pip
- name: Validate version
run: python3 --version | grep ${{ matrix.version }} || (echo "Invalid Python version - $(python3 --version)" && exit 1)
- name: Create and start virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel@v2
env:
KOKORO_PYTHON_VERSION: ${{ matrix.version }}
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: python_macos/${{ matrix.type }}_${{ matrix.version }}
bazel: >-
test ${{ matrix.targets }} ${{ matrix.flags }}
--test_env=KOKORO_PYTHON_VERSION=${{ matrix.version }}
--macos_minimum_os=10.9