Skip to content

Commit b5a048a

Browse files
authored
Working JavaScript Library (#789)
1 parent 6187d41 commit b5a048a

File tree

21 files changed

+199
-137
lines changed

21 files changed

+199
-137
lines changed

.github/workflows/javascript-sdk.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: deploy javascript sdk
22
on:
33
workflow_dispatch:
44
jobs:
5-
build-javascript-sdk-linux:
5+
build-javascript-sdk:
66
strategy:
77
matrix:
88
os: ["ubuntu-22.04", "buildjet-4vcpu-ubuntu-2204-arm", "macos-latest", "windows-latest"]
@@ -13,7 +13,7 @@ jobs:
1313
os: "buildjet-4vcpu-ubuntu-2204-arm"
1414
- neon-out-name: "x86_64-apple-darwin-index.node"
1515
os: "macos-latest"
16-
- neon-out-name: "x86_64-pc-windows-gnu.node"
16+
- neon-out-name: "x86_64-pc-windows-gnu-index.node"
1717
os: "windows-latest"
1818
runs-on: ${{ matrix.os }}
1919
defaults:
@@ -29,28 +29,50 @@ jobs:
2929
with:
3030
command: version
3131
- name: Do build
32-
env:
33-
NEON_OUT_NAME: ${{ matrix.neon-out-name }}
3432
run: |
3533
npm i
36-
npm run build-named
34+
npm run build-release
35+
mv index.node ${{ matrix.neon-out-name }}
36+
- name: Display output files
37+
run: ls -R
3738
- name: Upload built .node file
3839
uses: actions/upload-artifact@v3
3940
with:
4041
name: node-artifacts
41-
path: ${{ matrix.neon-out-name }}
42+
path: pgml-sdks/rust/pgml/javascript/${{ matrix.neon-out-name }}
4243
retention-days: 1
4344
publish-javascript-sdk:
45+
needs: build-javascript-sdk
4446
runs-on: "ubuntu-22.04"
4547
defaults:
4648
run:
4749
working-directory: pgml-sdks/rust/pgml/javascript
4850
steps:
51+
- uses: actions/checkout@v3
52+
- uses: actions-rs/toolchain@v1
53+
with:
54+
toolchain: stable
55+
- name: Validate cargo is working
56+
uses: postgresml/gh-actions-cargo@master
57+
with:
58+
command: version
4959
- name: Create artifact directory
5060
run: mkdir dist
51-
- uses: actions/download-artifact@v3
61+
- name: Download artifacts
62+
uses: actions/download-artifact@v3
5263
with:
5364
name: node-artifacts
54-
path: dist
55-
- name: Display structure of download-artifacts
56-
run: ls -R dist
65+
path: pgml-sdks/rust/pgml/javascript/dist
66+
- uses: actions/setup-node@v3
67+
with:
68+
node-version: '20.x'
69+
registry-url: 'https://registry.npmjs.org'
70+
- name: Generate types declaration
71+
run: |
72+
npm i
73+
npm run build
74+
rm index.node
75+
- run: npm ci
76+
- run: npm publish
77+
env:
78+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/python-sdk.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Create dist directory
4343
run: mkdir ../../python/dist
4444
- name: Build wheels
45-
run: maturin build --release --strip -i python3.8 -i python3.9 -i python3.10 -i python3.11 -o ../../python/pgml/dist
45+
run: maturin build --release --strip -i python3.8 -i python3.9 -i python3.10 -i python3.11 -o ../../python/pgml/dist -F python
4646
- name: Deploy wheels
4747
env:
4848
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
@@ -73,7 +73,7 @@ jobs:
7373
- name: Create dist directory
7474
run: mkdir ../../python/dist
7575
- name: Build wheels
76-
run: maturin build --release --strip -i python3.8 -i python3.9 -i python3.10 -i python3.11 -o ../../python/pgml/dist
76+
run: maturin build --release --strip -i python3.8 -i python3.9 -i python3.10 -i python3.11 -o ../../python/pgml/dist -F python
7777
- name: Deploy wheels
7878
env:
7979
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
@@ -107,7 +107,7 @@ jobs:
107107
- name: Create dist directory
108108
run: mkdir ..\..\python\dist
109109
- name: Build wheels
110-
run: maturin build --release --strip -o ..\..\python\pgml\dist
110+
run: maturin build --release --strip -o ..\..\python\pgml\dist -F python
111111
- name: Deploy wheels
112112
env:
113113
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)