Repository navigation
135 lines (131 loc) · 4.81 KB
/
Copy pathbindings.nodejs.yml
File metadata and controls
135 lines (131 loc) · 4.81 KB
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
name: Bindings Node.js
on:
workflow_call:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
cache-key: bindings-nodejs-integration
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
working-directory: bindings/nodejs
run: pnpm install
- name: Check format
working-directory: bindings/nodejs
run: pnpm prettier --check .
build:
needs: check
name: build-${{ matrix.target }}
runs-on: ${{ matrix.runner }}
env:
# Override rust-toolchain.toml for the pinned cross-compilation jobs.
RUSTUP_TOOLCHAIN: ${{ matrix.toolchain || 'stable' }}
strategy:
matrix:
include:
- { target: x86_64-unknown-linux-gnu, runner: ubuntu-22.04 }
# Pin both ARM64 Linux builds: Rust 1.98 adds --fix-cortex-a53-843419,
# which zig cc rejects through NAPI CLI 2.x's linker wrapper.
# This preserves the previous build behavior, without the new erratum mitigation.
# Remove the pins once the linker integration supports the mitigation:
# https://codeberg.org/ziglang/zig/issues/36624
- { target: aarch64-unknown-linux-gnu, runner: ubuntu-22.04, toolchain: '1.97.1' }
- { target: x86_64-unknown-linux-musl, runner: ubuntu-latest }
- { target: aarch64-unknown-linux-musl, runner: ubuntu-latest, toolchain: '1.97.1' }
- { target: x86_64-pc-windows-msvc, runner: windows-latest }
- { target: aarch64-pc-windows-msvc, runner: windows-latest }
- { target: x86_64-apple-darwin, runner: macos-latest }
- { target: aarch64-apple-darwin, runner: macos-latest }
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
cache-key: bindings-nodejs-${{ matrix.target }}
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain || 'stable' }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install ziglang
if: contains(matrix.target, '-unknown-linux-')
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0
- name: Install dependencies
working-directory: bindings/nodejs
run: pnpm install
- name: build
working-directory: bindings/nodejs
shell: bash
env:
NAPI_TARGET: ${{ matrix.target }}
MACOSX_DEPLOYMENT_TARGET: 10.12
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
pnpm napi build --platform --target=$NAPI_TARGET --js generated.js
else
pnpm napi build --platform --target=$NAPI_TARGET --release --js generated.js
fi
pnpm node ./scripts/header.js
- name: strip for macos
if: endsWith(matrix.target, '-apple-darwin')
working-directory: bindings/nodejs
run: |
strip -x *.node
- uses: actions/upload-artifact@v4
with:
name: bindings-nodejs-${{ matrix.target }}
path: bindings/nodejs/*.node
integration:
name: integration-${{ matrix.ver }}
needs: build
runs-on: ubuntu-latest
env:
COMPOSE_PARALLEL_LIMIT: "1"
strategy:
matrix:
ver: ["18", "20", "22"]
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.ver }}
- name: Install dependencies
working-directory: bindings/nodejs
run: pnpm install
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
name: bindings-nodejs-x86_64-unknown-linux-gnu
path: bindings/nodejs
- name: Resolve Databend version
id: databend-version
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(gh api repos/databendlabs/databend/releases --jq '[.[] | select(.draft | not) | select(.tag_name | endswith("-nightly"))][0].tag_name')
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Running integration tests with Databend version: **$version**" >> "$GITHUB_STEP_SUMMARY"
- run: make -C tests test-bindings-nodejs DATABEND_META_VERSION=${{ steps.databend-version.outputs.version }} DATABEND_QUERY_VERSION=${{ steps.databend-version.outputs.version }}