[CI] Run examples in the CI to look for regressions #6
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: Running the examples | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| run_examples: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
| with: | |
| version: ${{ matrix.python-version == '3.8' && '1.8.5' || '2.1.1' }} | |
| - name: Build and install client | |
| run: | | |
| touch README-PYPI.md # Create this file since the client is not built from Speakeasy | |
| poetry build | |
| python3 -m pip install dist/mistralai-*.whl | |
| - name: Run the example scripts | |
| run: | | |
| for file in examples/*.py; do | |
| if [ -f "$file" ] && [ "$file" != "examples/chatbot_with_streaming.py" ]; then | |
| echo "Running $file" | |
| python3 "$file" > /dev/null | |
| fi | |
| done | |
| # Run all the example scripts even if one fails | |
| continue-on-error: true | |
| env: | |
| MISTRAL_AGENT_ID: ${{ secrets.CI_AGENT_ID }} | |
| MISTRAL_API_KEY: ${{ secrets.CI_MISTRAL_API_KEY }} |