diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 9a15cfee..3d222678 100755 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -21,7 +21,6 @@ env: - 'example/*.png' pull_request: null - jobs: build: if: "!contains(github.event.head_commit.message, 'skip ci')" @@ -42,11 +41,11 @@ jobs: yarn build --target i686-pc-windows-msvc yarn test target: i686-pc-windows-msvc - architecture: x86 - host: ubuntu-latest target: x86_64-unknown-linux-gnu docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian - build: >- + # Rust nightly 需要 rustup target add … + build: |- set -e && rustup target add x86_64-unknown-linux-gnu && yarn build --target x86_64-unknown-linux-gnu && @@ -54,7 +53,7 @@ jobs: - host: ubuntu-latest target: x86_64-unknown-linux-musl docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine - build: >- + build: |- set -e && yarn build && llvm-strip -x *.node @@ -71,7 +70,7 @@ jobs: - host: ubuntu-latest target: aarch64-unknown-linux-gnu docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 - build: >- + build: |- set -e && rustup target add aarch64-unknown-linux-gnu && yarn build --target aarch64-unknown-linux-gnu && @@ -80,34 +79,24 @@ jobs: target: armv7-unknown-linux-gnueabihf setup: | sudo apt-get update - sudo apt-get install gcc-arm-linux-gnueabihf -y + sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y build: | - yarn build --target armv7-unknown-linux-gnueabihf + yarn build --target=armv7-unknown-linux-gnueabihf arm-linux-gnueabihf-strip *.node - host: ubuntu-latest target: aarch64-linux-android build: | - export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang" - export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang" - export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++" - export AR="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" - export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}" yarn build --target aarch64-linux-android - ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node + ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node - host: ubuntu-latest target: armv7-linux-androideabi build: | - export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang" - export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang" - export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++" - export AR="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" - export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}" yarn build --target armv7-linux-androideabi - ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node + ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node - host: ubuntu-latest target: aarch64-unknown-linux-musl docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine - build: >- + build: |- set -e && rustup target add aarch64-unknown-linux-musl && yarn build --target aarch64-unknown-linux-musl && @@ -115,51 +104,40 @@ jobs: - host: windows-latest target: aarch64-pc-windows-msvc build: yarn build --target aarch64-pc-windows-msvc - name: stable - ${{ matrix.settings.target }} - node@16 + name: stable - ${{ matrix.settings.target }} - node@18 runs-on: ${{ matrix.settings.host }} steps: - uses: actions/checkout@v4 - name: Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 if: ${{ !matrix.settings.docker }} with: - node-version: 16 - check-latest: true + node-version: 18 cache: yarn - # architecture: ${{ matrix.settings.architecture }} - name: Install - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master if: ${{ !matrix.settings.docker }} with: - profile: minimal - override: true - toolchain: stable - target: ${{ matrix.settings.target }} - # - name: Generate Cargo.lock - # uses: actions-rs/cargo@v1 - # if: ${{ !matrix.settings.docker }} - # with: - # command: generate-lockfile + toolchain: nightly-2023-12-11 + targets: ${{ matrix.settings.target }} - name: Cache cargo - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - .cargo-cache/registry/index/ - .cargo-cache/registry/cache/ - .cargo-cache/git/db/ + .cargo-cache target/ key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} - - uses: goto-bus-stop/setup-zig@v2 - if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} - with: - version: 0.10.0 - name: Setup toolchain run: ${{ matrix.settings.setup }} if: ${{ matrix.settings.setup }} shell: bash + - uses: goto-bus-stop/setup-zig@v2 + if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} + with: + version: 0.11.0 - name: Setup node x86 if: matrix.settings.target == 'i686-pc-windows-msvc' run: yarn config set supportedArchitectures.cpu "ia32" @@ -167,28 +145,26 @@ jobs: - name: Install dependencies run: yarn install - name: Setup node x86 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 if: matrix.settings.target == 'i686-pc-windows-msvc' with: - node-version: 16 - check-latest: true + node-version: 18 cache: yarn architecture: x86 - - name: Build in docker uses: addnab/docker-run-action@v3 if: ${{ matrix.settings.docker }} with: image: ${{ matrix.settings.docker }} - 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 + 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' run: ${{ matrix.settings.build }} - name: Build run: ${{ matrix.settings.build }} if: ${{ !matrix.settings.docker }} shell: bash - - name: Upload artifacts - uses: actions/upload-artifact@v3 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: bindings-${{ matrix.settings.target }} path: ${{ env.APP_NAME }}.*.node @@ -210,10 +186,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - check-latest: true - name: Install uses: actions-rs/toolchain@v1 @@ -241,10 +216,12 @@ jobs: run: yarn test:wasm - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: wasm32 path: wasm/dist/*.wasm + if-no-files-found: error + overwrite: true - name: List packages run: | @@ -270,20 +247,14 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - check-latest: true cache: yarn - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }} - name: Install dependencies run: yarn install - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: bindings-${{ matrix.settings.target }} path: . @@ -307,20 +278,14 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - check-latest: true cache: yarn - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-test-linux-x64-gnu-${{ matrix.node }} - name: Install dependencies run: yarn install - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: bindings-x86_64-unknown-linux-gnu path: . @@ -344,22 +309,16 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - check-latest: true cache: yarn - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-test-x86_64-unknown-linux-musl-${{ matrix.node }} - name: Install dependencies run: | yarn config set supportedArchitectures.libc "musl" yarn install - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: bindings-x86_64-unknown-linux-musl path: . @@ -381,31 +340,30 @@ jobs: - '20' runs-on: ubuntu-latest steps: - - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: bindings-aarch64-unknown-linux-gnu path: . - name: List packages run: ls -R . shell: bash - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-test-linux-aarch64-gnu-${{ matrix.node }} - name: Install dependencies run: | yarn config set supportedArchitectures.cpu "arm64" yarn config set supportedArchitectures.libc "glibc" yarn install + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - name: Setup and run tests uses: addnab/docker-run-action@v3 with: - image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }} - options: '-v /usr/share/fonts:/usr/share/fonts -v ${{ github.workspace }}:/build -w /build' + image: node:${{ matrix.node }}-slim + options: '--platform linux/arm64 -v /usr/share/fonts:/usr/share/fonts -v ${{ github.workspace }}:/build -w /build' run: | set -e find /usr/share/fonts -name *.ttf @@ -415,37 +373,42 @@ jobs: name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }} needs: - build + strategy: + fail-fast: false + matrix: + node: + - '16' + - '18' + - '20' runs-on: ubuntu-latest steps: - - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: bindings-aarch64-unknown-linux-musl path: . - name: List packages run: ls -R . shell: bash - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-test-linux-aarch64-musl-${{ matrix.node }} - name: Install dependencies run: | yarn config set supportedArchitectures.cpu "arm64" yarn config set supportedArchitectures.libc "musl" yarn install + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - name: Setup and run tests uses: addnab/docker-run-action@v3 with: - image: multiarch/alpine:aarch64-latest-stable - options: '-v /usr/share/fonts:/usr/share/fonts -v ${{ github.workspace }}:/build -w /build' + image: node:${{ matrix.node }}-alpine + options: '--platform linux/arm64 -v /usr/share/fonts:/usr/share/fonts -v ${{ github.workspace }}:/build -w /build' run: | set -e find /usr/share/fonts -name *.ttf - apk add nodejs npm yarn yarn test test-linux-arm-gnueabihf-binding: name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }} @@ -460,30 +423,29 @@ jobs: - '20' runs-on: ubuntu-latest steps: - - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: bindings-armv7-unknown-linux-gnueabihf path: . - name: List packages run: ls -R . shell: bash - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-test-linux-arm-gnueabihf-${{ matrix.node }} - name: Install dependencies run: | yarn config set supportedArchitectures.cpu "arm" yarn install + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm + - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - name: Setup and run tests uses: addnab/docker-run-action@v3 with: - image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-${{ matrix.node }} - options: '-v /usr/share/fonts:/usr/share/fonts -v ${{ github.workspace }}:/build -w /build' + image: node:${{ matrix.node }}-bullseye-slim + options: '--platform linux/arm/v7 -v /usr/share/fonts:/usr/share/fonts -v ${{ github.workspace }}:/build -w /build' run: | set -e find /usr/share/fonts -name *.ttf @@ -504,22 +466,15 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 18 check-latest: true cache: yarn - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-ubuntu-latest-publish - restore-keys: | - npm-cache- - name: Install dependencies run: yarn install - name: Download all artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: artifacts - name: List artifacts diff --git a/Cargo.toml b/Cargo.toml index a5b8e725..48cfc4b9 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ thiserror = "1.0.37" png = "=0.17.5" pathfinder_geometry = "0.5.1" pathfinder_content = { version = "0.5.0", default-features = false } -pathfinder_simd = { version = "0.5.1", features = ["pf-no-simd"] } +pathfinder_simd = { version = "0.5.2", features = ["pf-no-simd"] } futures = "0.3.21" woff2 = "0.3.0" diff --git a/rust-toolchain b/rust-toolchain index d6ab1143..12ab2163 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2023-02-01 +nightly-2023-12-11