Skip to content

Commit 85236b1

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

40 files changed

+1258
-709
lines changed

.github/workflows/aws.yaml

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