Skip to content

Commit c67c80c

Browse files
committed
add ci and e2e suites
1 parent 4227b4d commit c67c80c

40 files changed

+1252
-709
lines changed

.github/workflows/aws.yaml

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
name: E2E AWS
2+
3+
on:
4+
workflow_call: {}
5+
6+
permissions:
7+
contents: read
8+
id-token: write
9+
10+
jobs:
11+
up:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 60
14+
environment: aws-e2e
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set stack name
21+
run: |
22+
if [ -n "$PR_NUMBER" ]; then
23+
echo "STACK_NAME=ci-aws-pr${PR_NUMBER}-${GITHUB_SHA::7}" >> "$GITHUB_ENV"
24+
else
25+
echo "STACK_NAME=ci-aws-${GITHUB_SHA::7}" >> "$GITHUB_ENV"
26+
fi
27+
env:
28+
PR_NUMBER: ${{ github.event.pull_request.number }}
29+
30+
- name: Configure AWS credentials (OIDC)
31+
uses: aws-actions/configure-aws-credentials@v4
32+
with:
33+
role-to-assume: ${{ secrets.AWS_E2E_ROLE_ARN }}
34+
aws-region: us-east-1
35+
role-duration-seconds: 43200
36+
37+
- uses: astral-sh/setup-uv@v5
38+
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.12"
42+
43+
- name: Install Pulumi CLI
44+
uses: pulumi/actions@v6
45+
46+
- name: Install kubectl
47+
uses: azure/setup-kubectl@v4
48+
49+
- name: Run wizard (headless)
50+
id: wizard
51+
env:
52+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
53+
PINECONE_REGION: us-east-1
54+
PINECONE_AZS: "us-east-1a,us-east-1b"
55+
PINECONE_VPC_CIDR: "10.0.0.0/16"
56+
PINECONE_DELETION_PROTECTION: "false"
57+
PINECONE_PUBLIC_ACCESS: "false"
58+
PINECONE_PROJECT_NAME: "pinecone-byoc"
59+
run: |
60+
uv run --with rich --with pyyaml python setup/wizard.py \
61+
--cloud aws \
62+
--headless \
63+
--stack-name "$STACK_NAME" \
64+
--skip-install \
65+
--output-dir ./e2e-project
66+
67+
- name: Patch __main__.py with CI overrides
68+
working-directory: ./e2e-project
69+
run: |
70+
python3 << 'PATCH'
71+
path = "__main__.py"
72+
content = open(path).read()
73+
content = content.replace(
74+
" tags=config.get_object(\"tags\"),",
75+
""" tags=config.get_object("tags"),
76+
global_env=config.require("global-env"),
77+
api_url=config.require("api-url"),
78+
auth0_domain=config.require("auth0-domain"),
79+
gcp_project=config.require("gcp-project"),""",
80+
)
81+
open(path, "w").write(content)
82+
PATCH
83+
84+
- name: Replace PyPI dep with local source
85+
working-directory: ./e2e-project
86+
run: |
87+
sed -i 's|"pulumi-pinecone-byoc\[aws\]"|"pulumi-pinecone-byoc[aws] @ file://'"$GITHUB_WORKSPACE"'"|' pyproject.toml
88+
89+
- name: Install dependencies
90+
working-directory: ./e2e-project
91+
run: uv sync
92+
93+
- name: Setup Pulumi stack
94+
working-directory: ./e2e-project
95+
env:
96+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
97+
run: |
98+
pulumi stack select --create "$STACK_NAME"
99+
100+
- name: Set Pulumi config
101+
working-directory: ./e2e-project
102+
env:
103+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
104+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
105+
run: |
106+
pulumi config set --secret pinecone-api-key "$PINECONE_API_KEY" --stack "$STACK_NAME"
107+
pulumi config set global-env ci --stack "$STACK_NAME"
108+
pulumi config set api-url "https://api-staging.pinecone.io" --stack "$STACK_NAME"
109+
pulumi config set auth0-domain "https://internal-beta-pinecone-io.us.auth0.com" --stack "$STACK_NAME"
110+
pulumi config set gcp-project "development-pinecone" --stack "$STACK_NAME"
111+
112+
- name: Pulumi up
113+
working-directory: ./e2e-project
114+
env:
115+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
116+
run: pulumi up --yes --stack "$STACK_NAME"
117+
118+
down:
119+
needs: up
120+
if: always() && needs.up.result != 'skipped'
121+
runs-on: ubuntu-latest
122+
timeout-minutes: 60
123+
environment: aws-e2e
124+
steps:
125+
- uses: actions/checkout@v4
126+
with:
127+
fetch-depth: 0
128+
129+
- name: Set stack name
130+
run: |
131+
if [ -n "$PR_NUMBER" ]; then
132+
echo "STACK_NAME=ci-aws-pr${PR_NUMBER}-${GITHUB_SHA::7}" >> "$GITHUB_ENV"
133+
else
134+
echo "STACK_NAME=ci-aws-${GITHUB_SHA::7}" >> "$GITHUB_ENV"
135+
fi
136+
env:
137+
PR_NUMBER: ${{ github.event.pull_request.number }}
138+
139+
- name: Configure AWS credentials (OIDC)
140+
uses: aws-actions/configure-aws-credentials@v4
141+
with:
142+
role-to-assume: ${{ secrets.AWS_E2E_ROLE_ARN }}
143+
aws-region: us-east-1
144+
role-duration-seconds: 43200
145+
146+
- uses: astral-sh/setup-uv@v5
147+
148+
- uses: actions/setup-python@v5
149+
with:
150+
python-version: "3.12"
151+
152+
- name: Install Pulumi CLI
153+
uses: pulumi/actions@v6
154+
155+
- name: Run wizard (headless)
156+
env:
157+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
158+
PINECONE_REGION: us-east-1
159+
PINECONE_AZS: "us-east-1a,us-east-1b"
160+
PINECONE_VPC_CIDR: "10.0.0.0/16"
161+
PINECONE_DELETION_PROTECTION: "false"
162+
PINECONE_PUBLIC_ACCESS: "false"
163+
PINECONE_PROJECT_NAME: "pinecone-byoc"
164+
run: |
165+
uv run --with rich --with pyyaml python setup/wizard.py \
166+
--cloud aws \
167+
--headless \
168+
--stack-name "$STACK_NAME" \
169+
--skip-install \
170+
--output-dir ./e2e-project
171+
172+
- name: Patch __main__.py with CI overrides
173+
working-directory: ./e2e-project
174+
run: |
175+
python3 << 'PATCH'
176+
path = "__main__.py"
177+
content = open(path).read()
178+
content = content.replace(
179+
" tags=config.get_object(\"tags\"),",
180+
""" tags=config.get_object("tags"),
181+
global_env=config.require("global-env"),
182+
api_url=config.require("api-url"),
183+
auth0_domain=config.require("auth0-domain"),
184+
gcp_project=config.require("gcp-project"),""",
185+
)
186+
open(path, "w").write(content)
187+
PATCH
188+
189+
- name: Replace PyPI dep with local source
190+
working-directory: ./e2e-project
191+
run: |
192+
sed -i 's|"pulumi-pinecone-byoc\[aws\]"|"pulumi-pinecone-byoc[aws] @ file://'"$GITHUB_WORKSPACE"'"|' pyproject.toml
193+
194+
- name: Install dependencies
195+
working-directory: ./e2e-project
196+
run: uv sync
197+
198+
- name: Cancel stale locks
199+
working-directory: ./e2e-project
200+
env:
201+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
202+
run: pulumi cancel --yes --stack "$STACK_NAME" 2>/dev/null || true
203+
204+
- name: Pulumi destroy
205+
working-directory: ./e2e-project
206+
env:
207+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
208+
run: pulumi destroy --yes --stack "$STACK_NAME"
209+
210+
- name: Pulumi stack rm
211+
working-directory: ./e2e-project
212+
env:
213+
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
214+
run: pulumi stack rm "$STACK_NAME" --yes --force

