Skip to content

Commit

Permalink
use github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Feb 29, 2020
1 parent ccc229e commit 85b75c0
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 41 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Fixes #(issue)
- [ ] I have executed ``npm run test:cov`` and my test cases do cover all lines and branches of the added code.
- [ ] I ran ```npm run build-all``` and tested the resulting file/'s from ```dist``` folder in a browser.
- [ ] I have updated the ``CHANGELOG.md`` file in the root folder.
- [ ] I have tested my code on the live network.
- [ ] I have tested my code on the live network.
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: "Test"
on:
push:
branches:
- master
tags:
- "*"
pull_request:
types: [opened, reopened, synchronize]
jobs:
unit:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8, 10, 11, 12]
env:
TEST: "unit"
steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v1
- run: bash ./scripts/install.sh
- run: bash ./scripts/ci.sh
build_and_lint:
runs-on: ${{ matrix.os }}
env:
TEST: "build_and_lint"
steps:
- uses: actions/setup-node@v1
with:
node-version: 10
- uses: actions/checkout@v1
- run: bash ./scripts/install.sh
- run: bash ./scripts/ci.sh
e2e:
runs-on: ubuntu-latest
strategy:
matrix:
testCmd:
[
"unit_and_e2e_clients",
"e2e_ganache",
"e2e_mosaic",
"e2e_ens",
"e2e_browsers",
]
env:
TEST: ${{ matrix.testCmd }}
CI: true
DISPLAY: :99.0
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
steps:
- uses: actions/setup-node@v1
with:
node-version: 12
- uses: actions/checkout@v1
- run: bash ./scripts/install.sh

- run: bash ./scripts/ci.sh
continue-on-error: ${{ matrix.testCmd == 'e2e_ganache' || matrix.testCmd == 'e2e_mosiac' }}

- name: Send coverage reports to Coveralls
if: env.TEST == 'unit_and_e2e_clients'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
e2e_windows:
runs-on: windows-latest
env:
TEST: "e2e_windows"
CI: true
steps:
- uses: actions/setup-node@v1
with:
node-version: 12
- uses: actions/checkout@v1
- run: bash ./scripts/install.sh
- run: bash ./scripts/ci.sh
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ coverage
scripts
.gitignore
.editorconfig
.travis.yml
.npmignore
.DS_Store
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# web3.js - Ethereum JavaScript API

[![Join the chat at https://gitter.im/ethereum/web3.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/web3.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![npm](https://img.shields.io/npm/dm/web3.svg)](https://www.npmjs.com/package/web3) [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url] [![Coverage Status][coveralls-image]][coveralls-url]
[![Join the chat at https://gitter.im/ethereum/web3.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/web3.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![npm](https://img.shields.io/npm/dm/web3.svg)](https://www.npmjs.com/package/web3) [![Build Status][actions-image]][actions-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url] [![Coverage Status][coveralls-image]][coveralls-url]
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)

This is the Ethereum [JavaScript API][docs]
Expand Down Expand Up @@ -170,8 +170,8 @@ The contribution guidelines are provided in [CONTRIBUTIONS](./CONTRIBUTIONS.md)
[docs]: http://web3js.readthedocs.io/
[npm-image]: https://badge.fury.io/js/web3.png
[npm-url]: https://npmjs.org/package/web3
[travis-image]: https://travis-ci.org/ethereum/web3.js.svg
[travis-url]: https://travis-ci.org/ethereum/web3.js
[actions-image]: https://github.com/ethereum/web3.js/workflows/Test/badge.svg
[actions-url]: https://github.com/ethereum/web3.js/actions
[dep-image]: https://david-dm.org/ethereum/web3.js.svg
[dep-url]: https://david-dm.org/ethereum/web3.js
[dep-dev-image]: https://david-dm.org/ethereum/web3.js/dev-status.svg
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
".gitignore",
".jshintrc",
".npmignore",
".travis.yml",
".github",
"gulpfile.js",
"index.js",
"**/*.txt"
]
}
}
10 changes: 5 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process.env.MOZ_HEADLESS = 1;

if (!process.env.TRAVIS){
if (!process.env.GITHUB_ACTION) {
process.env.CHROME_BIN = require('puppeteer').executablePath();
}

Expand Down Expand Up @@ -50,19 +50,19 @@ module.exports = function (config) {
base: 'Firefox',
flags: ['-headless'],
},
Chrome_travis_ci: {
Chrome_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
};

if(process.env.TRAVIS) {
if(process.env.GITHUB_ACTION) {
configuration.browsers = [
'Chrome_travis_ci',
'Chrome_ci',
'FirefoxHeadless'
];
}

config.set(configuration);
};
};
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"lint": "jshint *.js packages",
"test": "mocha --grep E2E --invert; jshint *.js packages",
"test:unit": "nyc --no-clean --silent _mocha -- -R spec --grep E2E --invert",
"test:cov": "npm run cov:clean; npm run test:unit; npm run test:e2e:clients; npm run cov:html",
"test:cov": "npm run cov:clean; npm run test:unit; npm run test:e2e:clients; npm run cov:merge_reports",
"dtslint": "lerna run dtslint",
"depcheck": "lerna exec dependency-check -- --missing --verbose .",
"bundlesize": "bundlesize",
Expand All @@ -50,9 +50,8 @@
"test:e2e:ens": "./scripts/e2e.ens.sh",
"test:e2e:ganache:core": "./scripts/e2e.ganache.core.sh",
"ci": "./scripts/ci.sh",
"coveralls": "./scripts/coveralls.sh",
"cov:clean": "rm -rf .nyc_output; rm -rf coverage",
"cov:html": "nyc report --reporter=html"
"cov:merge_reports": "nyc report --reporter=lcov --reporter=html"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -110,7 +109,6 @@
"bundlesize": "^0.18.0",
"chai": "^4.2.0",
"core-js": "^3.4.8",
"coveralls": "^3.0.7",
"crypto-js": "^3.1.9-1",
"del": "^4.1.1",
"dependency-check": "^4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# -----------------------------
# Travis CI matrix job selector
# CI matrix job selector
# -----------------------------

