From 4c3864b9568d4d24700fa46c9b68fa67ff37e3bc Mon Sep 17 00:00:00 2001 From: Roman Dvornov Date: Mon, 21 Oct 2024 16:14:09 +0200 Subject: [PATCH] CI --- .github/workflows/ci.yml | 85 ++++++++++++++++++++++++++++++++++++++++ .nycrc | 3 -- .travis.yml | 8 ---- README.md | 2 +- package.json | 2 +- test/color-fixture.json | 4 +- 6 files changed, 89 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .nycrc delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..48c1e43 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,85 @@ +name: Build + +on: + push: + pull_request: + +env: + PRIMARY_NODEJS_VERSION: 20 + REPORTER: "min" + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup node ${{ env.PRIMARY_NODEJS_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.PRIMARY_NODEJS_VERSION }} + cache: "npm" + - run: npm ci + - run: npm run lint + + coverage: + name: Collect coverage + runs-on: ubuntu-latest + strategy: + matrix: + node_version: + - 20 + steps: + - uses: actions/checkout@v4 + - name: Setup node ${{ matrix.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node_version }} + cache: 'npm' + - run: npm i # old versions of npm doesn't support lockfile v3 + if: ${{ matrix.node_version < '15' }} + - run: npm ci + - run: npm run coverage + - name: Coveralls Parallel + uses: coverallsapp/github-action@1.1.3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: node-${{ matrix.node_version }} + parallel: true + + send-to-coveralls: + name: Send coverage to Coveralls + needs: coverage + runs-on: ubuntu-latest + steps: + - name: Send coverage to Coveralls + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true + + unit-tests: + name: Unit tests + runs-on: ubuntu-latest + strategy: + matrix: + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + node_version: + - 18.0 + - 18 + - 20 + - 22 + + steps: + - uses: actions/checkout@v4 + - name: Setup node ${{ matrix.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node_version }} + cache: "npm" + - run: npm i # old versions of npm doesn't support lockfile v3 + if: ${{ matrix.node_version < '15' }} + - run: npm ci + - run: npm run transpile + - run: npm run test + - run: npm run test:cjs diff --git a/.nycrc b/.nycrc deleted file mode 100644 index 68c131d..0000000 --- a/.nycrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "exclude": ["utils"] -} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3c84cf0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -os: - - linux - - windows -script: "npm run travis" -node_js: - - "10" - - "node" diff --git a/README.md b/README.md index d03f133..f469687 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # jora-cli [![NPM version](https://img.shields.io/npm/v/jora-cli.svg)](https://www.npmjs.com/package/jora-cli) -[![Build Status](https://travis-ci.org/discoveryjs/jora-cli.svg?branch=master)](https://travis-ci.org/discoveryjs/jora-cli) +[![Build Status](https://github.com/discoveryjs/jora-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/discoveryjs/jora-cli/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/discoveryjs/jora-cli/badge.svg?branch=master)](https://coveralls.io/github/discoveryjs/jora-cli?) Command line interface for [Jora](https://github.com/discoveryjs/jora) (a JSON query language) diff --git a/package.json b/package.json index 701cf93..8c63e46 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "main": "./index", "scripts": { "test": "mocha --reporter progress", - "lint": "eslint *.js test", + "lint": "eslint *.js utils test", "lint-and-test": "npm run lint && npm test", "coverage": "c8 npm test", "travis": "c8 npm run lint-and-test && npm run coveralls", diff --git a/test/color-fixture.json b/test/color-fixture.json index d15c121..a15d742 100644 --- a/test/color-fixture.json +++ b/test/color-fixture.json @@ -8,8 +8,8 @@ "false": false, "true": true, "complexJSON": { - "f\"oo\u01234" - :-0.1234, "bar": 0e-3, + "f\"oo\u01234": -0.1234, + "bar": 0e-3, "ba/": -0.1234e12, "quux": -1.123 }