.github/workflows/ci.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: astral-sh/setup-uv@v5
19+
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
24+
- name: Install dependencies
25+
run: uv sync --all-extras --group dev
26+
27+
- name: Check formatting
28+
run: uv run ruff format --check .
29+
30+
- name: Run linting
31+
run: uv run ruff check .
32+
33+
- name: Run type checking
34+
run: uv run ty check

.github/workflows/e2e.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: E2E
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
workflow_dispatch: {}
7+
8+
concurrency:
9+
group: e2e-${{ github.head_ref || github.ref }}
10+
cancel-in-progress: false
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
jobs:
17+
changes:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
aws: ${{ steps.filter.outputs.aws }}
21+
gcp: ${{ steps.filter.outputs.gcp }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: dorny/paths-filter@v3
25+
id: filter
26+
with:
27+
filters: |
28+
aws:
29+
- 'pulumi_pinecone_byoc/aws/**'
30+
- 'pulumi_pinecone_byoc/common/**'
31+
- 'config/aws.py'
32+
- 'config/base.py'
33+
- 'config/__init__.py'
34+
- 'setup/wizard.py'
35+
- 'setup/aws_wizard.py'
36+
gcp:
37+
- 'pulumi_pinecone_byoc/gcp/**'
38+
- 'pulumi_pinecone_byoc/common/**'
39+
- 'config/gcp.py'
40+
- 'config/base.py'
41+
- 'config/__init__.py'
42+
- 'setup/wizard.py'
43+
- 'setup/gcp_wizard.py'
44+
45+
aws:
46+
needs: changes
47+
if: needs.changes.outputs.aws == 'true' || github.event_name == 'workflow_dispatch'
48+
uses: ./.github/workflows/aws.yaml
49+
secrets: inherit
50+
51+
gcp:
52+
needs: changes
53+
if: needs.changes.outputs.gcp == 'true' || github.event_name == 'workflow_dispatch'
54+
uses: ./.github/workflows/gcp.yaml
55+
secrets: inherit
56+
57+
result:
58+
if: always()
59+
needs: [changes, aws, gcp]
60+
runs-on: ubuntu-latest
61+
steps:
62+
- run: |
63+
echo "AWS: ${{ needs.aws.result }}"
64+
echo "GCP: ${{ needs.gcp.result }}"
65+
if [ "${{ needs.aws.result }}" = "failure" ] || [ "${{ needs.gcp.result }}" = "failure" ]; then
66+
echo "E2E failed"
67+
exit 1
68+
fi
69+
if [ "${{ needs.aws.result }}" = "cancelled" ] || [ "${{ needs.gcp.result }}" = "cancelled" ]; then
70+
echo "E2E cancelled"
71+
exit 1
72+
fi
73+
echo "OK"

0 commit comments

Comments
 (0)