-
-
Notifications
You must be signed in to change notification settings - Fork 28
185 lines (158 loc) · 5.55 KB
/
build.yml
File metadata and controls
185 lines (158 loc) · 5.55 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Build
on: [push, pull_request]
env:
FORCE_COLOR: 1
RUFF_OUTPUT_FORMAT: github
COLUMNS: 120
jobs:
test:
runs-on: ${{ matrix.os }}
continue-on-error: true
timeout-minutes: 30
strategy:
matrix:
python_version: ["3.13", "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 }}
python-version: ${{ 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:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
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