From 18620e2083ddd6962dba47e6fa4825251527c3c8 Mon Sep 17 00:00:00 2001 From: Miroslav Jonas Date: Fri, 14 Apr 2023 15:02:26 +0200 Subject: [PATCH] feat(repo): migrate nightly --- .github/workflows/e2e-matrix.yml | 19 +++++---- .github/workflows/e2e-windows.yml | 17 ++++++-- .github/workflows/issue-notifier.yml | 23 ++++++----- .github/workflows/publish.yml | 61 ++++++++++++++++++---------- scripts/check-imports.js | 2 +- 5 files changed, 77 insertions(+), 45 deletions(-) diff --git a/.github/workflows/e2e-matrix.yml b/.github/workflows/e2e-matrix.yml index 8c936d4396a3a0..f73d43a462cb7e 100644 --- a/.github/workflows/e2e-matrix.yml +++ b/.github/workflows/e2e-matrix.yml @@ -39,10 +39,15 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + with: + version: 8.2 + - name: Set node uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} + cache: 'pnpm' - name: Cache node_modules id: cache-modules @@ -54,7 +59,7 @@ jobs: - name: Install packages if: steps.cache-modules.outputs.cache-hit != 'true' - run: yarn install --prefer-offline --frozen-lockfile --non-interactive + run: pnpm install --frozen-lockfile - name: Homebrew cache directory path if: ${{ matrix.os == 'macos-latest' }} @@ -312,16 +317,15 @@ jobs: - name: Prepare dir for output run: mkdir -p outputs - - name: Install PNPM - if: ${{ matrix.package_manager == 'pnpm' }} - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v2 with: - version: 7.30.5 + version: 8.2 - - name: Use Node.js ${{ matrix.node_version }} + - name: Set node uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} + cache: 'pnpm' registry-url: http://localhost:4872 - name: Cache node_modules @@ -332,8 +336,7 @@ jobs: key: ${{ runner.os }}-modules-${{ matrix.node_version }}-${{ github.run_id }} - name: Install packages - if: steps.cache-modules.outputs.cache-hit != 'true' - run: yarn install --prefer-offline --frozen-lockfile --non-interactive + run: pnpm install --frozen-lockfile - name: Cleanup if: ${{ matrix.os == 'ubuntu-latest' }} diff --git a/.github/workflows/e2e-windows.yml b/.github/workflows/e2e-windows.yml index 44917687f170a4..373107e6212c14 100644 --- a/.github/workflows/e2e-windows.yml +++ b/.github/workflows/e2e-windows.yml @@ -30,10 +30,15 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + with: + version: 8.2 + - name: Set node uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} + cache: 'pnpm' - name: Cache node_modules id: cache-modules @@ -44,7 +49,7 @@ jobs: - name: Install packages if: steps.cache-modules.outputs.cache-hit != 'true' - run: yarn install --prefer-offline --frozen-lockfile --non-interactive + run: pnpm install --frozen-lockfile - name: Cache Cypress id: cache-cypress @@ -236,10 +241,15 @@ jobs: - name: Prepare dir for output run: mkdir -p outputs - - name: Use Node.js ${{ matrix.node_version }} + - uses: pnpm/action-setup@v2 + with: + version: 8.2 + + - name: Set node uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} + cache: 'pnpm' registry-url: http://localhost:4872 - name: Cache node_modules @@ -250,8 +260,7 @@ jobs: key: ${{ runner.os }}-modules-${{ matrix.node_version }}-${{ github.run_id }} - name: Install packages - if: steps.cache-modules.outputs.cache-hit != 'true' - run: yarn install --prefer-offline --frozen-lockfile --non-interactive + run: pnpm install --frozen-lockfile - name: Cache Cypress id: cache-cypress diff --git a/.github/workflows/issue-notifier.yml b/.github/workflows/issue-notifier.yml index b88c3c763397b2..725e5729d455df 100644 --- a/.github/workflows/issue-notifier.yml +++ b/.github/workflows/issue-notifier.yml @@ -18,24 +18,27 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node_version }} + - uses: pnpm/action-setup@v2 + with: + version: 8.2 + + - name: Set node uses: actions/setup-node@v3 with: node-version: '18' + cache: 'pnpm' + registry-url: http://localhost:4872 - - name: Yarn cache directory path - id: yarn-cache-dir-path - shell: bash - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - name: Cache yarn + - name: Cache node_modules + id: cache-modules uses: actions/cache@v3 with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-${{ hashFiles('yarn.lock') }} + lookup-only: true + path: '**/node_modules' + key: pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Install packages - run: yarn install --prefer-offline --frozen-lockfile --non-interactive + run: pnpm install --frozen-lockfile - name: Download artifact id: download-artifact diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5b1cbc6abdb1ee..5ed789b853fcca 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,9 +15,9 @@ jobs: - host: macos-latest target: x86_64-apple-darwin build: | - yarn nx -- run-many --target=build-native -- --target=x86_64-apple-darwin + pnpm nx -- run-many --target=build-native -- --target=x86_64-apple-darwin - host: windows-latest - build: yarn nx -- run-many --target=build-native -- --target=x86_64-pc-windows-msvc + build: pnpm nx -- run-many --target=build-native -- --target=x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc # Windows 32bit (not needed) # - host: windows-latest @@ -29,8 +29,8 @@ jobs: docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian build: |- set -e && - yarn --version && - yarn nx -- run-many --target=build-native -- --target=x86_64-unknown-linux-gnu + pnpm --version && + pnpm nx -- run-many --target=build-native -- --target=x86_64-unknown-linux-gnu - host: ubuntu-latest target: x86_64-unknown-linux-musl docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine @@ -43,56 +43,62 @@ jobs: export CXX=$(xcrun -f clang++); SYSROOT=$(xcrun --sdk macosx --show-sdk-path); export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; - yarn nx -- run-many --target=build-native -- --target=aarch64-apple-darwin + pnpm nx -- run-many --target=build-native -- --target=aarch64-apple-darwin - host: ubuntu-latest target: aarch64-unknown-linux-gnu docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 build: |- set -e && - yarn --version && - yarn nx -- run-many --target=build-native -- --target=aarch64-unknown-linux-gnu + pnpm --version && + pnpm nx -- run-many --target=build-native -- --target=aarch64-unknown-linux-gnu - host: ubuntu-latest target: armv7-unknown-linux-gnueabihf setup: | sudo apt-get update sudo apt-get install gcc-arm-linux-gnueabihf -y build: | - yarn nx -- run-many --target=build-native -- --target=armv7-unknown-linux-gnueabihf + pnpm nx -- run-many --target=build-native -- --target=armv7-unknown-linux-gnueabihf # Android (not needed) # - host: ubuntu-latest # target: aarch64-linux-android # build: | - # yarn nx -- run-many --target=build-native -- --target=aarch64-linux-android + # pnpm nx -- run-many --target=build-native -- --target=aarch64-linux-android # - host: ubuntu-latest # target: armv7-linux-androideabi # build: | - # yarn nx -- run-many --target=build-native -- --target=armv7-linux-androideabi + # pnpm nx -- run-many --target=build-native -- --target=armv7-linux-androideabi - host: ubuntu-latest target: aarch64-unknown-linux-musl docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine build: |- set -e && rustup target add aarch64-unknown-linux-musl && - yarn nx -- run-many --target=build-native -- --target=aarch64-unknown-linux-musl + pnpm nx -- run-many --target=build-native -- --target=aarch64-unknown-linux-musl - host: windows-latest target: aarch64-pc-windows-msvc - build: yarn nx -- run-many --target=build-native -- --target=aarch64-pc-windows-msvc + build: pnpm nx -- run-many --target=build-native -- --target=aarch64-pc-windows-msvc name: stable - ${{ matrix.settings.target }} - node@18 runs-on: ${{ matrix.settings.host }} steps: - uses: actions/checkout@v3 - - name: Setup node + + - uses: pnpm/action-setup@v2 + with: + version: 8.2 + + - name: Set node uses: actions/setup-node@v3 - if: ${{ !matrix.settings.docker }} with: node-version: 18 check-latest: true - cache: yarn + cache: 'pnpm' + - name: Install uses: dtolnay/rust-toolchain@stable if: ${{ !matrix.settings.docker }} with: targets: ${{ matrix.settings.target }} + - name: Cache cargo uses: actions/cache@v3 with: @@ -115,9 +121,11 @@ jobs: if: matrix.settings.target == 'i686-pc-windows-msvc' run: yarn config set supportedArchitectures.cpu "ia32" shell: bash - - name: Install dependencies - run: yarn install + + - name: Install packages + run: pnpm install --frozen-lockfile timeout-minutes: 30 + - name: Setup node x86 uses: actions/setup-node@v3 if: matrix.settings.target == 'i686-pc-windows-msvc' @@ -201,26 +209,35 @@ jobs: - build steps: - uses: actions/checkout@v3 - - name: Setup node + + - uses: pnpm/action-setup@v2 + with: + version: 8.2 + + - name: Set node uses: actions/setup-node@v3 with: node-version: 18 check-latest: true - cache: yarn - - name: Install dependencies - run: yarn install + cache: 'pnpm' + + - name: Install packages + run: pnpm install --frozen-lockfile + - name: Download all artifacts uses: actions/download-artifact@v3 with: path: artifacts + - name: List artifacts run: ls -R artifacts shell: bash + - name: Publish run: | git checkout -b publish/$GITHUB_REF_NAME npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN - yarn nx-release --local=false $GITHUB_REF_NAME + pnpm nx-release --local=false $GITHUB_REF_NAME env: GH_TOKEN: ${{ github.token }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/scripts/check-imports.js b/scripts/check-imports.js index 29902203a73f70..4f05ca5ea8aa18 100644 --- a/scripts/check-imports.js +++ b/scripts/check-imports.js @@ -15,7 +15,7 @@ function allFilesInDir(dirName) { name: child, content: fs.readFileSync(child).toString(), }); - } else if (s.isDirectory()) { + } else if (s.isDirectory() && !child.includes('node_modules')) { res = [...res, ...allFilesInDir(child)]; } } catch (e) {}