1
1
name : CI
2
2
env :
3
- DEBUG : napi:*
3
+ DEBUG : ' napi:*'
4
4
APP_NAME : fastembed
5
5
MACOSX_DEPLOYMENT_TARGET : ' 10.13'
6
6
permissions :
@@ -33,76 +33,98 @@ jobs:
33
33
target : x86_64-pc-windows-msvc
34
34
- host : ubuntu-latest
35
35
target : x86_64-unknown-linux-gnu
36
- docker : ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
36
+ docker : ' ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian'
37
37
build : yarn build --target x86_64-unknown-linux-gnu
38
38
- host : macos-latest
39
39
target : aarch64-apple-darwin
40
40
build : yarn build --target aarch64-apple-darwin
41
- name : stable - ${{ matrix.settings.target }} - node@20
42
- runs-on : ${{ matrix.settings.host }}
41
+ name : ' stable - ${{ matrix.settings.target }} - node@20'
42
+ runs-on : ' ${{ matrix.settings.host }}'
43
43
steps :
44
44
- uses : actions/checkout@v4
45
- - name : Setup node
46
- uses : actions/setup-node@v4
47
- if : ${{ !matrix.settings.docker }}
48
- with :
49
- node-version : 20
50
- cache : yarn
51
- - name : Install
52
- uses : dtolnay/rust-toolchain@stable
53
- if : ${{ !matrix.settings.docker }}
54
- with :
55
- toolchain : stable
56
- targets : ${{ matrix.settings.target }}
57
- - name : Cache cargo
58
- uses : actions/cache@v4
45
+ - name : Restore Builds
46
+ id : cache-build-restore
47
+ uses : actions/cache/restore@v4
59
48
with :
49
+ key : ' ${{ runner.os }}-cargo-${{ hashFiles('' **/Cargo.lock'' ) }}'
60
50
path : |
51
+ ~/.cargo/bin/
61
52
~/.cargo/registry/index/
62
53
~/.cargo/registry/cache/
63
54
~/.cargo/git/db/
64
- .cargo- cache
55
+ ~/. cache/ort.pyke.io
65
56
target/
66
- key : ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
67
- - uses : goto-bus-stop/setup-zig@v2
68
- if : ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' || matrix.settings.target == 'armv7-unknown-linux-musleabihf' }}
69
- with :
70
- version : 0.13.0
71
- - name : Setup toolchain
72
- run : ${{ matrix.settings.setup }}
73
- if : ${{ matrix.settings.setup }}
74
- shell : bash
75
- - name : Setup node x86
76
- if : matrix.settings.target == 'i686-pc-windows-msvc'
77
- run : yarn config set supportedArchitectures.cpu "ia32"
78
- shell : bash
79
- - name : Install dependencies
80
- run : yarn install
81
- - name : Setup node x86
57
+ /onnxruntime/build/Windows/
58
+ - name : Setup node
82
59
uses : actions/setup-node@v4
83
- if : matrix.settings.target == 'i686-pc-windows-msvc '
60
+ if : ' ${{ ! matrix.settings.docker }} '
84
61
with :
85
62
node-version : 20
86
63
cache : yarn
87
- architecture : x86
88
- - name : Build in docker
64
+ - name : Install Rust
65
+ uses : dtolnay/rust-toolchain@stable
66
+ if : ' ${{ !matrix.settings.docker }}'
67
+ with :
68
+ toolchain : stable
69
+ targets : ' ${{ matrix.settings.target }}'
70
+ - name : Install dependencies
71
+ run : yarn install
72
+ - name : Build in Docker for Ubuntu
89
73
uses : addnab/docker-run-action@v3
90
- if : ${{ matrix.settings.docker }}
74
+ if : matrix.settings.host == 'ubuntu-latest'
91
75
with :
92
- image : ${{ matrix.settings.docker }}
93
- options : ' --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
94
- run : ${{ matrix.settings.build }}
95
- - name : Build
96
- run : ${{ matrix.settings.build }}
97
- if : ${{ !matrix.settings.docker }}
76
+ image : ' ${{ matrix.settings.docker }}'
77
+ options : >-
78
+ --user 0:0 -v ${{ github.workspace
79
+ }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{
80
+ github.workspace
81
+ }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{
82
+ github.workspace
83
+ }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{
84
+ github.workspace }}:/build -w /build
85
+ run : ' ${{ matrix.settings.build }}'
86
+ - name : Compile ONNX Runtime for Windows
87
+ if : matrix.settings.host == 'windows-latest'
88
+ run : >
89
+ git clone https://github.com/microsoft/onnxruntime --recursive
90
+ --branch v1.19.2 --single-branch --depth 1
91
+
92
+ cd onnxruntime
93
+
94
+ .\build.bat --update --build --config Release --parallel
95
+ --compile_no_warning_as_error --skip_submodule_sync
96
+
97
+ cd ..
98
+ - name : Build with ORT_LIB_LOCATION for Windows
99
+ run : |
100
+ set ORT_LIB_LOCATION=%CD%\onnxruntime\build\Windows\Release
101
+ ${{ matrix.settings.build }}
102
+ if : matrix.settings.host == 'windows-latest'
103
+ - name : Build for MacOS
104
+ run : ' ${{ matrix.settings.build }}'
105
+ if : matrix.settings.host == 'macos-latest'
98
106
- name : Upload artifact
99
107
uses : actions/upload-artifact@v4
100
108
with :
101
- name : bindings-${{ matrix.settings.target }}
102
- path : ${{ env.APP_NAME }}.*.node
109
+ name : ' bindings-${{ matrix.settings.target }}'
110
+ path : ' ${{ env.APP_NAME }}.*.node'
103
111
if-no-files-found : error
112
+ - name : Always Save Cache
113
+ id : cache-build-save
114
+ if : always() && steps.cache-build-restore.outputs.cache-hit != 'true'
115
+ uses : actions/cache/save@v4
116
+ with :
117
+ key : ' ${{ steps.cache-build-restore.outputs.cache-primary-key }}'
118
+ path : |
119
+ ~/.cargo/bin/
120
+ ~/.cargo/registry/index/
121
+ ~/.cargo/registry/cache/
122
+ ~/.cargo/git/db/
123
+ ~/.cache/ort.pyke.io
124
+ target/
125
+ /onnxruntime/build/Windows/
104
126
test-macOS-windows-binding :
105
- name : Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
127
+ name : ' Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}'
106
128
needs :
107
129
- build
108
130
strategy :
@@ -116,29 +138,29 @@ jobs:
116
138
node :
117
139
- ' 18'
118
140
- ' 20'
119
- runs-on : ${{ matrix.settings.host }}
141
+ runs-on : ' ${{ matrix.settings.host }}'
120
142
steps :
121
143
- uses : actions/checkout@v4
122
144
- name : Setup node
123
145
uses : actions/setup-node@v4
124
146
with :
125
- node-version : ${{ matrix.node }}
147
+ node-version : ' ${{ matrix.node }}'
126
148
cache : yarn
127
149
architecture : x64
128
150
- name : Install dependencies
129
151
run : yarn install
130
152
- name : Download artifacts
131
153
uses : actions/download-artifact@v4
132
154
with :
133
- name : bindings-${{ matrix.settings.target }}
155
+ name : ' bindings-${{ matrix.settings.target }}'
134
156
path : .
135
157
- name : List packages
136
158
run : ls -R .
137
159
shell : bash
138
160
- name : Test bindings
139
161
run : yarn test
140
162
test-linux-x64-gnu-binding :
141
- name : Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
163
+ name : ' Test bindings on Linux-x64-gnu - node@${{ matrix.node }}'
142
164
needs :
143
165
- build
144
166
strategy :
@@ -153,7 +175,7 @@ jobs:
153
175
- name : Setup node
154
176
uses : actions/setup-node@v4
155
177
with :
156
- node-version : ${{ matrix.node }}
178
+ node-version : ' ${{ matrix.node }}'
157
179
cache : yarn
158
180
- name : Install dependencies
159
181
run : yarn install
@@ -166,7 +188,9 @@ jobs:
166
188
run : ls -R .
167
189
shell : bash
168
190
- name : Test bindings
169
- run : docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
191
+ run : >-
192
+ docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node
193
+ }}-slim yarn test
170
194
publish :
171
195
name : Publish
172
196
runs-on : ubuntu-latest
@@ -205,5 +229,5 @@ jobs:
205
229
echo "Not a release, skipping publish"
206
230
fi
207
231
env :
208
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
209
- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
232
+ GITHUB_TOKEN : ' ${{ secrets.GITHUB_TOKEN }}'
233
+ NPM_TOKEN : ' ${{ secrets.NPM_TOKEN }}'
0 commit comments