diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41c776c..e76e652 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,14 +1,43 @@ name: ci on: -- pull_request -- push + push: + branches: + - master + paths-ignore: + - '*.md' + pull_request: + paths-ignore: + - '*.md' + +# Cancel in progress workflows +# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run +concurrency: + group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true jobs: + 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 --only=dev + + - name: Run lint + run: npm run lint + test: - runs-on: ubuntu-20.04 strategy: + fail-fast: false matrix: + os: [ubuntu-latest, windows-latest] name: - Node.js 0.8 - Node.js 0.10 @@ -35,6 +64,7 @@ jobs: - Node.js 20.x - Node.js 21.x - Node.js 22.x + - Node.js 23.x include: - name: Node.js 0.8 @@ -107,32 +137,35 @@ jobs: npm-i: supertest@6.1.3 - name: Node.js 15.x - node-version: "15.14" + node-version: "15" npm-i: supertest@6.1.3 - name: Node.js 16.x - node-version: "16.20" + node-version: "16" npm-i: supertest@6.1.3 - name: Node.js 17.x - node-version: "17.9" + node-version: "17" npm-i: supertest@6.1.3 - name: Node.js 18.x - node-version: "18.18" + node-version: "18" - name: Node.js 19.x - node-version: "19.9" + node-version: "19" - name: Node.js 20.x - node-version: "20.9" + node-version: "20" - name: Node.js 21.x - node-version: "21.1" + node-version: "21" - name: Node.js 22.x - node-version: "22.0" + node-version: "22" + - name: Node.js 23.x + node-version: "23" + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -202,24 +235,39 @@ jobs: npm test fi - - name: Lint code - if: steps.list_env.outputs.eslint != '' - run: npm run lint - - - name: Collect code coverage - uses: coverallsapp/github-action@master + - name: Upload code coverage if: steps.list_env.outputs.nyc != '' + 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 }} + path: ./coverage/lcov.info + retention-days: 1 coverage: needs: test runs-on: ubuntu-latest + permissions: + contents: read + checks: write steps: - - name: Upload code coverage - uses: coverallsapp/github-action@master + - 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: github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true \ No newline at end of file + file: ./lcov.info \ No newline at end of file diff --git a/README.md b/README.md index f720b0d..d77dc94 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Linux Build Status][ci-image]][ci-url] -[![Windows Build][appveyor-image]][appveyor-url] [![Coverage Status][coveralls-image]][coveralls-url] Serves pages that contain directory listings for a given path. @@ -139,8 +138,6 @@ app.listen(3000) [MIT](LICENSE). The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons are created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/). -[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-index/master.svg?label=windows -[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-index [ci-image]: https://badgen.net/github/checks/expressjs/serve-index/master?label=ci [ci-url]: https://github.com/expressjs/serve-index/actions/workflows/ci.yml [coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-index/master.svg diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index a6d60ff..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,92 +0,0 @@ -environment: - matrix: - - nodejs_version: "0.8" - - nodejs_version: "0.10" - - nodejs_version: "0.12" - - nodejs_version: "1.8" - - nodejs_version: "2.5" - - nodejs_version: "3.3" - - nodejs_version: "4.9" - - nodejs_version: "5.12" - - nodejs_version: "6.17" - - nodejs_version: "7.10" - - nodejs_version: "8.17" - - nodejs_version: "9.11" - - nodejs_version: "10.24" - - nodejs_version: "11.15" - - nodejs_version: "12.22" - - nodejs_version: "13.14" - - nodejs_version: "14.16" - - nodejs_version: "15.13" -cache: - - node_modules -install: - # Install Node.js - - ps: >- - try { Install-Product node $env:nodejs_version -ErrorAction Stop } - catch { Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) } - # Configure npm - - ps: | - # Skip updating shrinkwrap / lock - npm config set shrinkwrap false - # Skip SSL validation on Node.js < 0.10 - if ([int]$env:nodejs_version.split(".")[0] -eq 0 -and [int]$env:nodejs_version.split(".")[1] -lt 10) { - npm config set strict-ssl false - } - # Remove all non-test dependencies - - ps: | - # Remove coverage dependency - npm rm --silent --save-dev nyc - # Remove lint dependencies - cmd.exe /c "node -pe `"Object.keys(require('./package').devDependencies).join('\n')`"" | ` - sls "^eslint(-|$)" | ` - %{ npm rm --silent --save-dev $_ } - # Setup Node.js version-specific dependencies - - ps: | - # mocha for testing - # - use 2.x for Node.js < 0.10 - # - use 3.x for Node.js < 4 - # - use 5.x for Node.js < 6 - # - use 6.x for Node.js < 8 - # - use 7.x for Node.js < 10 - if ([int]$env:nodejs_version.split(".")[0] -eq 0 -and [int]$env:nodejs_version.split(".")[1] -lt 10) { - npm install --silent --save-dev mocha@2.5.3 - } elseif ([int]$env:nodejs_version.split(".")[0] -lt 4) { - npm install --silent --save-dev mocha@3.5.3 - } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) { - npm install --silent --save-dev mocha@5.2.0 - } elseif ([int]$env:nodejs_version.split(".")[0] -lt 8) { - npm install --silent --save-dev mocha@6.2.2 - } elseif ([int]$env:nodejs_version.split(".")[0] -lt 10) { - npm install --silent --save-dev mocha@7.2.0 - } - - ps: | - # mocha for testing - # - use 1.1.0 for Node.js < 0.10 - # - use 2.0.0 for Node.js < 4 - # - use 3.4.2 for Node.js < 6 - if ([int]$env:nodejs_version.split(".")[0] -eq 0 -and [int]$env:nodejs_version.split(".")[1] -lt 10) { - npm install --silent --save-dev supertest@1.1.0 - } elseif ([int]$env:nodejs_version.split(".")[0] -lt 4) { - npm install --silent --save-dev supertest@2.0.0 - } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) { - npm install --silent --save-dev supertest@3.4.2 - } - # Update Node.js modules - - ps: | - # Prune & rebuild node_modules - if (Test-Path -Path node_modules) { - npm prune - npm rebuild - } - # Install Node.js modules - - npm install -build: off -test_script: - # Output version data - - ps: | - node --version - npm --version - # Run test script - - npm test -version: "{build}" diff --git a/package.json b/package.json index c7f520e..82f9c87 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ }, "scripts": { "lint": "eslint .", - "test": "mocha --reporter spec --bail --check-leaks test/", + "test": "mocha --reporter spec --check-leaks test/", "test-ci": "nyc --reporter=lcov --reporter=text npm test", "test-cov": "nyc --reporter=html --reporter=text npm test" }