From 4cc88a5054261c1b22df101abb5327b1e8f53d9d Mon Sep 17 00:00:00 2001 From: microshine Date: Fri, 4 Sep 2026 10:07:18 +0200 Subject: [PATCH 1/3] ci: update GitHub Actions and expand package compatibility checks --- .github/workflows/docs.yml | 4 +- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 100 ++++++++++++++++++++++++++++------ 3 files changed, 86 insertions(+), 20 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0b516bff..98aa23c8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,8 +13,8 @@ jobs: working-directory: ./website steps: - - uses: actions/checkout@v5 - - uses: actions/setup-node@v6 + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 with: node-version: 22 cache: "npm" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 239c0c5f..45e4cbd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -154,7 +154,7 @@ jobs: cache: npm - name: Download release package - uses: actions/download-artifact@v7 + uses: actions/download-artifact@v8 with: name: npm-package path: ./release-package diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea4bdf44..d529aa87 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,22 +1,24 @@ name: Node.js CI -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22.x, 24.x] - steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v6 + - name: Use Node.js 24 + uses: actions/setup-node@v7 with: - node-version: ${{ matrix.node-version }} + node-version: 24.x cache: "npm" - name: Install dependencies @@ -30,18 +32,82 @@ jobs: - name: Run test with coverage run: npm run coverage + - name: Build package + run: npm run build + + - name: Pack package + run: npm pack --ignore-scripts + + - name: Upload package artifact + uses: actions/upload-artifact@v7 + with: + name: npm-package + path: "*.tgz" + if-no-files-found: error + - name: Coveralls uses: coverallsapp/github-action@v2 - with: - parallel: true - flag-name: run-${{ matrix.node-version }} - finish: + compatibility: + name: Package compatibility (Node.js ${{ matrix.node-version }}) needs: build runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [20.x, 22.x, 24.x, 26.x] + steps: - - name: Close parallel build - uses: coverallsapp/github-action@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v7 + with: + node-version: ${{ matrix.node-version }} + package-manager-cache: false + + - name: Download package artifact + uses: actions/download-artifact@v8 with: - parallel-finished: true - carryforward: "run-22.x,run-24.x" + name: npm-package + path: ${{ runner.temp }}/npm-package + + - name: Install package in consumer environment + env: + CONSUMER_DIR: ${{ runner.temp }}/x509-shadow-consumer + PACKAGE_DIR: ${{ runner.temp }}/npm-package + run: | + PACKAGE_TGZ=$(find "$PACKAGE_DIR" -maxdepth 1 -name '*.tgz' -print -quit) + test -n "$PACKAGE_TGZ" + + mkdir -p "$CONSUMER_DIR" + cd "$CONSUMER_DIR" + npm init --yes + npm install --ignore-scripts --no-save "$PACKAGE_TGZ" reflect-metadata + + - name: Check CommonJS consumer + working-directory: ${{ runner.temp }}/x509-shadow-consumer + run: | + node - <<'NODE' + require("reflect-metadata"); + const x509 = require("@peculiar/x509"); + + if (typeof x509.X509Certificate !== "function") { + throw new Error("CommonJS consumer failed to load @peculiar/x509"); + } + + console.log("CommonJS consumer OK"); + NODE + + - name: Check ESM consumer + working-directory: ${{ runner.temp }}/x509-shadow-consumer + run: | + node --input-type=module - <<'NODE' + import "reflect-metadata"; + const x509 = await import("@peculiar/x509"); + + if (typeof x509.X509Certificate !== "function") { + throw new Error("ESM consumer failed to load @peculiar/x509"); + } + + console.log("ESM consumer OK"); + NODE From 6ab2e986a28145ebeefea1375fa5fdee9a80f148 Mon Sep 17 00:00:00 2001 From: microshine Date: Fri, 4 Sep 2026 10:12:15 +0200 Subject: [PATCH 2/3] ci: run test workflow on pull requests targeting any branch --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d529aa87..88abab73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,8 +5,6 @@ on: branches: - master pull_request: - branches: - - master jobs: build: From d9f350a556cb7a0e801e0a5b68d16848f7198ae6 Mon Sep 17 00:00:00 2001 From: microshine Date: Fri, 4 Sep 2026 10:21:39 +0200 Subject: [PATCH 3/3] ci: suppress audit and funding noise in shadow consumer install step --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88abab73..add9c844 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -80,7 +80,7 @@ jobs: mkdir -p "$CONSUMER_DIR" cd "$CONSUMER_DIR" npm init --yes - npm install --ignore-scripts --no-save "$PACKAGE_TGZ" reflect-metadata + npm install --ignore-scripts --no-save --no-audit --no-fund "$PACKAGE_TGZ" reflect-metadata - name: Check CommonJS consumer working-directory: ${{ runner.temp }}/x509-shadow-consumer