From 52a26f8d6b72cc3f66774c6d3c74220d616cf3cb Mon Sep 17 00:00:00 2001 From: Sanjaya Kumar Saxena Date: Sat, 14 Oct 2023 22:52:59 +0530 Subject: [PATCH] build(*): migrate from travis to github actions Co-authored-by: Rachna --- .github/workflows/coveralls.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/node.js.yml | 32 ++++++++++++++++++++++++++++++++ package.json | 3 +-- 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/coveralls.yml create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 0000000..246b910 --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,30 @@ +on: ["push", "pull_request"] + +name: Coveralls + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v1 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: npm install + run: | + npm install + npm run pretest + npm run test + + - name: Coveralls + uses: coverallsapp/github-action@v2 + with: + format: lcov + debug: true + allow-empty: false \ No newline at end of file diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..c9db828 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,32 @@ +# 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: Node.js CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm run pretest + - run: npm run test \ No newline at end of file diff --git a/package.json b/package.json index f27c7ea..b170a5e 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,7 @@ "main": "src/wink-naive-bayes-text-classifier.js", "scripts": { "pretest": "npm run lint && npm run docs", - "test": "nyc --reporter=html --reporter=text mocha ./test/", - "coverage": "nyc report --reporter=text-lcov | coveralls", + "test": "nyc --reporter=html --reporter=lcov --reporter=text mocha ./test/", "sourcedocs": "docker -i src -o ./sourcedocs --sidebar no", "docs": "jsdoc src/*.js -c .jsdoc.json", "lint": "eslint ./src/*.js ./test/*.js ./runkit/*.js"