diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 00000000..00debd76 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - run: npm i + - run: npm run build --if-present + - run: npm test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 46321437..00000000 --- a/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "stable" -script: npm test diff --git a/package.json b/package.json index 19c44f5d..5c684de0 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,11 @@ "typings": "./index.d.ts", "scripts": { "umd-build": "rollup -c", + "build": "./node_modules/.bin/babel src --out-dir lib && npm run umd-build", "lint-src": "./node_modules/.bin/eslint src/**/*.js", "lint-test": "./node_modules/.bin/eslint test/**/*.js", "lint": "npm run lint-src && npm run lint-test", - "prepublishOnly": "./node_modules/.bin/babel src --out-dir lib && npm run umd-build", + "prepublishOnly": "npm run build", "pretest": "./node_modules/.bin/babel src --out-dir lib", "test-run": "./node_modules/.bin/mocha --require @babel/register --recursive", "test": "npm run lint && npm run test-run"