From 6908404bdff9298083bb771f95123a7b5aa47969 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Sun, 25 May 2025 20:29:21 -0500 Subject: [PATCH 1/4] ci: add windows and macos test Signed-off-by: Sebastian Beltran --- .github/workflows/ci.yml | 111 ++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6a945e5..1b1c20b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,15 +1,38 @@ name: ci on: -- pull_request -- push + push: + branches: + - main + paths-ignore: + - '*.md' + pull_request: + paths-ignore: + - '*.md' +permissions: + contents: read jobs: - test: + lint: + name: Lint runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + + - name: Install dependencies + run: npm install --ignore-scripts --include=dev + + - name: Run lint + run: npm run lint + test: strategy: fail-fast: false matrix: + os: [ubuntu-latest, windows-latest, macos-latest] name: - Node.js 10.x - Node.js 11.x @@ -79,25 +102,15 @@ jobs: - name: Node.js 24.x node-version: "24" + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Install Node.js ${{ matrix.node-version }} shell: bash -eo pipefail -l {0} - run: | - nvm install --default ${{ matrix.node-version }} - if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then - nvm install --alias=npm 0.10 - nvm use ${{ matrix.node-version }} - if [[ "$(npm -v)" == 1.1.* ]]; then - nvm exec npm npm install -g npm@1.1 - ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm" - else - sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")" - fi - npm config set strict-ssl false - fi - dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH" + run: nvm install --default ${{ matrix.node-version }} - name: Remove npm module(s) ${{ matrix.npm-rm }} run: npm rm --silent --save-dev ${{ matrix.npm-rm }} @@ -110,41 +123,41 @@ jobs: - name: Install Node.js dependencies run: npm install - - name: List environment - id: list_env - shell: bash - run: | - echo "node@$(node -v)" - echo "npm@$(npm -v)" - npm -s ls ||: - (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT" - - - name: Lint code - run: npm run lint - - name: Run tests shell: bash - run: | - if npm -ps ls nyc | grep -q nyc; then - npm run test-ci - else - npm test - fi + run: npm run test-ci - - name: Collect code coverage - uses: coverallsapp/github-action@v2 - if: steps.list_env.outputs.nyc != '' + - name: Upload code coverage + uses: actions/upload-artifact@v4 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - flag-name: run-${{ matrix.test_number }} - parallel: true + name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }} + path: ./coverage/lcov.info + retention-days: 1 coverage: - needs: test - runs-on: ubuntu-latest - steps: - - name: Upload code coverage - uses: coverallsapp/github-action@v2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true + needs: test + runs-on: ubuntu-latest + permissions: + contents: read + checks: write + steps: + - uses: actions/checkout@v4 + + - name: Install lcov + shell: bash + run: sudo apt-get -y install lcov + + - name: Collect coverage reports + uses: actions/download-artifact@v4 + with: + path: ./coverage + pattern: coverage-node-* + + - name: Merge coverage reports + shell: bash + run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info + + - name: Upload coverage report + uses: coverallsapp/github-action@v2 + with: + file: ./lcov.info \ No newline at end of file From e7507aee957840433793cb61ca4a1ced0f67d1ef Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Sun, 25 May 2025 20:31:30 -0500 Subject: [PATCH 2/4] ci: only linux and windows Signed-off-by: Sebastian Beltran --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b1c20b0..2c41f76e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest] name: - Node.js 10.x - Node.js 11.x @@ -108,10 +108,10 @@ jobs: with: persist-credentials: false - - name: Install Node.js ${{ matrix.node-version }} - shell: bash -eo pipefail -l {0} - run: nvm install --default ${{ matrix.node-version }} - + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} - name: Remove npm module(s) ${{ matrix.npm-rm }} run: npm rm --silent --save-dev ${{ matrix.npm-rm }} if: matrix.npm-rm != '' From 0883bde7ee4fb63d4d5f3e70520d9839a12977f5 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Sun, 25 May 2025 20:42:33 -0500 Subject: [PATCH 3/4] deps: update form-data Signed-off-by: Sebastian Beltran --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0f7173d..1653c096 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "devDependencies": { "deep-equal": "^2.0.3", "express": "^4.13.1", - "form-data": "^1.0.0-rc1", + "form-data": "^4.0.2", "fs-temp": "^1.1.2", "mocha": "^11.3.0", "nyc": "^15.1.0", From fdff6d4aa65790c591c69f45bbeb787d16b70efb Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Sun, 25 May 2025 20:48:57 -0500 Subject: [PATCH 4/4] deps: change to fastify busboy Signed-off-by: Sebastian Beltran --- lib/make-middleware.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/make-middleware.js b/lib/make-middleware.js index 81a90cf6..1becb764 100644 --- a/lib/make-middleware.js +++ b/lib/make-middleware.js @@ -1,5 +1,5 @@ var is = require('type-is') -var Busboy = require('busboy') +var Busboy = require('@fastify/busboy') var extend = require('xtend') var appendField = require('append-field') diff --git a/package.json b/package.json index 1653c096..21805e49 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ ], "dependencies": { "append-field": "^1.0.0", - "busboy": "^1.0.0", + "@fastify/busboy": "^1.0.0", "concat-stream": "^1.5.2", "mkdirp": "^0.5.6", "object-assign": "^4.1.1",