# Exit immediately on error
Expand All @@ -25,7 +25,7 @@ elif [ "$TEST" = "unit_and_e2e_clients" ]; then
npm run test:e2e:geth:auto
npm run test:e2e:ens
npm run test:unit
npm run coveralls
npm run cov:merge_reports

elif [ "$TEST" = "e2e_browsers" ]; then

Expand Down
7 changes: 0 additions & 7 deletions scripts/coveralls.sh

This file was deleted.

3 changes: 3 additions & 0 deletions scripts/e2e.ganache.core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo "Installing updated web3 via virtual registry "
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"

npm config set fetch-retry-mintimeout 100000
npm config set fetch-retry-maxtimeout 600000

npm install
npm uninstall --save-dev web3
npm install --save-dev web3@e2e --registry http://localhost:4873
Expand Down
2 changes: 1 addition & 1 deletion scripts/e2e.mosaic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
git submodule update --init --recursive
yarn --registry http://localhost:4873

yarn add web3@e2e --registry http://localhost:4873
yarn add web3@e2e --registry http://localhost:4873 --network-timeout 600000

yarn list web3
yarn list web3-utils
Expand Down
14 changes: 7 additions & 7 deletions scripts/e2e.npm.publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fi
# To model publication correctly, this script needs to run
# without web3's dev deps being installed. It installs
# what it needs here.
npm install -g verdaccio@4.4.2
npm install -g verdaccio@4.4.4
npm install -g npm-auth-to-token@1.0.0
npm install -g lerna@3.18.3

Expand All @@ -46,11 +46,10 @@ npm-auth-to-token \
-r http://localhost:4873

# Prep branch for Lerna's git-checks
BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
if [ -z "$BRANCH" ]; then

BRANCH=$TRAVIS_BRANCH

if [[ $GITHUB_REF = 'refs/pull/'* ]]; then
BRANCH=${GITHUB_HEAD_REF##*/}
else
BRANCH=${GITHUB_REF##*/}
fi

git checkout $BRANCH --
Expand All @@ -63,8 +62,9 @@ lerna version minor \
--allow-branch $BRANCH \
--yes

# Set email prior to publishing (necessary for Windows)
# Set identity prior to publishing (necessary for Windows)
git config user.email "you@example.com"
git config user.name "Your Name"

# Commit changes because lerna checks git before
git commit -a -m 'virtual-version-bump'
Expand Down
2 changes: 1 addition & 1 deletion scripts/e2e.truffle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# --------------------------------------------------------------------------------
# NB: This script temporarily removed from CI while truffle remains on Web3@1.2.1.
# To re-enable, add a `env: TEST=e2e_truffle` job to the matrix in travis.yml.
# To re-enable, add a `e2e_truffle` job to the matrix in `.github/workflows/test.yml`.
# --------------------------------------------------------------------------------

# -------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# This script contains conditional installation logic for Travis CI
# This script contains conditional installation logic for CI

# CI jobs we'd like to skip default installation for:
# Helpful for E2E tests where the dev deps might cause problems
Expand Down
6 changes: 4 additions & 2 deletions test/eth.accounts.wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,12 @@ describe("eth", function () {
assert.equal(ethAccounts.wallet.length, 0);

done();
}, 1);
}, 1000);
});

it("encrypt then decrypt wallet", function() {
this.timeout(10000);

var ethAccounts = new Accounts();
var password = "qwerty";

Expand All @@ -294,4 +296,4 @@ describe("eth", function () {
});
});
});
});
});
14 changes: 10 additions & 4 deletions verdaccio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,25 @@ auth:
uplinks:
npmjs:
url: https://registry.npmjs.org/
timeout: 100000ms
timeout: 10m
fail_timeout: 10m
max_fails: 20
yarn:
url: https://registry.yarnpkg.com/
timeout: 100000ms
timeout: 10m
fail_timeout: 10m
max_fails: 20
packages:
'@*/*':
# scoped packages
access: $all
publish: $all
proxy: npmjs
proxy: npmjs yarn
'**':
access: $all
publish: $all
proxy: npmjs
proxy: npmjs yarn
logs:
- {type: stdout, format: pretty, level: warn}
server:
keepAliveTimeout: 600 # specified in seconds

0 comments on commit 85b75c0

Please sign in to comment.