From f1bbbb560aab5d5b237760a91436e31bcf786f32 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 26 Oct 2024 00:29:37 -0700 Subject: [PATCH] ci: pack zeromq in the package stage --- .github/workflows/CI.yml | 57 ++++++++++++++++++++++++---------------- .nvmrc | 1 + package.json | 1 + script/smoke-test.bash | 4 ++- 4 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 .nvmrc diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1d9456a8..93430d1e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -162,20 +162,6 @@ jobs: name: build-${{ strategy.job-index }} overwrite: true - - name: Pack Zeromq - if: matrix.os == 'ubuntu-20.04' - run: | - pnpm run build.js - pnpm pack - - - name: Upload Pack - if: matrix.os == 'ubuntu-20.04' - uses: actions/upload-artifact@v4 - with: - path: ./*.tgz - name: pack - overwrite: true - - name: Lint if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}" run: pnpm run lint-test @@ -202,7 +188,7 @@ jobs: xvfb-run --auto-servernum pnpm run test.electron.main continue-on-error: true - MergeBuild: + Package: runs-on: ubuntu-latest needs: Build steps: @@ -213,9 +199,40 @@ jobs: pattern: build-* delete-merged: true + - run: | + ls -R + + - uses: actions/checkout@v4 + + - name: Place build + uses: actions/download-artifact@v4 + with: + name: build + path: ./build + + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version-file: "./.nvmrc" + + - name: Install Pnpm + uses: pnpm/action-setup@v4 + + - name: Pack Zeromq + run: | + pnpm install + pnpm pack + + - name: Upload Pack + uses: actions/upload-artifact@v4 + with: + path: ./*.tgz + name: pack + overwrite: true + SmokeTest: runs-on: ${{ matrix.os }} - needs: MergeBuild + needs: Package strategy: fail-fast: false matrix: @@ -228,13 +245,7 @@ jobs: - 10 - 22 steps: - - name: Place build - uses: actions/download-artifact@v4 - with: - name: build - path: ./build - - - name: Place Pack + - name: Download Pack uses: actions/download-artifact@v4 with: name: pack diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..ec7ba0e9 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.10.0 diff --git a/package.json b/package.json index 8ffba347..cd350a9a 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,7 @@ "lint": "run-p format lint.eslint format", "lint-test": "run-s lint-test.eslint", "bench": "node --expose-gc test/bench", + "prepublishOnly": "pnpm run build.js", "bump": "pnpx npm-check-updates -u -x typescript,eslint,chai && pnpx typesync && pnpm update" }, "cmake-ts": { diff --git a/script/smoke-test.bash b/script/smoke-test.bash index 25f6894a..d656466f 100755 --- a/script/smoke-test.bash +++ b/script/smoke-test.bash @@ -3,7 +3,7 @@ set -ev set -o pipefail echo "Pack zeromq.js if needed" -version=$(npm pkg get version | tr -d '"') +version=$(node -e 'console.log(require("./package.json").version)') pack_name="zeromq-${version}.tgz" test -f "${pack_name}" || npm pack @@ -26,6 +26,8 @@ for pm in "${package_managers[@]}"; do echo "Install with ${pm}" ${pm} install + ls -R ./node_modules/zeromq + echo "Require zeromq" node -e "console.log(require('zeromq'))"