-
Notifications
You must be signed in to change notification settings - Fork 38
193 lines (179 loc) · 5.46 KB
/
testing.yml
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
192
193
name: Testing
on:
workflow_call: {}
jobs:
unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Run tests
env:
CI: true
run: npm run test:unit -- --coverage
integration-tests:
name: Run integration tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 2
matrix:
pinecone_env:
- prod
# - staging
node_version: [18.x, 20.x]
config:
[
{ runner: 'npm', jest_env: 'node' },
{ runner: 'npm', jest_env: 'edge' },
{ runner: 'bun', jest_env: 'node', bun_version: '1.0.0' },
{ runner: 'bun', jest_env: 'node', bun_version: '1.0.36' },
{ runner: 'bun', jest_env: 'node', bun_version: '1.1.11' },
]
steps:
- name: Global Setup
- if: ${{ github.event_name != 'workflow_dispatch' }} # Conditional if needed
- run: node ./src/integration/callSetup.js # Run global setup once
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ matrix.node_version }}
- name: Setup bun
if: matrix.config.bun_version
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ matrix.config.bun_version }}
- name: Run integration tests (Prod)
if: matrix.pinecone_env == 'prod'
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }}
- name: Run integration tests (Staging)
if: matrix.pinecone_env == 'staging'
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io'
run: ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }}
- name: Global Teardown
if: always() # This ensures teardown runs even if tests fail
run: node ./src/integration/callTeardown.js # Run global teardown once
integration-test-cleanup:
name: Clean up integration tests
if: always()
needs: [integration-tests]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- name: Install npm packages
run: |
npm install --ignore-scripts
shell: bash
- name: Run integration cleanup command
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: npm run test:integration:cleanup
typescript-compilation-tests:
name: TS compile
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tsVersion:
[
'~4.1.0',
'~4.2.0',
'~4.3.0',
'~4.4.0',
'~4.5.0',
'~4.6.0',
'~4.7.0',
'~4.8.0',
'~4.9.0',
'~5.0.0',
'~5.1.0',
'~5.2.0',
'latest',
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- name: Install npm packages
run: |
npm install --ignore-scripts
shell: bash
- name: Build TypeScript for Pinecone
run: npm run build
shell: bash
- name: install, compile, and run sample app
shell: bash
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: |
set -x
cd ..
cp -r pinecone-ts-client/ts-compilation-test ts-compilation-test
cd ts-compilation-test
npm install typescript@${{ matrix.tsVersion }} --no-cache
npm install '../pinecone-ts-client' --no-cache
cat package.json
cat package-lock.json
npm run tsc-version
npm run build
npm run start
example-app-semantic-search:
name: 'Example app: semantic search'
runs-on: ubuntu-latest
steps:
- name: Checkout pinecone-ts-client
uses: actions/checkout@v4
with:
path: pinecone-ts-client
- name: Checkout semantic-search-example
uses: actions/checkout@v4
with:
repository: pinecone-io/semantic-search-example
ref: spruce
path: semantic-search-example
- name: Install and build client
shell: bash
run: |
cd pinecone-ts-client
npm install --ignore-scripts
npm run build
- name: Install and build sample app
shell: bash
run: |
cd semantic-search-example
npm install --no-cache
npm install '../pinecone-ts-client'
cat package.json
- name: Run example tests with dev version of client
env:
CI: true
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
PINECONE_INDEX: 'semantic-search'
PINECONE_CLOUD: 'aws'
PINECONE_REGION: 'us-west-2'
shell: bash
run: |
cd semantic-search-example
npm run test