Skip to content

Commit e94b893

Browse files
author
Aidan Jensen
committed
test on more python versions
Signed-off-by: Aidan Jensen <[email protected]>
1 parent afdf55f commit e94b893

File tree

6 files changed

+408
-9
lines changed

6 files changed

+408
-9
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ on:
99

1010
jobs:
1111
run_test:
12-
name: ${{ matrix.py-ver-mypy-protobuf }}
13-
runs-on: ubuntu-20.04
12+
name: mypy - ${{ matrix.py-ver-mypy-protobuf }} - unittest - ${{ matrix.py-ver-unit-tests }}
13+
runs-on: ubuntu-24.04
1414
# Some CI issues regarding ubuntu-latest
1515
# runs-on: ubuntu-latest
1616
env:
1717
PY_VER_MYPY: 3.8.17
18-
PY_VER_UNIT_TESTS_3: 3.8.17
1918
strategy:
2019
matrix:
2120
# Running mypy-protobuf itself
22-
py-ver-mypy-protobuf: [3.8.17, 3.9.17, 3.10.12, 3.11.4]
21+
py-ver-mypy-protobuf: [3.8.17, 3.9.17, 3.10.12, 3.11.4, 3.12.12, 3.13.9, 3.14.0]
22+
py-ver-unit-tests: [3.8.17, 3.13.9, 3.14.0]
23+
2324
steps:
2425
- uses: actions/checkout@v4
2526
- name: Read version numbers
@@ -42,8 +43,8 @@ jobs:
4243
- name: Cache pyenv unit tests 3 ver
4344
uses: actions/cache@v4
4445
with:
45-
path: ~/.pyenv/versions/${{env.PY_VER_UNIT_TESTS_3}}
46-
key: pyenv-${{env.PY_VER_UNIT_TESTS_3}}-${{hashFiles('setup.py')}}
46+
path: ~/.pyenv/versions/${{matrix.py-ver-unit-tests}}
47+
key: pyenv-${{matrix.py-ver-unit-tests}}-${{hashFiles('setup.py')}}
4748
- name: Cache pyenv mypy ver
4849
uses: actions/cache@v4
4950
with:
@@ -61,7 +62,7 @@ jobs:
6162
eval "$(pyenv init --path)"
6263
eval "$(pyenv virtualenv-init -)"
6364
64-
for PY in ${{matrix.py-ver-mypy-protobuf}} ${{env.PY_VER_MYPY}} ${{env.PY_VER_UNIT_TESTS_3}}; do
65+
for PY in ${{matrix.py-ver-mypy-protobuf}} ${{env.PY_VER_MYPY}} ${{matrix.py-ver-unit-tests}}; do
6566
if [ ! -e ~/.pyenv/versions/$PY ]; then
6667
pyenv install --skip-existing $PY
6768
pyenv shell $PY
@@ -71,6 +72,7 @@ jobs:
7172
- name: Run Tests (./run_test.sh)
7273
env:
7374
PY_VER_MYPY_PROTOBUF: ${{matrix.py-ver-mypy-protobuf}}
75+
PY_VER_UNIT_TESTS: ${{matrix.py-ver-unit-tests}}
7476
VALIDATE: 1
7577
run: |
7678
export PATH="$HOME/.pyenv/bin:$PATH"

run_test.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ for PY_VER in $PY_VER_UNIT_TESTS; do
156156
mypy --custom-typeshed-dir="$CUSTOM_TYPESHED_DIR" --python-executable="$UNIT_TESTS_VENV"/bin/python --python-version="$PY_VER_MYPY_TARGET" "${MODULES[@]}"
157157

158158
# Run stubtest. Stubtest does not work with python impl - only cpp impl
159+
pip install -r test_requirements.txt
159160
API_IMPL="$(python3 -c "import google.protobuf.internal.api_implementation as a ; print(a.Type())")"
160161
if [[ $API_IMPL != "python" ]]; then
161162
PYTHONPATH=test/generated python3 -m mypy.stubtest --custom-typeshed-dir="$CUSTOM_TYPESHED_DIR" --allowlist stubtest_allowlist.txt testproto
@@ -180,8 +181,8 @@ for PY_VER in $PY_VER_UNIT_TESTS; do
180181

181182
# Copy over all the mypy results for the developer.
182183
call_mypy "$PY_VER" "${NEGATIVE_MODULES[@]}"
183-
cp "$MYPY_OUTPUT/mypy_output" test_negative/output.expected.3.8
184-
cp "$MYPY_OUTPUT/mypy_output.omit_linenos" test_negative/output.expected.3.8.omit_linenos
184+
cp "$MYPY_OUTPUT/mypy_output" "test_negative/output.expected.$PY_VER_MYPY_TARGET"
185+
cp "$MYPY_OUTPUT/mypy_output.omit_linenos" "test_negative/output.expected.$PY_VER_MYPY_TARGET.omit_linenos"
185186
exit 1
186187
fi
187188
)

0 commit comments

Comments
 (0)