chore: docs #1557
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: Build | |
| on: [push, pull_request] | |
| env: | |
| FORCE_COLOR: 1 | |
| RUFF_OUTPUT_FORMAT: github | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.python_version != '3.13' }} | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| python_version: ["3.13", "3.13t", "3.14", "3.14t"] | |
| os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python_version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: pyproject.toml | |
| cache-suffix: py${{ matrix.python_version }} | |
| - name: Set PYTHON_GIL | |
| if: endsWith(matrix.python_version, 't') | |
| run: | | |
| echo "PYTHON_GIL=0" >> "$GITHUB_ENV" | |
| - name: Install dependencies (uv sync) | |
| run: uv sync --all-extras --no-group lint | |
| - name: Check for code issues (ruff check) | |
| uses: astral-sh/ruff-action@v3 | |
| - name: Check code format (ruff format) | |
| uses: astral-sh/ruff-action@v3 | |
| with: | |
| args: "format --check" | |
| - name: Static type checking (MyPy) | |
| run: uv run --no-group docs mypy src/ | |
| - name: Run tests | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: uv run --no-group docs pytest --cov-report=xml --cov=src/agentpool/ --cov-report=term-missing | |
| - name: Upload test results to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: false | |
| verbose: true | |
| release: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| needs: test | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| # this permission is mandatory for trusted publishing | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: pyproject.toml | |
| cache-suffix: py${{ matrix.python_version }} | |
| - name: Build package | |
| run: uv build | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Release package on GitHub | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| body: ${{ github.event.head_commit.message }} | |
| artifacts: dist/*.whl,dist/*.tar.gz | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| build-binaries: | |
| name: Build binary ${{ matrix.os }}-${{ matrix.arch }} | |
| runs-on: ${{ matrix.runner }} | |
| needs: test | |
| if: startsWith(github.ref, 'refs/tags/') | |
| strategy: | |
| matrix: | |
| include: | |
| - runner: ubuntu-22.04 | |
| os: linux | |
| arch: x86_64 | |
| - runner: macos-15-intel | |
| os: darwin | |
| arch: x86_64 | |
| - runner: macos-14 | |
| os: darwin | |
| arch: aarch64 | |
| - runner: windows-2022 | |
| os: windows | |
| arch: x86_64 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install uv with caching | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Sync dependencies | |
| run: uv sync --all-extras | |
| - name: Build with PyInstaller | |
| run: uv run pyinstaller agentpool.spec | |
| - name: Get package version (Unix) | |
| id: get_version_unix | |
| if: ${{ matrix.os != 'windows' }} | |
| run: | | |
| VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Get package version (Windows) | |
| id: get_version_windows | |
| if: ${{ matrix.os == 'windows' }} | |
| shell: pwsh | |
| run: | | |
| $VERSION = uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])" | |
| echo "version=$VERSION" >> $env:GITHUB_OUTPUT | |
| - name: Zip binary (Unix) | |
| if: ${{ matrix.os != 'windows' }} | |
| run: | | |
| cd dist | |
| zip agentpool-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.get_version_unix.outputs.version }}.zip agentpool | |
| - name: Zip binary (Windows) | |
| if: ${{ matrix.os == 'windows' }} | |
| shell: pwsh | |
| run: | | |
| cd dist | |
| Compress-Archive -Path agentpool.exe -DestinationPath agentpool-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.get_version_windows.outputs.version }}.zip | |
| - name: Upload binary to release (Unix) | |
| if: ${{ matrix.os != 'windows' }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/agentpool-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.get_version_unix.outputs.version }}.zip | |
| - name: Upload binary to release (Windows) | |
| if: ${{ matrix.os == 'windows' }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/agentpool-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.get_version_windows.outputs.version }}.zip |