Diff match path #119
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: Release Build and Deploy | |
| on: | |
| release: | |
| types: [published, created, edited] | |
| push: | |
| branches: [ "main" ] | |
| tags: [ "*" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| inputs: | |
| run_security: | |
| description: 'Run security check' | |
| type: boolean | |
| default: false | |
| run_deploy: | |
| description: 'Run deploy step' | |
| type: boolean | |
| default: false | |
| required: true | |
| jobs: | |
| build_and_test: | |
| name: Build and Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Upgrade pip and install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install flake8 pytest pytest-asyncio setuptools wheel | |
| - name: Build package | |
| run: | | |
| python setup.py bdist_wheel sdist | |
| python -m pip install -e . | |
| - name: Lint with flake8 | |
| run: | | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Test with pytest | |
| run: pytest tests --ignore=tests/agents --ignore=tests/mcp/tools | |
| - name: Install package with agents requirements | |
| run: | | |
| python -m pip install .[agents] | |
| - name: Test agents with pytest | |
| run: pytest tests/agents tests/mcp/tools | |
| security: | |
| name: Security Check | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') || inputs.run_security | |
| steps: | |
| - uses: actions/checkout@main | |
| - name: Run Safety CLI to check for vulnerabilities | |
| uses: pyupio/safety-action@v1 | |
| with: | |
| api-key: ${{ secrets.SAFETY_API_KEY }} | |
| deploy: | |
| name: Deploy Package to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [build_and_test, security] | |
| if: (github.event_name == 'release' && github.event.action == 'published' && needs.build_and_test.result == 'success' && needs.security.result == 'success') || inputs.run_deploy | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '3.x' | |
| # - name: Verify PYPI_API_TOKEN is set | |
| # run: | | |
| # if [ -z "${{ secrets.PYPI_API_TOKEN }}" ]; then | |
| # echo "PYPI_API_TOKEN is not set"; | |
| # exit 1; | |
| # fi | |
| - name: Upgrade pip and install build | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel | |
| - name: Build package for deployment | |
| run: python setup.py bdist_wheel sdist | |
| - name: Publish distribution 📦 to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # password: ${{ secrets.PYPI_API_TOKEN }} |