diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..6a69d26 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm test diff --git a/README.md b/README.md index f11f92e..4ccb13b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ For http(s) resources wait-on will check that the requests are returning 2XX (su wait-on can also be used in reverse mode which waits for resources to NOT be available. This is useful in waiting for services to shutdown before continuing. (Thanks @skarbovskiy for adding this feature) -[![Build Status](https://travis-ci.com/jeffbski/wait-on.svg?branch=master)](https://travis-ci.com/jeffbski/wait-on) +[![CI](https://github.com/jeffbski/wait-on/actions/workflows/ci.yml/badge.svg)](https://github.com/jeffbski/wait-on/actions/workflows/ci.yml) ## Installation diff --git a/package.json b/package.json index dab4b48..e2e8456 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "scripts": { "lint": "eslint \"lib/**/*.js\" \"test/**/*.js\" \"bin/wait-on\"", "publish:next": "npm publish --tag next && npm view", - "test": "mocha --exit 'test/**/*.mocha.js'" + "test": "npm run lint && npm run test:mocha", + "test:mocha": "mocha --exit 'test/**/*.mocha.js'" }, "engines": { "node": ">=12.0.0"