| 1 | name: Node |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - main |
| 7 | pull_request: |
| 8 | paths: |
| 9 | - node/** |
| 10 | - rust/ffi/node/** |
| 11 | - .github/workflows/node.yml |
| 12 | - docker-compose.yml |
| 13 | |
| 14 | concurrency: |
| 15 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 16 | cancel-in-progress: true |
| 17 | |
| 18 | env: |
| 19 | # Disable full debug symbol generation to speed up CI build and keep memory down |
| 20 | # "1" means line tables only, which is useful for panic tracebacks. |
| 21 | # |
| 22 | # Use native CPU to accelerate tests if possible, especially for f16 |
| 23 | # target-cpu=haswell fixes failing ci build |
| 24 | RUSTFLAGS: "-C debuginfo=1 -C target-cpu=haswell -C target-feature=+f16c,+avx2,+fma" |
| 25 | RUST_BACKTRACE: "1" |
| 26 | |
| 27 | jobs: |
| 28 | linux: |
| 29 | name: Linux (Node ${{ matrix.node-version }}) |
| 30 | timeout-minutes: 30 |
| 31 | strategy: |
| 32 | matrix: |
| 33 | node-version: [ "18", "20" ] |
| 34 | runs-on: "ubuntu-22.04" |
| 35 | defaults: |
| 36 | run: |
| 37 | shell: bash |
| 38 | working-directory: node |
| 39 | steps: |
| 40 | - uses: actions/checkout@v4 |
| 41 | with: |
| 42 | fetch-depth: 0 |
| 43 | lfs: true |
| 44 | - uses: actions/setup-node@v3 |
| 45 | with: |
| 46 | node-version: ${{ matrix.node-version }} |
| 47 | cache: 'npm' |
| 48 | cache-dependency-path: node/package-lock.json |
| 49 | - uses: Swatinem/rust-cache@v2 |
| 50 | - name: Install dependencies |
| 51 | run: | |
| 52 | sudo apt update |
| 53 | sudo apt install -y protobuf-compiler libssl-dev |
| 54 | - name: Build |
| 55 | run: | |
| 56 | npm ci |
| 57 | npm run build |
| 58 | npm run pack-build |
| 59 | npm install --no-save ./dist/lancedb-vectordb-*.tgz |
| 60 | # Remove index.node to test with dependency installed |
| 61 | rm index.node |
| 62 | - name: Test |
| 63 | run: npm run test |
| 64 | macos: |
| 65 | timeout-minutes: 30 |
| 66 | runs-on: "macos-13" |
| 67 | defaults: |
| 68 | run: |
| 69 | shell: bash |
| 70 | working-directory: node |
| 71 | steps: |
| 72 | - uses: actions/checkout@v4 |
| 73 | with: |
| 74 | fetch-depth: 0 |
| 75 | lfs: true |
| 76 | - uses: actions/setup-node@v3 |
| 77 | with: |
| 78 | node-version: 20 |
| 79 | cache: 'npm' |
| 80 | cache-dependency-path: node/package-lock.json |
| 81 | - uses: Swatinem/rust-cache@v2 |
| 82 | - name: Install dependencies |
| 83 | run: brew install protobuf |
| 84 | - name: Build |
| 85 | run: | |
| 86 | npm ci |
| 87 | npm run build |
| 88 | npm run pack-build |
| 89 | npm install --no-save ./dist/lancedb-vectordb-*.tgz |
| 90 | # Remove index.node to test with dependency installed |
| 91 | rm index.node |
| 92 | - name: Test |
| 93 | run: | |
| 94 | npm run test |
| 95 | aws-integtest: |
| 96 | timeout-minutes: 45 |
| 97 | runs-on: "ubuntu-22.04" |
| 98 | defaults: |
| 99 | run: |
| 100 | shell: bash |
| 101 | working-directory: node |
| 102 | env: |
| 103 | AWS_ACCESS_KEY_ID: ACCESSKEY |
| 104 | AWS_SECRET_ACCESS_KEY: SECRETKEY |
| 105 | AWS_DEFAULT_REGION: us-west-2 |
| 106 | # this one is for s3 |
| 107 | AWS_ENDPOINT: http://localhost:4566 |
| 108 | # this one is for dynamodb |
| 109 | DYNAMODB_ENDPOINT: http://localhost:4566 |
| 110 | ALLOW_HTTP: true |
| 111 | steps: |
| 112 | - uses: actions/checkout@v4 |
| 113 | with: |
| 114 | fetch-depth: 0 |
| 115 | lfs: true |
| 116 | - uses: actions/setup-node@v3 |
| 117 | with: |
| 118 | node-version: 20 |
| 119 | cache: 'npm' |
| 120 | cache-dependency-path: node/package-lock.json |
| 121 | - name: start local stack |
| 122 | run: docker compose -f ../docker-compose.yml up -d --wait |
| 123 | - name: create s3 |
| 124 | run: aws s3 mb s3://lancedb-integtest --endpoint $AWS_ENDPOINT |
| 125 | - name: create ddb |
| 126 | run: | |
| 127 | aws dynamodb create-table \ |
| 128 | --table-name lancedb-integtest \ |
| 129 | --attribute-definitions '[{"AttributeName": "base_uri", "AttributeType": "S"}, {"AttributeName": "version", "AttributeType": "N"}]' \ |
| 130 | --key-schema '[{"AttributeName": "base_uri", "KeyType": "HASH"}, {"AttributeName": "version", "KeyType": "RANGE"}]' \ |
| 131 | --provisioned-throughput '{"ReadCapacityUnits": 10, "WriteCapacityUnits": 10}' \ |
| 132 | --endpoint-url $DYNAMODB_ENDPOINT |
| 133 | - uses: Swatinem/rust-cache@v2 |
| 134 | - name: Install dependencies |
| 135 | run: | |
| 136 | sudo apt update |
| 137 | sudo apt install -y protobuf-compiler libssl-dev |
| 138 | - name: Build |
| 139 | run: | |
| 140 | npm ci |
| 141 | npm run build |
| 142 | npm run pack-build |
| 143 | npm install --no-save ./dist/lancedb-vectordb-*.tgz |
| 144 | # Remove index.node to test with dependency installed |
| 145 | rm index.node |
| 146 | - name: Test |
| 147 | run: npm run integration-test |