-
Notifications
You must be signed in to change notification settings - Fork 127
191 lines (156 loc) · 6.28 KB
/
on-push.yml
File metadata and controls
191 lines (156 loc) · 6.28 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
186
187
188
189
190
191
name: CI
on:
push:
branches: [main]
pull_request:
# Allow other workflows (e.g. release-rc.yaml) to reuse this file as a
# validation gate. Reusable invocations inherit the caller's permissions
# and ref, so no extra inputs/secrets are required.
workflow_call:
concurrency:
# Scoping by event_name as well as ref keeps reusable invocations from
# release workflows in a different group than push/PR runs on the same ref.
group: ci-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
PROTOC_VERSION: "28.3"
# arduino/setup-protoc@v3.0.0 has no Node.js 24 release yet; remove once a node24 version ships
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
# ---------------------------------------------------------------------------
# Python lint & format
# ---------------------------------------------------------------------------
lint:
name: Lint & format (ruff)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.12
- name: Install dev deps (no project build)
run: uv sync --group dev --no-install-project
- name: ruff check
run: uv run --no-sync ruff check
- name: ruff format --check
run: uv run --no-sync ruff format --check
# ---------------------------------------------------------------------------
# Python type check
# ---------------------------------------------------------------------------
typecheck:
name: mypy --strict
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
- name: Cache cargo build artifacts
uses: Swatinem/rust-cache@23869a5bd66c73db3c0ac40331f3206eb23791dc # v2.9.1
with:
workspaces: rust
shared-key: typecheck
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.12
- name: Install deps + build Rust extension
run: uv sync --group dev
- name: Check pinecone/__init__.pyi is in sync with _LAZY_IMPORTS
run: uv run --no-sync python scripts/generate_init_stub.py --check
- name: How to fix __init__.pyi drift
if: failure()
run: |
echo "::error::pinecone/__init__.pyi is out of sync with _LAZY_IMPORTS."
echo "Run: cd sdks/python-sdk && uv run python scripts/generate_init_stub.py"
echo "Then commit the regenerated pinecone/__init__.pyi."
- name: mypy --strict
run: uv run --no-sync mypy --strict pinecone/
# ---------------------------------------------------------------------------
# Python unit tests (matrix across supported versions)
# ---------------------------------------------------------------------------
unit-tests:
name: Unit tests (py${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
- name: Cache cargo build artifacts
uses: Swatinem/rust-cache@23869a5bd66c73db3c0ac40331f3206eb23791dc # v2.9.1
with:
workspaces: rust
shared-key: unit-tests
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Set up Python
run: uv python install ${{ matrix.python-version }}
- name: Install deps + build Rust extension
run: uv sync --group dev
- name: pytest tests/unit
run: uv run pytest tests/unit -x -v
# ---------------------------------------------------------------------------
# Rust check / clippy / fmt
# ---------------------------------------------------------------------------
rust:
name: Rust check / clippy / fmt
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
working-directory: rust
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain (rustfmt + clippy)
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache cargo build artifacts
uses: Swatinem/rust-cache@23869a5bd66c73db3c0ac40331f3206eb23791dc # v2.9.1
with:
workspaces: rust
shared-key: rust-checks
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: cargo fmt --check
run: cargo fmt --all --check
- name: cargo clippy
run: cargo clippy --all-targets -- -D warnings
- name: cargo check
run: cargo check --all-targets