From d64c84d4f2c7a786c4ee7db94a47167bf9779c96 Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Mon, 1 Jun 2020 11:34:09 -0700 Subject: [PATCH 1/2] upgrade to github actions for ci --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++ .travis.yml | 25 --------------------- karma.conf.js | 44 +++++++++++++++++++++++++++++++++++++ package.json | 18 +++++++++------ 4 files changed, 90 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml create mode 100644 karma.conf.js diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..26b5662 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build +on: + push: + branches: + - master + tags: + - '*' + pull_request: + types: [opened, reopened, synchronize] +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [10, 12, 13] + steps: + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - uses: actions/checkout@v1 + - run: npm install + - run: npm run coverage + - uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + test-browser: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - uses: actions/checkout@v1 + - run: npm install + - run: npm run test:browser diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4304980..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: node_js -node_js: - - "10" - - "12" -env: - - CXX=g++-4.8 -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 -env: - matrix: - - CXX=g++-4.8 TEST_SUITE=test -matrix: - fast_finish: true - include: - - os: linux - node_js: "12" - env: CXX=g++-4.8 TEST_SUITE=lint - - os: linux - node_js: "12" - env: CXX=g++-4.8 TEST_SUITE=coveralls -script: npm run $TEST_SUITE diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..89347c9 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,44 @@ +module.exports = function (config) { + config.set({ + frameworks: ['browserify', 'tap'], + + files: ['dist/bundle.js', './test/**/*.js'], + + // Exclude [test/node.js, test/net, test/sync, test/service] due to error: `Sorry, but CommonJS module replacement with td.replace() is only supported under Node.js runtimes.` + // Exclude [test/rpc] due to error: `TypeError: superCtor is undefined` + // Exclude [test/util/parse] due to hanging on `should parse geth params file` + // Exclude [test/logging] due to error: `TypeError: logger.format is undefined` + exclude: [ + './test/node.js', + './test/net/**/*.js', + './test/sync/**/*.js', + './test/service/**/*.js', + './test/rpc/**/*.js', + './test/util/parse.js', + './test/logging.js', + './test/integration/**/*.js' + ], + + preprocessors: { + './test/**/*.js': ['browserify'] + }, + + reporters: ['progress'], + + browsers: ['FirefoxHeadless', 'ChromeHeadless'], + + colors: true, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity, + + // Fail after timeout + browserDisconnectTimeout: 100000, + browserNoActivityTimeout: 100000 + }) +} diff --git a/package.json b/package.json index 481fb39..d29886d 100644 --- a/package.json +++ b/package.json @@ -11,15 +11,15 @@ "lib" ], "scripts": { - "coverage": "nyc npm run test && nyc report --reporter=text-lcov > .nyc_output/lcov.info", - "coveralls": "npm run coverage && coveralls <.nyc_output/lcov.info", + "coverage": "nyc npm run test && nyc report --reporter=lcov", "docs": "jsdoc2md --no-cache -c .jsdoc.json lib/*.js > docs/API.md", "lint": "standard", "lint:fix": "standard --fix", - "unit": "tape 'test/!(integration)/**/*.js'", - "integration": "tape 'test/integration/**/*.js'", - "test": "npm run lint && npm run unit && npm run integration", - "build": "npm run test && browserify browser/index.js -s ethereumjs -t babelify --outfile dist/bundle.js" + "test": "npm run lint && npm run test:unit && npm run test:integration", + "test:unit": "tape 'test/!(integration)/**/*.js'", + "test:integration": "tape 'test/integration/**/*.js'", + "test:browser": "npm run build && karma start karma.conf.js", + "build": "browserify browser/index.js -s ethereumjs -t babelify --outfile dist/bundle.js" }, "husky": { "hooks": { @@ -90,9 +90,13 @@ "@babel/runtime-corejs2": "^7.1.2", "babelify": "^10.0.0", "browserify": "^16.2.3", - "coveralls": "^3.0.0", "husky": "^2.1.0", "json-to-markdown": "^1.0.4", + "karma": "^5.0.9", + "karma-browserify": "^7.0.0", + "karma-chrome-launcher": "^3.1.0", + "karma-firefox-launcher": "^1.3.0", + "karma-tap": "^4.2.0", "nyc": "~13.3.0", "pino": "^5.8.0", "pino-pretty": "^2.2.2", From ae8bef85bed03e0f4d7c0c614a1fe37b1313e97d Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Mon, 1 Jun 2020 16:52:35 -0700 Subject: [PATCH 2/2] update readme badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad1464e..b146246 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SYNOPSIS -[![Build Status](https://travis-ci.org/ethereumjs/ethereumjs-client.svg?branch=master)](https://travis-ci.org/ethereumjs/ethereumjs-client) +[![Actions Status](https://github.com/ethereumjs/ethereumjs-client/workflows/Build/badge.svg)](https://github.com/ethereumjs/ethereumjs-client/actions) [![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-client.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-client) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs)