-
Notifications
You must be signed in to change notification settings - Fork 189
201 lines (194 loc) · 6.72 KB
/
javascript.yml
File metadata and controls
201 lines (194 loc) · 6.72 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: JavaScript
env:
DEBUG: napi:*
APP_NAME: adbc-driver-manager
MACOSX_DEPLOYMENT_TARGET: '10.15'
CARGO_INCREMENTAL: '1'
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'javascript/**'
- 'rust/**'
- '.github/workflows/javascript.yml'
pull_request:
paths:
- 'javascript/**'
- 'rust/**'
- '.github/workflows/javascript.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 22
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
- name: Use stable Rust
run: |
rustup toolchain install stable --no-self-update
rustup default stable
rustup component add clippy rustfmt
- name: Install dependencies
working-directory: javascript
run: npm ci
- name: Verify package-lock.json is up to date
working-directory: javascript
run: |
npm install --package-lock-only
git diff --exit-code package-lock.json
- name: Check JS
working-directory: javascript
run: npm run check:js
- name: Check Rust
working-directory: javascript
run: npm run check:rust
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-15-intel
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
name: Build Node.js ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 22
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
- name: Use stable Rust
run: |
rustup toolchain install stable --no-self-update
rustup default stable
rustup target add ${{ matrix.settings.target }}
- name: Install dependencies
working-directory: javascript
run: npm ci
- name: Build
working-directory: javascript
shell: bash
run: npm run build:ci -- --target ${{ matrix.settings.target }} && npm run build:ts
- name: Ad-hoc sign binary (macOS)
if: runner.os == 'macOS'
working-directory: javascript
run: codesign --sign - *.node
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: bindings-${{ matrix.settings.target }}
path: javascript/*.node
if-no-files-found: error
test:
name: Test ${{ matrix.settings.target }}
needs: build
runs-on: ${{ matrix.settings.host }}
strategy:
fail-fast: false
matrix:
settings:
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
- host: macos-15-intel
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 22
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
- name: Install dependencies
working-directory: javascript
run: npm ci --omit=optional
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: bindings-${{ matrix.settings.target }}
path: javascript
- name: Setup conda (Windows)
if: runner.os == 'Windows'
uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
- name: Install C++ dependencies (Windows)
if: runner.os == 'Windows'
run: conda install -c conda-forge --file ci/conda_env_cpp.txt
- name: Install C++ dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install libsqlite3-dev
- name: Set cmake args (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: echo "ADBC_CMAKE_ARGS=-DCMAKE_PREFIX_PATH=$env:CONDA_PREFIX/Library" >> $env:GITHUB_ENV
- name: Build Driver
# We need to build the SQLite driver for tests.
shell: bash
run: ci/scripts/node_build.sh "${{ github.workspace }}/javascript/build"
- name: Set driver path (Linux)
if: runner.os == 'Linux'
run: echo "ADBC_DRIVER_MANAGER_TEST_LIB=${{ github.workspace }}/javascript/build/lib/libadbc_driver_sqlite.so" >> "$GITHUB_ENV"
- name: Set driver path (macOS)
if: runner.os == 'macOS'
run: echo "ADBC_DRIVER_MANAGER_TEST_LIB=${{ github.workspace }}/javascript/build/lib/libadbc_driver_sqlite.dylib" >> "$GITHUB_ENV"
- name: Set driver path (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
echo "PATH=${{ github.workspace }}/javascript/build/bin;$env:CONDA_PREFIX\Library\bin;$env:PATH" >> $env:GITHUB_ENV
echo "ADBC_DRIVER_MANAGER_TEST_LIB=${{ github.workspace }}/javascript/build/bin/adbc_driver_sqlite.dll" >> $env:GITHUB_ENV
- name: Run Tests
working-directory: javascript
run: npm test