Skip to content

[CI] Add retries to avoid failing because of flakey network issues (#… #178

[CI] Add retries to avoid failing because of flakey network issues (#…

[CI] Add retries to avoid failing because of flakey network issues (#… #178

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.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
- name: Set VERSION
run: |
VERSION=$(echo ${{ matrix.python-version }} | tr -d .)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set MISTRAL_API_KEY using VERSION
run: |
echo "MISTRAL_API_KEY=${{ secrets[format('CI_MISTRAL_API_KEY_PYTHON_{0}', env.VERSION)] }}" >> $GITHUB_ENV
- name: Build the package
run: |
touch README-PYPI.md # Create this file since the client is not built by Speakeasy
poetry build
- name: For python 3.9, install the client and run examples without extra dependencies.
if: matrix.python-version == '3.9'
run: |
PACKAGE="dist/$(ls dist | grep whl | head -n 1)"
python3 -m pip install "$PACKAGE"
./scripts/run_examples.sh --no-extra-dep
env:
MISTRAL_AGENT_ID: ${{ secrets.CI_AGENT_ID }}
MISTRAL_API_KEY: ${{ env.MISTRAL_API_KEY }}
- name: For python 3.10+, install client with extras and run all examples.
if: matrix.python-version != '3.9'
run: |
PACKAGE="dist/$(ls dist | grep whl | head -n 1)[agents]"
python3 -m pip install "$PACKAGE"
./scripts/run_examples.sh
env:
MISTRAL_AGENT_ID: ${{ secrets.CI_AGENT_ID }}
MISTRAL_API_KEY: ${{ env.MISTRAL_API_KEY }}