From e1864d68ff0ec1e6c31a497530953fc160c8e198 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 9 Dec 2022 17:29:03 +0800 Subject: [PATCH] ci: upgrade toolchain (#1382) --- .cirrus.yml | 4 ++-- .github/workflows/android-armv7.yml | 10 ++------- .github/workflows/android.yml | 8 +------ .github/workflows/bench.yaml | 8 +------ .github/workflows/cli-binary.yml | 4 ++-- .github/workflows/lint.yaml | 8 +------ .github/workflows/linux-aarch64-musl.yaml | 10 ++------- .github/workflows/linux-aarch64.yaml | 18 ++++++---------- .github/workflows/linux-armv7.yaml | 25 ++++++++-------------- .github/workflows/linux-musl.yaml | 4 ++-- .github/workflows/memory-test.yml | 26 ++++++++++++----------- .github/workflows/msrv.yml | 10 ++------- .github/workflows/test.yaml | 6 ------ .github/workflows/windows-arm.yml | 10 ++------- .github/workflows/windows-i686.yml | 10 ++------- .github/workflows/zig.yaml | 21 +++++------------- 16 files changed, 53 insertions(+), 129 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 2e6a8516..44e75a71 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -35,7 +35,7 @@ build_and_test: &BUILD_AND_TEST freebsd_task: name: FreeBSD freebsd_instance: - image: freebsd-13-0-release-amd64 + image: freebsd-13-1-release-amd64 env: RUSTUP_HOME: /usr/local/rustup CARGO_HOME: /usr/local/cargo @@ -43,7 +43,7 @@ freebsd_task: RUSTUP_IO_THREADS: '1' setup_script: - pkg update - - pkg install -y -f curl node16 libnghttp2 + - pkg install -y -f curl node libnghttp2 <<: *BUILD_AND_TEST macos_arm64_task: diff --git a/.github/workflows/android-armv7.yml b/.github/workflows/android-armv7.yml index 0a18ff1e..f8d0c569 100644 --- a/.github/workflows/android-armv7.yml +++ b/.github/workflows/android-armv7.yml @@ -19,7 +19,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: 'yarn' check-latest: true @@ -41,13 +41,7 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: stable-linux-android-armv7-node@16-cargo-cache - - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-linux-android-node@16 + key: stable-linux-android-armv7-node@18-cargo-cache - name: Install dependencies run: yarn install --immutable --mode=skip-build diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index c11c8160..71c5087e 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -19,7 +19,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: 'yarn' check-latest: true @@ -43,12 +43,6 @@ jobs: target key: stable-linux-android-node@16-cargo-cache - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-linux-android-node@16 - - name: Install dependencies run: yarn install --immutable --mode=skip-build diff --git a/.github/workflows/bench.yaml b/.github/workflows/bench.yaml index a31a811c..5269a332 100644 --- a/.github/workflows/bench.yaml +++ b/.github/workflows/bench.yaml @@ -21,7 +21,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' @@ -41,12 +41,6 @@ jobs: target key: bench-cargo-cache - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: bench-yarn-cache - - name: 'Install dependencies' run: yarn install --immutable --mode=skip-build diff --git a/.github/workflows/cli-binary.yml b/.github/workflows/cli-binary.yml index 278d0d75..04cdc714 100644 --- a/.github/workflows/cli-binary.yml +++ b/.github/workflows/cli-binary.yml @@ -19,7 +19,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' @@ -54,7 +54,7 @@ jobs: - name: Pass -p and --cargo-name to build run: | - node ./cli/scripts/index.js build -p napi-examples-binary --cargo-name napi-examples-binary + node ./cli/scripts/index.js build -p napi-examples-binary --cargo-name napi-examples-binary ./napi-examples-binary env: RUST_BACKTRACE: 1 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 8adc3bec..6ca0352a 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,7 +17,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' @@ -37,12 +37,6 @@ jobs: ~/.cargo/git key: lint-cargo-cache - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: lint-yarn-cache - - name: 'Install dependencies' run: yarn install --immutable --mode=skip-build diff --git a/.github/workflows/linux-aarch64-musl.yaml b/.github/workflows/linux-aarch64-musl.yaml index 82823a0c..8aa4c653 100644 --- a/.github/workflows/linux-aarch64-musl.yaml +++ b/.github/workflows/linux-aarch64-musl.yaml @@ -11,7 +11,7 @@ on: jobs: build: - name: stable - aarch64-unknown-linux-gnu - node@16 + name: stable - aarch64-unknown-linux-gnu - node@18 runs-on: ubuntu-latest steps: @@ -22,16 +22,10 @@ jobs: - name: Setup node uses: actions/setup-node@v3 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-linux-aarch64-gnu-node@16 - - name: Install dependencies run: yarn install --immutable --mode=skip-build diff --git a/.github/workflows/linux-aarch64.yaml b/.github/workflows/linux-aarch64.yaml index 5912932b..3e0b27e7 100644 --- a/.github/workflows/linux-aarch64.yaml +++ b/.github/workflows/linux-aarch64.yaml @@ -2,7 +2,7 @@ name: Linux-aarch64 env: DEBUG: 'napi:*' - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: 'aarch64-linux-gnu-gcc' + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: 'aarch64-linux-gnu-gcc-9' on: push: @@ -12,7 +12,7 @@ on: jobs: build: - name: stable - aarch64-unknown-linux-gnu - node@16 + name: stable - aarch64-unknown-linux-gnu - node@18 runs-on: ubuntu-latest steps: @@ -23,7 +23,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' @@ -43,16 +43,10 @@ jobs: ~/.cargo/git key: stable-linux-aarch64-gnu-node@16-cargo-cache - - name: Cache NPM dependencies - uses: actions/cache@v3 + - name: Install ziglang + uses: goto-bus-stop/setup-zig@v2 with: - path: .yarn/cache - key: npm-cache-linux-aarch64-gnu-node@16 - - - name: Install cross compile toolchain - run: | - sudo apt-get update - sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y + version: 0.10.0 - name: Install dependencies run: yarn install --immutable --mode=skip-build diff --git a/.github/workflows/linux-armv7.yaml b/.github/workflows/linux-armv7.yaml index 2a939465..cad3299e 100644 --- a/.github/workflows/linux-armv7.yaml +++ b/.github/workflows/linux-armv7.yaml @@ -2,7 +2,6 @@ name: Linux-armv7 env: DEBUG: 'napi:*' - CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: 'arm-linux-gnueabihf-gcc' on: push: @@ -12,7 +11,7 @@ on: jobs: build: - name: stable - armv7-unknown-linux-gnu - node@16 + name: stable - armv7-unknown-linux-gnu - node@18 runs-on: ubuntu-latest steps: @@ -23,7 +22,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' @@ -35,25 +34,19 @@ jobs: override: true target: armv7-unknown-linux-gnueabihf + - name: Install ziglang + uses: goto-bus-stop/setup-zig@v2 + with: + version: 0.10.0 + - name: Cache cargo - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.cargo/registry ~/.cargo/git target - key: stable-linux-armv7-gnu-node@16-cargo-cache - - - name: Cache NPM dependencies - uses: actions/cache@v2 - with: - path: node_modules - key: npm-cache-linux-armv7-gnu-node@16-${{ hashFiles('yarn.lock') }} - - - name: Install cross compile toolchain - run: | - sudo apt-get update - sudo apt-get install gcc-arm-linux-gnueabihf -y + key: stable-linux-armv7-gnu-node@18-cargo-cache - name: Install dependencies run: yarn install --immutable --mode=skip-build diff --git a/.github/workflows/linux-musl.yaml b/.github/workflows/linux-musl.yaml index c1ef8a20..2f73cd83 100644 --- a/.github/workflows/linux-musl.yaml +++ b/.github/workflows/linux-musl.yaml @@ -11,7 +11,7 @@ on: jobs: build: - name: stable - x86_64-unknown-linux-musl - node@lts + name: stable - x86_64-unknown-linux-musl - node@18 runs-on: ubuntu-latest steps: @@ -20,7 +20,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' diff --git a/.github/workflows/memory-test.yml b/.github/workflows/memory-test.yml index da193868..43892816 100644 --- a/.github/workflows/memory-test.yml +++ b/.github/workflows/memory-test.yml @@ -20,7 +20,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' @@ -35,17 +35,15 @@ jobs: uses: actions/cache@v3 with: path: | - ~/.cargo/registry - ~/.cargo/git - target + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + .cargo-cache/registry/index/ + .cargo-cache/registry/cache/ + .cargo-cache/git/db/ + target/ key: stable-memory-leak-detect-cargo-cache - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: memory-leak-detect - - name: 'Install dependencies' run: yarn install --immutable @@ -55,8 +53,12 @@ jobs: - name: 'Pull docker image' run: docker pull node:lts-slim - - name: 'Build memory test specs' - run: yarn build:memory + - name: Build in docker + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian + 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: yarn build:memory - name: Memory leak tests run: yarn test:memory diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml index b5aa5e74..7c850c2e 100644 --- a/.github/workflows/msrv.yml +++ b/.github/workflows/msrv.yml @@ -11,7 +11,7 @@ on: jobs: test-msrv-rust: - name: 1.57.0 - ubuntu-latest - node@16 + name: 1.57.0 - ubuntu-latest - node@18 runs-on: ubuntu-latest steps: @@ -20,7 +20,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' @@ -39,12 +39,6 @@ jobs: ~/.cargo/git key: stable-ubuntu-latest-node@16-cargo-cache - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-ubuntu-latest-node@16 - - name: 'Install dependencies' run: yarn install --mode=skip-build --immutable diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ffd44074..c08a34a7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -47,12 +47,6 @@ jobs: target key: stable-${{ matrix.os }}-node@${{ matrix.node }}-cargo-cache - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-${{ matrix.os }}-node@${{ matrix.node }} - - name: 'Install dependencies' run: yarn install --mode=skip-build --immutable diff --git a/.github/workflows/windows-arm.yml b/.github/workflows/windows-arm.yml index 502f29f0..a366d306 100644 --- a/.github/workflows/windows-arm.yml +++ b/.github/workflows/windows-arm.yml @@ -11,7 +11,7 @@ on: jobs: build_and_test: - name: stable - windows-latest - arm64 - node@16 + name: stable - windows-latest - arm64 - node@18 runs-on: windows-latest steps: @@ -20,7 +20,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' @@ -38,12 +38,6 @@ jobs: override: true target: aarch64-pc-windows-msvc - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-windows-aarch64-msvc-node@16 - - name: Cache cargo uses: actions/cache@v3 with: diff --git a/.github/workflows/windows-i686.yml b/.github/workflows/windows-i686.yml index 0acb1219..b87e5c9b 100644 --- a/.github/workflows/windows-i686.yml +++ b/.github/workflows/windows-i686.yml @@ -11,7 +11,7 @@ on: jobs: build_and_test: - name: stable - windows-latest - i686 - node@16 + name: stable - windows-latest - i686 - node@18 runs-on: windows-latest steps: @@ -20,17 +20,11 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true architecture: 'x64' cache: 'yarn' - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-windows-i686-msvc-node@16 - - name: 'Install dependencies' run: | yarn install --mode=skip-build --immutable diff --git a/.github/workflows/zig.yaml b/.github/workflows/zig.yaml index 48d5bdd2..d3223064 100644 --- a/.github/workflows/zig.yaml +++ b/.github/workflows/zig.yaml @@ -29,7 +29,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 check-latest: true cache: 'yarn' - name: Install @@ -50,14 +50,9 @@ jobs: - name: Install aarch64 toolchain run: rustup target add aarch64-unknown-linux-gnu - name: Install ziglang - uses: goto-bus-stop/setup-zig@v1 + uses: goto-bus-stop/setup-zig@v2 with: version: 0.10.0 - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: .yarn/cache - key: npm-cache-ubuntu-latest-gnu-node@16 - name: Install dependencies run: yarn install --immutable --mode=skip-build - name: 'Build TypeScript' @@ -67,19 +62,18 @@ jobs: with: # Testing for compatibility with node v12.x node-version: 12 - check-latest: true - name: Cross build native tests run: | yarn workspace compat-mode-examples build --target ${{ matrix.target }} --zig yarn workspace examples build --target ${{ matrix.target }} --zig - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: compat-${{ matrix.target }} path: ./examples/napi-compat-mode/index.node if-no-files-found: error - name: Upload artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: napi-${{ matrix.target }} path: ./examples/napi/index.node @@ -108,14 +102,9 @@ jobs: - name: Setup node uses: actions/setup-node@v3 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-${{ matrix.settings.host }}-node@16 - name: Install dependencies run: yarn install --immutable --mode=skip-build - name: Download artifacts