Bump pytest from 8.1.1 to 8.3.3 (#636) #1328
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
# Run on git push, PR, or manually from the Actions tab | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
run_test: | |
name: ${{ matrix.py-ver-mypy-protobuf }} | |
runs-on: ubuntu-20.04 | |
# Some CI issues regarding ubuntu-latest | |
# runs-on: ubuntu-latest | |
env: | |
PY_VER_MYPY: 3.8.17 | |
PY_VER_UNIT_TESTS_3: 3.8.17 | |
strategy: | |
matrix: | |
# Running mypy-protobuf itself | |
py-ver-mypy-protobuf: [3.8.17, 3.9.17, 3.10.12, 3.11.4] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read version numbers | |
run: | | |
echo ::set-output name=PROTOBUF_VERSION::$(grep "^protobuf>=" test_requirements.txt | cut -f2 -d=) | |
echo ::set-output name=PYRIGHT_VERSION::$(grep '"pyright"' .github/package.json | cut -d\" -f4) | |
id: read_versions | |
- name: Cache pyenv | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.pyenv | |
!~/.pyenv/versions | |
key: pyenv-installation-2 | |
- name: Cache pyenv mypy-protobuf ver | |
uses: actions/cache@v4 | |
with: | |
path: ~/.pyenv/versions/${{matrix.py-ver-mypy-protobuf}} | |
key: pyenv-${{matrix.py-ver-mypy-protobuf}}-${{hashFiles('setup.py')}} | |
- name: Cache pyenv unit tests 3 ver | |
uses: actions/cache@v4 | |
with: | |
path: ~/.pyenv/versions/${{env.PY_VER_UNIT_TESTS_3}} | |
key: pyenv-${{env.PY_VER_UNIT_TESTS_3}}-${{hashFiles('setup.py')}} | |
- name: Cache pyenv mypy ver | |
uses: actions/cache@v4 | |
with: | |
path: ~/.pyenv/versions/${{env.PY_VER_MYPY}} | |
key: pyenv-${{env.PY_VER_MYPY}}-${{hashFiles('setup.py')}} | |
- name: Install pyenv | |
run: | | |
if [ ! -e ~/.pyenv/bin/pyenv ]; then | |
rm -rf ~/.pyenv | |
curl https://pyenv.run | bash | |
fi | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init -)" | |
eval "$(pyenv init --path)" | |
eval "$(pyenv virtualenv-init -)" | |
for PY in ${{matrix.py-ver-mypy-protobuf}} ${{env.PY_VER_MYPY}} ${{env.PY_VER_UNIT_TESTS_3}}; do | |
if [ ! -e ~/.pyenv/versions/$PY ]; then | |
pyenv install --skip-existing $PY | |
pyenv shell $PY | |
python -m pip install virtualenv | |
fi | |
done | |
- name: Run Tests (./run_test.sh) | |
env: | |
PY_VER_MYPY_PROTOBUF: ${{matrix.py-ver-mypy-protobuf}} | |
VALIDATE: 1 | |
run: | | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init -)" | |
eval "$(pyenv init --path)" | |
eval "$(pyenv virtualenv-init -)" | |
./run_test.sh | |
- name: Run Pyright | |
uses: jakebailey/pyright-action@v2 | |
with: | |
version: "${{ steps.read_versions.outputs.PYRIGHT_VERSION }}" | |
linting: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Run formatters and linters | |
run: | | |
pip3 install black==24.3.0 isort flake8 flake8-pyi flake8-noqa flake8-bugbear | |
black --check --extend-exclude '(_pb2_grpc|_pb2).pyi?$' . | |
isort --check . --diff | |
flake8 . | |
- name: run shellcheck | |
uses: reviewdog/action-shellcheck@v1 | |
with: | |
# By default, shellcheck tries to make sure any external files referenced actually exist | |
shellcheck_flags: -e SC1091 | |
sanity_check_windows: | |
name: Sanity Check Windows Executable | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Read versions | |
run: echo ::set-output name=PROTOBUF_VERSION::$(grep "^protobuf>=" test_requirements.txt | cut -f2 -d=) | |
id: read_versions | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
version: "${{ steps.read_versions.outputs.PROTOBUF_VERSION }}" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run Protoc | |
run: | | |
pip3 install -e . | |
mkdir wintestout | |
protoc --python_out=wintestout --mypy_out=wintestout proto\mypy_protobuf\extensions.proto |