Skip to content

[CI] Run examples in the CI to look for regressions #10

[CI] Run examples in the CI to look for regressions

[CI] Run examples in the CI to look for regressions #10

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: Set MISTRAL_API_KEY
run: |

Check failure on line 40 in .github/workflows/run_example_scripts.yaml

View workflow run for this annotation

GitHub Actions / Running the examples

Invalid workflow file

The workflow is not valid. .github/workflows/run_example_scripts.yaml (Line: 40, Col: 14): Unrecognized named-value: 'VERSION'. Located at position 49 within expression: secrets[format('CI_MISTRAL_API_KEY_PYTHON_{0}', VERSION)]
VERSION=$(echo ${{ matrix.python-version }} | tr -d .)
echo "MISTRAL_API_KEY=${{ secrets[format('CI_MISTRAL_API_KEY_PYTHON_{0}', VERSION)] }}" >> $GITHUB_ENV
- name: Run the example scripts
run: |
failed=0
for file in examples/*.py; do
if [ -f "$file" ] && [ "$file" != "examples/chatbot_with_streaming.py" ]; then
echo "Running $file"
# Do not fail if the script fails, but save it in the failed variable
python3 "$file" > /dev/null || failed=1
fi
done
# If one of the example script failed then exit
if [ $failed -ne 0 ]; then
exit 1
fi
env:
MISTRAL_AGENT_ID: ${{ secrets.CI_AGENT_ID }}
MISTRAL_API_KEY: ${{ env.MISTRAL_API_KEY }}