Skip to content

Commit 45f1c7f

Browse files
authored
v2.2 part 1 + CI updates (#133)
* add ASSOCIATING to AstraDatabaseStatus * Fix DataAPIVectors not being properly serialized in sorts * minor test and dependency updates * revert uuid to v11 to allow cjs support * use zx's dotenv isntead of node's (since it node18 doesn't support it) * fix tests * remove beta tag from FARR * add $pullAll & $push to tableupdatefilter * Add action to compile docs examples with PR's client build (#135) * test docs compile tests * a * update ci * update ci * update ci * add pcuGroupUUID to AstraDatabaseConfig * update ci * add hcd integration tests to CI * re-enable other ci * allow workflows to be caleld w/ workflow_dispatch: * switch to use pull_request.types.auto_merge_enabled * actions has so many issues * lets try this differently... * sigh * im so tired of this * sigh * please * sdadlkfj
1 parent 79fb20b commit 45f1c7f

37 files changed

+1968
-156
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
name: Run basic checks
22

33
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
4+
workflow_call:
5+
inputs:
6+
node_versions:
7+
type: string
8+
required: true
9+
workflow_dispatch:
10+
inputs:
11+
node_versions:
12+
description: 'Comma-separated list of Node versions e.g. "18.x","24.x"'
13+
default: '"24.x"'
14+
required: false
815

916
jobs:
1017
checks:
1118
runs-on: ubuntu-latest
12-
19+
1320
strategy:
1421
matrix:
15-
node-version: [ 18.x, 24.x ]
16-
22+
node-version: ${{ fromJSON(format('[{0}]', inputs.node_versions)) }}
23+
1724
steps:
1825
- name: Checkout code
1926
uses: actions/checkout@v4
20-
27+
2128
- name: Setup Node.js ${{ matrix.node-version }}
2229
uses: actions/setup-node@v4
2330
with:
2431
node-version: ${{ matrix.node-version }}
2532
cache: 'npm'
26-
33+
2734
- name: Install dependencies
2835
run: npm ci
29-
36+
3037
- name: Run checks
3138
run: npx tsx scripts/check.ts
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Compile against documentation examples
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
test-compilation:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Cache Node.js modules
15+
uses: actions/cache@v3
16+
with:
17+
path: ~/.npm
18+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
19+
restore-keys: |
20+
${{ runner.os }}-node-
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build TypeScript client
26+
run: npm run build
27+
28+
- name: Pack TypeScript client
29+
id: pack
30+
run: |
31+
echo "tar_file=$PWD/$(npm pack)" >> $GITHUB_OUTPUT
32+
33+
- name: Run compilation tests
34+
uses: datastax/astra-client-docs-tests/.github/actions/test-compilation@master
35+
with:
36+
clients: 'typescript'
37+
args: -A typescript="${{ steps.pack.outputs.tar_file }}"
38+
docs-repo-token: ${{ secrets.DOC_GITHUB_PAT_CROSS_ORG }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Run integration tests against HCD
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
id-token: write
9+
10+
jobs:
11+
test-integration-hcd:
12+
runs-on: ubuntu-latest
13+
env:
14+
CLIENT_EMBEDDING_API_KEY: ${{ secrets.CLIENT_EMBEDDING_API_KEY }}
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'npm'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Configure AWS credentials from OIDC
29+
uses: aws-actions/configure-aws-credentials@v4
30+
with:
31+
role-to-assume: arn:aws:iam::559669398656:role/astra-db-ts-ecr-ro-user
32+
aws-region: us-west-2
33+
34+
- name: Login to Amazon ECR
35+
uses: aws-actions/amazon-ecr-login@v2
36+
37+
- name: Start HCD + Data API
38+
run: npx tsx scripts/startgate.ts -d -hcd
39+
40+
- name: Run tests
41+
run: npx tsx scripts/test.ts -local -F RERANKING -F unit.

.github/workflows/_unit-tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Run unit tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node_versions:
7+
type: string
8+
required: true
9+
workflow_dispatch:
10+
inputs:
11+
node_versions:
12+
description: 'Comma-separated list of Node versions e.g. "18.x","24.x"'
13+
default: '"24.x"'
14+
required: false
15+
16+
env:
17+
CLIENT_DB_URL: https://abcdefa-1234-5678-90ab-cdef12345678-fake-region-123.apps.astra.datastax.com
18+
CLIENT_DB_TOKEN: AstraCS:fake_token:fake_token
19+
CLIENT_EMBEDDING_API_KEY: fake_embedding_api_key
20+
21+
jobs:
22+
unit-tests:
23+
runs-on: ubuntu-latest
24+
25+
strategy:
26+
matrix:
27+
node-version: ${{ fromJSON(format('[{0}]', inputs.node_versions)) }}
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
cache: 'npm'
38+
39+
- name: Install dependencies
40+
run: npm ci
41+
42+
- name: Run unit tests
43+
run: npx tsx scripts/test.ts -u

.github/workflows/tests.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Tests
2+
3+
on:
4+
merge_group:
5+
pull_request:
6+
7+
jobs:
8+
run-checks:
9+
name: Run checks
10+
uses: ./.github/workflows/_checks.yml
11+
with:
12+
node_versions: ${{ github.event_name == 'merge_group' && '"24.x","18.x"' || '"24.x"' }}
13+
14+
run-unit-tests:
15+
name: Run unit tests
16+
uses: ./.github/workflows/_unit-tests.yml
17+
with:
18+
node_versions: ${{ github.event_name == 'merge_group' && '"24.x","18.x"' || '"24.x"' }}
19+
20+
run-docs-compilation-tests:
21+
name: Run docs compilation tests
22+
needs: [run-checks, run-unit-tests]
23+
if: github.event_name == 'merge_group'
24+
uses: ./.github/workflows/_docs-compile-tests.yml
25+
secrets: inherit
26+
27+
run-hcd-integration-tests:
28+
name: Run HCD integration tests
29+
needs: [run-checks, run-unit-tests]
30+
if: github.event_name == 'merge_group'
31+
uses: ./.github/workflows/_hcd-integration-tests.yml
32+
secrets: inherit
33+
34+
can-enqueue:
35+
name: Can enqueue
36+
needs: [run-checks, run-unit-tests]
37+
if: always() && github.event_name != 'merge_group'
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Check outcomes
41+
run: |
42+
echo '${{ toJSON(needs) }}' | jq -e 'to_entries | map(.value.result == "success" or .value.result == "skipped") | all'
43+
44+
can-merge:
45+
name: Can merge
46+
needs: [run-checks, run-unit-tests, run-docs-compilation-tests, run-hcd-integration-tests]
47+
if: always() && github.event_name == 'merge_group'
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Check outcomes
51+
run: |
52+
echo '${{ toJSON(needs) }}' | jq -e 'to_entries | map(.value.result == "success" or .value.result == "skipped") | all'

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

package-lock.json

Lines changed: 5 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
"@types/node": "^25.2.0",
7272
"@types/strip-comments": "^2.0.4",
7373
"c8": "^10.1.3",
74-
"dotenv": "^17.2.3",
7574
"eslint": "^9.39.2",
7675
"fetch-h2": "^3.0.2",
7776
"globals": "^17.3.0",
@@ -92,7 +91,7 @@
9291
"json-bigint": "^1.0.0",
9392
"safe-stable-stringify": "^2.5.0",
9493
"tslib": "^2.8.1",
95-
"uuid": "^13.0.0"
94+
"uuid": "^11.1.0"
9695
},
9796
"engines": {
9897
"node": ">=18.0.0"

scripts/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function CleanupDist(): Step {
188188
const numDeleted = await _deleteEmptyFilesImpl(path, targetContent);
189189

190190
if (numDeleted < 10) {
191-
throw new Error(`Failsafe triggered: Only ${numDeleted} empty files deleted. Please check the deletion logic—the "empty" JS file output may have changed for ${path.split('/').at(-1)}.`);
191+
throw new Error(`Failsafe triggered: Only ${numDeleted} empty files deleted. Please check the deletion logic—the "empty" JS file output may have changed for ${path.split('/')[path.split('/').length - 1]}.`);
192192
}
193193
}
194194

scripts/playground.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ if [ "$action" = "create" ]; then
6767
npm i "$lib_dir"
6868

6969
echo "import * as $ from '@datastax/astra-db-ts';
70-
import dotenv from 'dotenv';
70+
import { dotenv } from 'zx';
7171
72-
dotenv.configDotenv({ path: '../../../.env' });
72+
dotenv.config('../../../.env');
7373
7474
const client = new $.DataAPIClient(process.env.CLIENT_DB_TOKEN, { environment: process.env.CLIENT_DB_ENVIRONMENT as any });
7575
const db = client.db(process.env.CLIENT_DB_URL!);

0 commit comments

Comments
 (0)