Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit b7574b1

Browse files
authored
Merge pull request #120 from ethereumjs/useGHActions
Upgrade CI provider to use GH Actions in place of Travis
2 parents 236478a + c79ea93 commit b7574b1

File tree

7 files changed

+101
-41
lines changed

7 files changed

+101
-41
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- '*'
8+
pull_request:
9+
types: [opened, reopened, synchronize]
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [10.x, 12.x, 13.x, 14.x]
16+
steps:
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
22+
- uses: actions/checkout@v1
23+
24+
- run: npm install
25+
- run: npm run test
26+
27+
- name: Upload coverage to Coveralls
28+
uses: coverallsapp/github-action@master
29+
with:
30+
github-token: ${{ secrets.GITHUB_TOKEN }}
31+
32+
test-browser:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/setup-node@v1
36+
with:
37+
node-version: 12.x
38+
39+
- uses: actions/checkout@v1
40+
41+
- run: npm install
42+
- run: npm run test:browser
43+

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ethereumjs-wallet
22

33
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-wallet.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-wallet)
4-
[![Build Status](https://travis-ci.org/ethereumjs/ethereumjs-wallet.svg?branch=master)](https://travis-ci.org/ethereumjs/ethereumjs-wallet)
4+
[![Actions Status](https://github.com/ethereumjs/ethereumjs-wallet/workflows/Build/badge.svg)](https://github.com/ethereumjs/ethereumjs-wallet/actions)
55
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-wallet.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-wallet)
66
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode
77

karma.conf.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = function(config) {
2+
config.set({
3+
frameworks: ['mocha', 'karma-typescript'],
4+
files: ['src/**/*.ts', 'test/**/*.ts'],
5+
preprocessors: {
6+
'**/*.ts': ['karma-typescript'],
7+
},
8+
plugins: ['karma-mocha', 'karma-typescript', 'karma-chrome-launcher', 'karma-firefox-launcher'],
9+
karmaTypescriptConfig: {
10+
bundlerOptions: {
11+
entrypoints: /\.spec\.ts$/,
12+
acornOptions: {
13+
ecmaVersion: 8,
14+
},
15+
transforms: [require('karma-typescript-es6-transform')()],
16+
},
17+
},
18+
colors: true,
19+
reporters: ['progress', 'karma-typescript'],
20+
browsers: ['FirefoxHeadless', 'ChromeHeadless'],
21+
singleRun: true,
22+
concurrency: Infinity,
23+
// Extend timeouts for long tests
24+
browserDisconnectTimeout: 1000000,
25+
browserNoActivityTimeout: 1000000,
26+
})
27+
}

package.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
"prepublishOnly": "npm run format && npm run tslint && npm run test",
1313
"docs:build": "typedoc --out docs --mode file --readme none --theme markdown --mdEngine github --excludeNotExported src",
1414
"coverage": "ethereumjs-config-coverage",
15-
"coveralls": "ethereumjs-config-coveralls",
1615
"format": "ethereumjs-config-format",
1716
"format:fix": "ethereumjs-config-format-fix",
1817
"lint": "ethereumjs-config-lint",
1918
"lint:fix": "ethereumjs-config-lint-fix",
20-
"pretest": "npm run build",
21-
"test": "nyc mocha ./test/**/*.ts",
19+
"test": "npm run build && nyc --reporter=lcov mocha ./test/**/*.ts",
20+
"test:browser": "karma start karma.conf.js",
2221
"tsc": "ethereumjs-config-tsc",
2322
"tslint": "ethereumjs-config-tslint",
2423
"tslint:fix": "ethereumjs-config-tslint-fix"
@@ -62,19 +61,24 @@
6261
"@types/lodash.zip": "^4.2.6",
6362
"@types/mocha": "^5.2.7",
6463
"@types/node": "^12.0.10",
65-
"coveralls": "^3.0.0",
6664
"ethers": "^4.0.33",
6765
"husky": "^2.1.0",
66+
"karma": "^5.0.2",
67+
"karma-chrome-launcher": "^2.0.0",
68+
"karma-firefox-launcher": "^1.0.0",
69+
"karma-mocha": "^2.0.0",
70+
"karma-typescript": "^4.1.1",
71+
"karma-typescript-es6-transform": "^5.0.2",
6872
"lodash.zip": "^4.2.0",
69-
"mocha": "^5.2.0",
70-
"nyc": "^14.1.1",
73+
"mocha": "^7.1.2",
74+
"nyc": "^15.0.1",
7175
"prettier": "^1.15.3",
7276
"source-map-support": "^0.5.12",
73-
"ts-node": "^8.3.0",
77+
"ts-node": "^8.9.1",
7478
"tslint": "^5.12.0",
75-
"typescript": "^3.2.2",
76-
"typestrict": "^1.0.2",
7779
"typedoc": "^0.14.2",
78-
"typedoc-plugin-markdown": "^1.2.0"
80+
"typedoc-plugin-markdown": "^1.2.0",
81+
"typescript": "^3.8.3",
82+
"typestrict": "^1.0.2"
7983
}
8084
}
File renamed without changes.

test/index.ts renamed to test/index.spec.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const fixturePublicKeyBuffer = Buffer.from(fixturePublicKey, 'hex')
2424
const fixtureWallet = Wallet.fromPrivateKey(fixturePrivateKeyBuffer)
2525
const fixtureEthersWallet = new ethersWallet(fixtureWallet.getPrivateKeyString())
2626

27+
const isRunningInKarma = () => {
28+
return typeof (global as any).window !== 'undefined' && (global as any).window.__karma__
29+
}
30+
2731
describe('.getPrivateKey()', function() {
2832
it('should work', function() {
2933
assert.strictEqual(fixtureWallet.getPrivateKey().toString('hex'), fixturePrivateKey)
@@ -212,7 +216,7 @@ describe('.toV3()', function() {
212216
const makePermutations = (...objs: Array<object>): Array<object> => {
213217
const permus = []
214218
const keys = Array.from(
215-
objs.reduce((acc: Set<string>, curr: object) => {
219+
objs.reduce((acc: any, curr: object) => {
216220
Object.keys(curr).forEach(key => {
217221
acc.add(key)
218222
})
@@ -246,7 +250,13 @@ describe('.toV3()', function() {
246250
return obj
247251
}
248252

249-
const permutations = makePermutations(strKdfOptions, buffKdfOptions)
253+
let permutations = makePermutations(strKdfOptions, buffKdfOptions)
254+
255+
if (isRunningInKarma()) {
256+
// These tests take a long time in the browser due to
257+
// the amount of permutations so we will shorten them.
258+
permutations = permutations.slice(1)
259+
}
250260

251261
it('should work with PBKDF2', async function() {
252262
this.timeout(0) // never
@@ -669,19 +679,22 @@ describe('.fromV3()', function() {
669679
it('should fail with invalid password', function() {
670680
const w =
671681
'{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"6087dab2f9fdbbfaddc31a909735c1e6"},"ciphertext":"5318b4d5bcd28de64ee5559e671353e16f075ecae9f99c7a79a38af5f869aa46","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"ae3cd4e7013836a3df6bd7241b12db061dbe2c6785853cce422d148a624ce0bd"},"mac":"517ead924a9d0dc3124507e3393d175ce3ff7c1e96529c6c555ce9e51205e9b2"},"id":"3198bc9c-6672-5ab3-d995-4942343ae5b6","version":3}'
682+
this.timeout(0) // never
672683
assert.throws(function() {
673684
Wallet.fromV3(w, 'wrongtestpassword')
674685
}, /^Error: Key derivation failed - possibly wrong passphrase$/)
675686
})
676687
it('should work with (broken) mixed-case input files', function() {
677688
const w =
678689
'{"Crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"6087dab2f9fdbbfaddc31a909735c1e6"},"ciphertext":"5318b4d5bcd28de64ee5559e671353e16f075ecae9f99c7a79a38af5f869aa46","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"ae3cd4e7013836a3df6bd7241b12db061dbe2c6785853cce422d148a624ce0bd"},"mac":"517ead924a9d0dc3124507e3393d175ce3ff7c1e96529c6c555ce9e51205e9b2"},"id":"3198bc9c-6672-5ab3-d995-4942343ae5b6","version":3}'
690+
this.timeout(0) // never
679691
const wallet = Wallet.fromV3(w, 'testpassword', true)
680692
assert.strictEqual(wallet.getAddressString(), '0x008aeeda4d805471df9b2a5b0f38a0c3bcba786b')
681693
})
682694
it("shouldn't work with (broken) mixed-case input files in strict mode", function() {
683695
const w =
684696
'{"Crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"6087dab2f9fdbbfaddc31a909735c1e6"},"ciphertext":"5318b4d5bcd28de64ee5559e671353e16f075ecae9f99c7a79a38af5f869aa46","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"ae3cd4e7013836a3df6bd7241b12db061dbe2c6785853cce422d148a624ce0bd"},"mac":"517ead924a9d0dc3124507e3393d175ce3ff7c1e96529c6c555ce9e51205e9b2"},"id":"3198bc9c-6672-5ab3-d995-4942343ae5b6","version":3}'
697+
this.timeout(0) // never
685698
assert.throws(function() {
686699
Wallet.fromV3(w, 'testpassword')
687700
}) // FIXME: check for assert message(s)
@@ -760,6 +773,7 @@ describe('.fromKryptoKit()', function() {
760773
'qhah1VeT0RgTvff1UKrUrxtFViiQuki16dd353d59888c25',
761774
'testtest',
762775
)
776+
this.timeout(0) // never
763777
assert.strictEqual(wallet.getAddressString(), '0x3c753e27834db67329d1ec1fab67970ec1e27112')
764778
})
765779
})

0 commit comments

Comments
 (0)