Fix infinite loop when parsing MagicMock objects #187
This file contains hidden or 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 | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| tags: [v*.*.*] | |
| jobs: | |
| build: | |
| name: Test & Build | |
| strategy: | |
| matrix: | |
| python-version: ['3.7', '3.8', '3.10'] | |
| image-variant: [''] | |
| include: | |
| - python-version: '2.7' | |
| image-variant: '-buster' | |
| runs-on: [ubuntu-latest] | |
| container: | |
| image: "python:${{ matrix.python-version }}${{ matrix.image-variant }}" | |
| env: | |
| PYTHON: ${{ matrix.python-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # fetch all history for setuptools_scm to be able to read tags | |
| - name: Fix Debian Buster repositories (EOL) | |
| if: matrix.image-variant == '-buster' | |
| run: | | |
| # Debian Buster reached EOL, switch to archive.debian.org | |
| # Remove security repo entirely (not available in archive) and use main archive | |
| sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list | |
| sed -i '/security.debian.org/d' /etc/apt/sources.list | |
| sed -i '/buster-updates/d' /etc/apt/sources.list | |
| - name: Install python dependencies | |
| run: | | |
| apt-get update | |
| apt-get -y install sudo | |
| pip install --upgrade pip | |
| sudo chown root . | |
| sudo -H pip install wheel build tox | |
| sudo -H pip install .[dev] | |
| - name: Determine pyenv | |
| id: pyenv | |
| run: echo "value=py$(echo $PYTHON | tr -d '.')" >> $GITHUB_OUTPUT | |
| - name: Run tests | |
| env: | |
| TOXENV: ${{ steps.pyenv.outputs.value }} | |
| run: tox | |
| - name: Build python package | |
| run: python -m build | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v5 | |
| if: matrix.python-version == '3.10' | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| env_vars: PYTHON | |
| fail_ci_if_error: true | |
| files: .coverage.${{ steps.pyenv.outputs.value }}.xml | |
| - uses: actions/upload-artifact@v4 | |
| if: matrix.python-version == '2.7' || matrix.python-version == '3.8' | |
| with: | |
| name: dist-${{ matrix.python-version }} | |
| path: dist | |
| publish: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: [ubuntu-latest] | |
| permissions: | |
| id-token: write | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| - name: Organize files for upload | |
| run: | | |
| mkdir dist | |
| mv dist-3.8/* dist/ | |
| mv dist-2.7/*.whl dist/ | |
| - name: Test Publish package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| if: startsWith(github.event.ref, 'refs/tags/v') |