Skip to content

Commit 30534bf

Browse files
authored
chore: add CI workflows to publish sdk (#689)
* chore: add CI workflows to publish sdk * working dirs * working dirs * sdk test results * run on pr to test * run on pr to test * wip * wip * dev deps * dev deps * again? * grab version * working create pr, I think * publish on main
1 parent 5669ea9 commit 30534bf

7 files changed

Lines changed: 460 additions & 3 deletions

File tree

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
name: Build and Unit Test SDK
2+
3+
on:
4+
pull_request: {}
5+
merge_group:
6+
branches: [ "main" ]
7+
8+
env:
9+
CI: true
10+
DEBUG: napi:*
11+
APP_NAME: flight-sql-client
12+
MACOSX_DEPLOYMENT_TARGET: '10.13'
13+
CARGO_INCREMENTAL: '1'
14+
FLIGHT_SQL_PATH: ./sdk/packages/flight-sql-client/
15+
16+
permissions:
17+
contents: write
18+
id-token: write
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
build:
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
settings:
30+
- host: macos-13
31+
target: x86_64-apple-darwin
32+
build: pnpm build:rust --target x86_64-apple-darwin && pnpm build:js
33+
- host: ubuntu-latest
34+
target: x86_64-unknown-linux-gnu
35+
build: pnpm build:rust --target x86_64-unknown-linux-gnu && pnpm build:js
36+
- host: macos-latest
37+
target: aarch64-apple-darwin
38+
build: pnpm build:rust --target aarch64-apple-darwin && pnpm build:js
39+
name: stable - ${{ matrix.settings.target }} - node@20
40+
runs-on: ${{ matrix.settings.host }}
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v4
44+
- name: Setup node
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: 20
48+
- name: Install pnpm
49+
id: pnpm-install
50+
uses: pnpm/action-setup@v3
51+
with:
52+
version: 9.8.0
53+
run_install: false
54+
- name: Get pnpm store directory
55+
id: pnpm-cache
56+
shell: bash
57+
working-directory: sdk
58+
run: |
59+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
60+
- name: Setup pnpm cache
61+
uses: actions/cache@v4
62+
with:
63+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
64+
key: ${{ runner.os }}_${{ matrix.settings.target }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
65+
restore-keys: |
66+
${{ runner.os }}_${{ matrix.settings.target }}-pnpm-store-
67+
- name: Cache cargo
68+
uses: actions/cache@v4
69+
with:
70+
path: |
71+
~/.cargo/registry/index/
72+
~/.cargo/registry/cache/
73+
~/.cargo/git/db/
74+
.cargo-cache
75+
target/
76+
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
77+
- name: Install dependencies and buld
78+
working-directory: sdk
79+
run: pnpm install --frozen-lockfile
80+
- name: Lint
81+
working-directory: sdk
82+
run: pnpm run lint:ci
83+
- name: Build
84+
working-directory: sdk
85+
run: ${{ matrix.settings.build }}
86+
shell: bash
87+
- name: Run unit tests
88+
working-directory: sdk
89+
run: pnpm test:ci
90+
shell: bash
91+
- name: Upload artifact
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: bindings-${{ matrix.settings.target }}
95+
path: ${{ env.FLIGHT_SQL_PATH }}${{ env.APP_NAME }}.*.node
96+
if-no-files-found: error
97+
test-macOS-binding:
98+
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
99+
needs:
100+
- build
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
settings:
105+
- host: macos-latest
106+
target: aarch64-apple-darwin
107+
architecture: arm64
108+
- host: macos-13
109+
target: x86_64-apple-darwin
110+
architecture: x64
111+
node:
112+
- '20'
113+
- '22'
114+
runs-on: ${{ matrix.settings.host }}
115+
steps:
116+
- uses: actions/checkout@v4
117+
- name: Setup node
118+
uses: actions/setup-node@v4
119+
with:
120+
node-version: ${{ matrix.node }}
121+
architecture: ${{ matrix.settings.architecture }}
122+
- name: Install pnpm
123+
id: pnpm-install
124+
uses: pnpm/action-setup@v3
125+
with:
126+
version: 9.8.0
127+
run_install: false
128+
- name: Get pnpm store directory
129+
id: pnpm-cache
130+
shell: bash
131+
working-directory: sdk
132+
run: |
133+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
134+
- name: Setup pnpm cache
135+
uses: actions/cache@v4
136+
with:
137+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
138+
key: ${{ runner.os }}_${{ matrix.settings.target }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
139+
restore-keys: |
140+
${{ runner.os }}_${{ matrix.settings.target }}-pnpm-store-
141+
- name: Install dependencies
142+
working-directory: sdk
143+
run: pnpm install --frozen-lockfile
144+
- name: Download artifacts
145+
uses: actions/download-artifact@v4
146+
with:
147+
name: bindings-${{ matrix.settings.target }}
148+
path: ${{ env.FLIGHT_SQL_PATH }}
149+
- name: List packages
150+
working-directory: ${{ env.FLIGHT_SQL_PATH }}
151+
run: ls -R .
152+
shell: bash
153+
- name: Test bindings
154+
working-directory: ${{ env.FLIGHT_SQL_PATH }}
155+
run: pnpm test
156+
test-linux-x64-gnu-binding:
157+
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
158+
needs:
159+
- build
160+
strategy:
161+
fail-fast: false
162+
matrix:
163+
node:
164+
- '20'
165+
- '22'
166+
runs-on: ubuntu-latest
167+
steps:
168+
- uses: actions/checkout@v4
169+
- name: Setup node
170+
uses: actions/setup-node@v4
171+
with:
172+
node-version: ${{ matrix.node }}
173+
- name: Install pnpm
174+
id: pnpm-install
175+
uses: pnpm/action-setup@v3
176+
with:
177+
version: 9.8.0
178+
run_install: false
179+
- name: Get pnpm store directory
180+
id: pnpm-cache
181+
shell: bash
182+
working-directory: sdk
183+
run: |
184+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
185+
- name: Setup pnpm cache
186+
uses: actions/cache@v4
187+
with:
188+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
189+
key: ${{ runner.os }}_x86_64-unknown-linux-gnu-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
190+
restore-keys: |
191+
${{ runner.os }}_x86_64-unknown-linux-gnu-pnpm-store-
192+
- name: Install dependencies
193+
working-directory: sdk
194+
run: pnpm install --frozen-lockfile
195+
- name: Download artifacts
196+
uses: actions/download-artifact@v4
197+
with:
198+
name: bindings-x86_64-unknown-linux-gnu
199+
path: ${{ env.FLIGHT_SQL_PATH }}
200+
- name: List packages
201+
working-directory: ${{ env.FLIGHT_SQL_PATH }}
202+
run: ls -R .
203+
shell: bash
204+
- name: Test bindings
205+
working-directory: ${{ env.FLIGHT_SQL_PATH }}
206+
run: pnpm test
207+
sdk-test-results:
208+
name: SDK Test Results
209+
if: ${{ always() }}
210+
runs-on: ubuntu-latest
211+
needs: [test-linux-x64-gnu-binding, test-macOS-binding]
212+
steps:
213+
- run: exit 1
214+
# see https://stackoverflow.com/a/67532120/4907315
215+
if: >-
216+
${{
217+
contains(needs.*.result, 'failure')
218+
|| contains(needs.*.result, 'cancelled')
219+
}}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Create SDK Release PR
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
container:
15+
# See https://github.com/3box/rust-builder
16+
image: public.ecr.aws/r5b3e0r5/3box/rust-builder:latest
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PAT }}
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
- name: git config
25+
run: |
26+
git config --global --add safe.directory '*'
27+
git config user.email "github@3box.io"
28+
git config user.name "Github Automation"
29+
- name: Install pnpm
30+
id: pnpm-install
31+
uses: pnpm/action-setup@v3
32+
with:
33+
version: 9.8.0
34+
run_install: false
35+
- name: Install dependencies
36+
working-directory: sdk
37+
run: pnpm install --frozen-lockfile
38+
- name: Create release PR
39+
run: make sdk-release-pr
40+

0 commit comments

Comments
 (0)