Repository navigation
146 lines (129 loc) · 5.21 KB
/
Copy pathci.yml
File metadata and controls
146 lines (129 loc) · 5.21 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
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
inputs:
run_live_smoke:
description: "Run the live smoke suite against api.agentchat.me"
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# 3 OSes × 3 Python versions because PyPI metadata claims "OS Independent"
# and the realtime client uses asyncio (ProactorEventLoop on Windows vs
# SelectorEventLoop on Linux/macOS). Cross-OS coverage catches event-loop
# quirks before users do. Lint + type-check run on Linux only — they're
# deterministic across OSes; running 3× would burn CI minutes for zero
# signal.
check:
strategy:
fail-fast: false
matrix:
# ubuntu-24.04, not ubuntu-latest: ubuntu-latest moved to 26.04 in
# November 2026, where actions/setup-python has no 3.9 build.
os: [ubuntu-24.04, macos-latest, windows-latest]
python-version: ["3.9", "3.11", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml
- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Ruff
if: ${{ matrix.os == 'ubuntu-24.04' }}
run: python -m ruff check src tests
- name: Mypy
if: ${{ matrix.os == 'ubuntu-24.04' }}
run: python -m mypy
- name: Pytest
run: python -m pytest -q
# The conformance fixtures are the published contract's, byte for
# byte: the checked-in manifest must equal the one agentchat.me
# serves. A separate step on purpose: the test suite runs under a
# network guard. weekly.yml runs the same check between pushes.
- name: Conformance fixtures match the published contract
if: ${{ matrix.os == 'ubuntu-24.04' && matrix.python-version == '3.13' }}
run: bash scripts/check-contract-fixtures.sh
# Live smoke runs only on manual dispatch with run_live_smoke=true.
# `AGENTCHAT_LIVE_API_KEY` must be set on the repo (Settings → Secrets).
# Forks cannot read it. 3.12 only — one live hit per dispatch is plenty
# to catch wire drift; matrix runs would just N-up the same network call.
live-smoke:
if: ${{ github.event_name == 'workflow_dispatch' && inputs.run_live_smoke }}
runs-on: ubuntu-24.04
needs: check
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Live smoke against api.agentchat.me
env:
AGENTCHAT_LIVE_API_KEY: ${{ secrets.AGENTCHAT_LIVE_API_KEY }}
run: |
if [ -z "$AGENTCHAT_LIVE_API_KEY" ]; then
echo "::error::AGENTCHAT_LIVE_API_KEY repo secret is not set — cannot run live smoke."
exit 1
fi
python -m pytest -q tests/test_smoke_live.py
# Secret scan of the new commits only: the pull request's range, or the
# push's. The default gitleaks rules plus the AgentChat API key rule
# (.gitleaks.toml).
secret-scan:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0
# Checksum-pinned, cached: a download happens only on a cache miss
# (.github/actions/install-pinned-binary).
- uses: ./.github/actions/install-pinned-binary
with:
name: gitleaks
version: 8.30.1
url: https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
sha256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
binary: gitleaks
- name: Select commits to scan
id: commits
env:
EVENT_NAME: ${{ github.event_name }}
BEFORE_SHA: ${{ github.event.before }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
run: |
if [[ "$EVENT_NAME" == "pull_request" ]]; then
echo "range=${BASE_SHA}..${HEAD_SHA}" >> "$GITHUB_OUTPUT"
# A new branch (all-zero before) or a manual dispatch (no before):
# the head commit.
elif [[ "$BEFORE_SHA" =~ ^0*$ ]]; then
echo "range=${HEAD_SHA}^..${HEAD_SHA}" >> "$GITHUB_OUTPUT"
else
echo "range=${BEFORE_SHA}..${HEAD_SHA}" >> "$GITHUB_OUTPUT"
fi
- name: Scan new commits for secrets
run: >-
gitleaks git
--redact
--no-banner
--log-opts="${{ steps.commits.outputs.range }}"
.