Skip to content

Commit e90ecdc

Browse files
committed
feat: support webp
1 parent 76361f9 commit e90ecdc

File tree

11 files changed

+1267
-1242
lines changed

11 files changed

+1267
-1242
lines changed

.github/workflows/CI.yml

Lines changed: 74 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,35 @@ jobs:
2525
settings:
2626
- host: macos-latest
2727
target: x86_64-apple-darwin
28-
architecture: x64
2928
build: |
3029
yarn build -- --features with_simd
3130
strip -x packages/*/*.node
3231
- host: windows-latest
3332
build: |
3433
yarn build -- --features with_simd
3534
target: x86_64-pc-windows-msvc
36-
architecture: x64
3735
- host: windows-latest
3836
build: |
3937
yarn build -- --features with_simd
4038
yarn test
4139
target: i686-pc-windows-msvc
42-
architecture: x86
4340
- host: ubuntu-latest
4441
target: x86_64-unknown-linux-gnu
4542
architecture: x64
46-
docker: |
47-
docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian
48-
docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian builder
43+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
4944
build: |
50-
docker run --env RUST_TARGET --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build -- --features with_simd && strip packages/*/*.node
45+
set -e && \
46+
yarn build -- --features with_simd --target x86_64-unknown-linux-gnu && \
47+
strip packages/*/*.node
5148
- host: ubuntu-latest
5249
target: x86_64-unknown-linux-musl
53-
architecture: x64
54-
docker: |
55-
docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine
56-
docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
57-
build: |
58-
docker run --env RUST_TARGET --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "unset RUSTFLAGS && unset CC && yarn build -- --features with_simd && strip packages/*/*.node"
50+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
51+
build: >-
52+
set -e &&
53+
unset RUSTFLAGS &&
54+
unset CC &&
55+
yarn build -- --features with_simd &&
56+
strip packages/*/*.node
5957
- host: macos-latest
6058
target: aarch64-apple-darwin
6159
build: |
@@ -103,24 +101,23 @@ jobs:
103101
architecture: x64
104102
target: aarch64-unknown-linux-musl
105103
downloadTarget: aarch64-unknown-linux-musl
106-
docker: |
107-
docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
108-
docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
109-
build: |
110-
docker run --env RUST_TARGET --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "yarn build -- --features with_simd && /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip packages/*/*.node"
104+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
105+
build: >-
106+
set -e &&
107+
yarn build -- --target aarch64-unknown-linux-musl --features with_simd &&
108+
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip packages/*/*.node
111109
name: stable - ${{ matrix.settings.target }} - node@16
112110
runs-on: ${{ matrix.settings.host }}
113111
env:
114112
RUST_TARGET: ${{ matrix.settings.target }}
115113
steps:
116-
- uses: actions/checkout@v2
114+
- uses: actions/checkout@v3
117115
- name: Setup node
118-
uses: actions/setup-node@v2
116+
uses: actions/setup-node@v3
119117
with:
120118
node-version: 16
121119
check-latest: true
122120
cache: yarn
123-
architecture: ${{ matrix.settings.architecture }}
124121
- name: Setup nasm
125122
uses: ilammy/setup-nasm@v1
126123
if: matrix.settings.target == 'x86_64-pc-windows-msvc' || matrix.settings.target == 'x86_64-apple-darwin'
@@ -131,38 +128,50 @@ jobs:
131128
override: true
132129
toolchain: stable
133130
target: ${{ matrix.settings.target }}
134-
- name: Generate Cargo.lock
135-
uses: actions-rs/cargo@v1
136-
with:
137-
command: generate-lockfile
138131
- name: Cache cargo registry
139-
uses: actions/cache@v2
132+
uses: actions/cache@v3
140133
with:
141-
path: ~/.cargo/registry
142-
key: ${{ matrix.settings.target }}-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
143-
- name: Cache cargo index
144-
uses: actions/cache@v2
145-
with:
146-
path: ~/.cargo/git
147-
key: ${{ matrix.settings.target }}-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
134+
path: |
135+
~/.cargo/registry/index/
136+
~/.cargo/registry/cache/
137+
~/.cargo/git/db/
138+
.cargo-cache/registry/index/
139+
.cargo-cache/registry/cache/
140+
.cargo-cache/git/db/
141+
target/
142+
key: ${{ matrix.settings.target }}-cargo-registry
148143
- name: Cache NPM dependencies
149-
uses: actions/cache@v2
144+
uses: actions/cache@v3
150145
with:
151146
path: node_modules
152147
key: npm-cache-${{ matrix.settings.target }}-node@16-${{ hashFiles('yarn.lock') }}
153-
- name: Pull latest image
154-
run: ${{ matrix.settings.docker }}
155-
env:
156-
DOCKER_REGISTRY_URL: ghcr.io
157-
if: ${{ matrix.settings.docker }}
158148
- name: Setup toolchain
159149
run: ${{ matrix.settings.setup }}
160150
if: ${{ matrix.settings.setup }}
161151
shell: bash
152+
- name: Setup node x86 install settings
153+
if: matrix.settings.target == 'i686-pc-windows-msvc'
154+
run: yarn config set supportedArchitectures.cpu --json '["x86", "x64"]'
155+
shell: bash
162156
- name: Install dependencies
163-
run: yarn install
157+
run: yarn install --immutable --mode=skip-build
158+
- name: Setup node x86
159+
uses: actions/setup-node@v3
160+
if: matrix.settings.target == 'i686-pc-windows-msvc'
161+
with:
162+
node-version: 16
163+
check-latest: true
164+
architecture: x86
165+
- name: Build in docker
166+
uses: addnab/docker-run-action@v3
167+
if: ${{ matrix.settings.docker }}
168+
with:
169+
image: ${{ matrix.settings.docker }}
170+
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/root/.cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/root/.cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/root/.cargo/registry/index -v ${{ github.workspace }}:/build -w /build
171+
run: ${{ matrix.settings.build }}
164172
- name: Build
165173
run: ${{ matrix.settings.build }}
174+
if: ${{ !matrix.settings.docker }}
166175
shell: bash
167176
- name: Upload artifact
168177
uses: actions/upload-artifact@v2
@@ -174,10 +183,10 @@ jobs:
174183
runs-on: macos-10.15
175184
name: Build FreeBSD
176185
steps:
177-
- uses: actions/checkout@v2
186+
- uses: actions/checkout@v3
178187
- name: Build
179188
id: build
180-
uses: vmactions/freebsd-vm@v0.1.5
189+
uses: vmactions/freebsd-vm@v0.1.6
181190
env:
182191
DEBUG: napi:*
183192
RUSTUP_HOME: /usr/local/rustup
@@ -208,7 +217,7 @@ jobs:
208217
whoami
209218
env
210219
freebsd-version
211-
yarn install
220+
yarn install --immutable --mode=skip-build
212221
yarn build -- --features with_simd
213222
strip -x packages/*/*.node
214223
yarn test
@@ -236,20 +245,20 @@ jobs:
236245
- '17'
237246
runs-on: ${{ matrix.settings.host }}
238247
steps:
239-
- uses: actions/checkout@v2
248+
- uses: actions/checkout@v3
240249
- name: Setup node
241-
uses: actions/setup-node@v2
250+
uses: actions/setup-node@v3
242251
with:
243252
node-version: ${{ matrix.node }}
244253
check-latest: true
245254
cache: yarn
246255
- name: Cache NPM dependencies
247-
uses: actions/cache@v2
256+
uses: actions/cache@v3
248257
with:
249258
path: node_modules
250259
key: npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
251260
- name: Install dependencies
252-
run: yarn install
261+
run: yarn install --immutable --mode=skip-build
253262
- name: Download artifacts
254263
uses: actions/download-artifact@v2
255264
with:
@@ -276,20 +285,20 @@ jobs:
276285
- '17'
277286
runs-on: ubuntu-latest
278287
steps:
279-
- uses: actions/checkout@v2
288+
- uses: actions/checkout@v3
280289
- name: Setup node
281-
uses: actions/setup-node@v2
290+
uses: actions/setup-node@v3
282291
with:
283292
node-version: ${{ matrix.node }}
284293
check-latest: true
285294
cache: yarn
286295
- name: Cache NPM dependencies
287-
uses: actions/cache@v2
296+
uses: actions/cache@v3
288297
with:
289298
path: node_modules
290299
key: npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
291300
- name: Install dependencies
292-
run: yarn install
301+
run: yarn install --immutable --mode=skip-build
293302
- name: Download artifacts
294303
uses: actions/download-artifact@v2
295304
with:
@@ -316,20 +325,20 @@ jobs:
316325
- '17'
317326
runs-on: ubuntu-latest
318327
steps:
319-
- uses: actions/checkout@v2
328+
- uses: actions/checkout@v3
320329
- name: Setup node
321-
uses: actions/setup-node@v2
330+
uses: actions/setup-node@v3
322331
with:
323332
node-version: ${{ matrix.node }}
324333
check-latest: true
325334
cache: yarn
326335
- name: Cache NPM dependencies
327-
uses: actions/cache@v2
336+
uses: actions/cache@v3
328337
with:
329338
path: node_modules
330339
key: npm-cache-test-x86_64-unknown-linux-musl-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
331340
- name: Install dependencies
332-
run: yarn install
341+
run: yarn install --immutable --mode=skip-build
333342
- name: Download artifacts
334343
uses: actions/download-artifact@v2
335344
with:
@@ -357,19 +366,19 @@ jobs:
357366
runs-on: ubuntu-latest
358367
steps:
359368
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
360-
- uses: actions/checkout@v2
369+
- uses: actions/checkout@v3
361370
- name: Download artifacts
362371
uses: actions/download-artifact@v2
363372
with:
364373
name: bindings-aarch64-unknown-linux-gnu
365374
path: artifacts
366375
- name: Cache NPM dependencies
367-
uses: actions/cache@v2
376+
uses: actions/cache@v3
368377
with:
369378
path: node_modules
370379
key: npm-cache-test-linux-aarch64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
371380
- name: Install dependencies
372-
run: yarn install
381+
run: yarn install --immutable --mode=skip-build
373382
- name: Move artifacts
374383
run: yarn artifacts
375384
shell: bash
@@ -399,19 +408,19 @@ jobs:
399408
runs-on: ubuntu-latest
400409
steps:
401410
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
402-
- uses: actions/checkout@v2
411+
- uses: actions/checkout@v3
403412
- name: Download artifacts
404413
uses: actions/download-artifact@v2
405414
with:
406415
name: bindings-armv7-unknown-linux-gnueabihf
407416
path: artifacts
408417
- name: Cache NPM dependencies
409-
uses: actions/cache@v2
418+
uses: actions/cache@v3
410419
with:
411420
path: node_modules
412421
key: npm-cache-test-linux-arm-gnueabihf-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
413422
- name: Install dependencies
414-
run: yarn install
423+
run: yarn install --immutable --mode=skip-build
415424
- name: Move artifacts
416425
run: yarn artifacts
417426
shell: bash
@@ -438,22 +447,22 @@ jobs:
438447
- test-linux-aarch64-gnu-binding
439448
- test-linux-arm-gnueabihf-binding
440449
steps:
441-
- uses: actions/checkout@v2
450+
- uses: actions/checkout@v3
442451
- name: Setup node
443-
uses: actions/setup-node@v2
452+
uses: actions/setup-node@v3
444453
with:
445454
node-version: 16
446455
check-latest: true
447456
cache: yarn
448457
- name: Cache NPM dependencies
449-
uses: actions/cache@v2
458+
uses: actions/cache@v3
450459
with:
451460
path: node_modules
452461
key: npm-cache-ubuntu-latest-${{ hashFiles('yarn.lock') }}
453462
restore-keys: |
454463
npm-cache-
455464
- name: Install dependencies
456-
run: yarn install
465+
run: yarn install --immutable --mode=skip-build
457466
- name: Download all artifacts
458467
uses: actions/download-artifact@v2
459468
with:

.yarn/releases/yarn-3.1.1.cjs

Lines changed: 0 additions & 768 deletions
This file was deleted.

0 commit comments

Comments
 (0)