Skip to content

Commit c37090e

Browse files
authored
chore: migrate to travis for ci (#18)
1 parent 42fc528 commit c37090e

File tree

4 files changed

+57
-8
lines changed

4 files changed

+57
-8
lines changed

.travis.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
language: node_js
2+
cache: npm
3+
stages:
4+
- check
5+
- test
6+
- cov
7+
8+
node_js:
9+
- '10'
10+
11+
os:
12+
- linux
13+
- osx
14+
- windows
15+
16+
script: npx nyc -s npm run test:node -- --bail
17+
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
18+
19+
jobs:
20+
include:
21+
- stage: check
22+
script:
23+
- npx aegir commitlint --travis
24+
- npx aegir dep-check
25+
- npm run lint
26+
27+
- stage: test
28+
name: chrome
29+
addons:
30+
chrome: stable
31+
script: npx aegir test -t browser -t webworker
32+
33+
- stage: test
34+
name: firefox
35+
addons:
36+
firefox: latest
37+
script: npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless
38+
39+
notifications:
40+
email: false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
55
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
66
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
7-
[![Jenkins](https://ci.ipfs.team/buildStatus/icon?job=ipfs/js-ipfs-unixfs-exporter/master)](https://ci.ipfs.team/job/ipfs/job/js-ipfs-unixfs-exporter/job/master/)
7+
[![Build Status](https://flat.badgen.net/travis/ipfs/js-ipfs-unixfs-exporter)](https://travis-ci.com/ipfs/js-ipfs-unixfs-exporter)
88
[![Codecov](https://codecov.io/gh/ipfs/js-ipfs-unixfs-exporter/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-unixfs-exporter)
99
[![Dependency Status](https://david-dm.org/ipfs/js-ipfs-unixfs-exporter.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-unixfs-exporter)
1010
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)

ci/Jenkinsfile

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

test/helpers/random-bytes.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
'use strict'
22

3-
module.exports = function randomBytes (length) {
4-
const buffer = Buffer.alloc(length)
3+
const crypto = require('crypto')
4+
const MAX_BYTES = 65536
55

6-
for (let i = 0; i < length; i++) {
7-
buffer[i] = Math.floor(Math.random() * 256) + 1
6+
// One day this will be merged: https://github.com/crypto-browserify/randombytes/pull/16
7+
module.exports = function randomBytes (num) {
8+
num = parseInt(num)
9+
const bytes = Buffer.allocUnsafe(num)
10+
11+
for (let offset = 0; offset < num; offset += MAX_BYTES) {
12+
let size = MAX_BYTES
13+
14+
if ((offset + size) > num) {
15+
size = num - offset
16+
}
17+
18+
crypto.randomFillSync(bytes, offset, size)
819
}
920

10-
return buffer
21+
return bytes
1122
}

0 commit comments

Comments
 (0)