diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6a945e5..2c41f76e 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] name: - Node.js 10.x - Node.js 11.x @@ -79,26 +102,16 @@ 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" - + - 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 != '' @@ -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 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 e0f7173d..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", @@ -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",