Repository navigation
142 lines (138 loc) · 5.26 KB
/
Copy pathpython-tests.yml
File metadata and controls
142 lines (138 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Python - Tests
on:
pull_request:
branches: ["main", "feature*"]
paths:
- "python/**"
- ".github/workflows/python-tests.yml"
- "!python/AGENTS.md"
- "!python/**/AGENTS.md"
- "!python/.github/skills/*"
- "!python/.github/skills/**"
env:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
jobs:
python-tests:
name: Python Tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
# todo: add macos-latest when problems are resolved
os: [ubuntu-latest, windows-latest]
# Full workspace setup still builds native packages slowly on Windows 3.15.
# The dedicated meta-package job below covers Windows installability on 3.14 and 3.15.
exclude:
- python-version: "3.15"
os: windows-latest
env:
UV_PYTHON: ${{ matrix.python-version }}
permissions:
contents: write
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up python and install the project
id: python-setup
uses: ./.github/actions/python-setup
with:
python-version: ${{ matrix.python-version }}
os: ${{ runner.os }}
# DuckDB has no Python 3.15 wheels yet, and RedisVL declares Python <3.15.
exclude-packages: ${{ matrix.python-version == '3.10' && 'agent-framework-github-copilot agent-framework-azure-cosmos-memory' || matrix.python-version == '3.15' && 'agent-framework-duckdb agent-framework-redis' || '' }}
env:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
# Unit tests
- name: Run all tests
run: uv run poe test -A --junitxml=pytest.xml
working-directory: ./python
# Surface failing tests
- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@fdc7f18d9934e38aca411ca9557e6577bd25ca9c # v0.9.0
with:
path: ./python/pytest.xml
summary: true
display-options: fEX
fail-on-empty: false
title: Test results
python-meta-package-install:
name: Python Meta Install (${{ matrix.python-version }}, Windows)
runs-on: windows-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.14", "3.15"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
version-file: "python/pyproject.toml"
enable-cache: true
cache-suffix: windows-meta-${{ matrix.python-version }}
- name: Create the Python environment
shell: pwsh
run: |
uv venv --python "${{ matrix.python-version }}" --seed .meta-venv
& ".meta-venv\Scripts\python.exe" --version
- name: Build release wheelhouse
shell: bash
run: |
set -euo pipefail
mkdir -p wheelhouse
uv build \
--directory python \
--all-packages \
--wheel \
--no-build-logs \
--no-create-gitignore \
--out-dir "${{ github.workspace }}/wheelhouse"
uv build \
--directory python \
--wheel \
--no-build-logs \
--no-create-gitignore \
--out-dir "${{ github.workspace }}/wheelhouse"
- name: Resolve the end-user install
timeout-minutes: 6
shell: pwsh
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
run: |
$python = ".meta-venv\Scripts\python.exe"
& $python -m pip install --upgrade pip
$version = & $python -c "import tomllib; print(tomllib.load(open('python/pyproject.toml', 'rb'))['project']['version'])"
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
& $python -m pip install `
--dry-run `
--ignore-installed `
--find-links wheelhouse `
--report "pip-resolution-${{ matrix.python-version }}.json" `
"agent-framework==$version" `
azure-identity
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$stopwatch.Stop()
$seconds = [math]::Round($stopwatch.Elapsed.TotalSeconds, 2)
"Pip resolution completed in $seconds seconds." | Tee-Object -FilePath $env:GITHUB_STEP_SUMMARY -Append
if ($stopwatch.Elapsed.TotalSeconds -gt 180) {
throw "Pip dependency resolution exceeded the 180-second budget."
}
- name: Install and import the meta package
timeout-minutes: 10
shell: pwsh
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
run: |
$python = ".meta-venv\Scripts\python.exe"
$version = & $python -c "import tomllib; print(tomllib.load(open('python/pyproject.toml', 'rb'))['project']['version'])"
& $python -m pip install --find-links wheelhouse "agent-framework==$version" azure-identity
& $python -c "import agent_framework; import azure.identity"