chore: move to travis (#322)

* chore: move to travis

* chore: move to travis 2

* chore: remove unused test file

* chore: remove travis webworker

* chore: fix webworker

* chore: remove webrtcsupport module

* chore: test windows

* chore: make windows-build-tools silent

* chore: test dllss

* chore: test dllss 2

* chore: test dllss 3

* chore: remove before_install stuff

* chore: remove windows from CI
This commit is contained in:
Hugo Dias 2019-02-14 17:07:13 +00:00 committed by Jacob Heun
parent 4ed5c039fc
commit 59fe9732d7
6 changed files with 47 additions and 93 deletions

1
.gitignore vendored
View File

@ -41,3 +41,4 @@ test/test-data/go-ipfs-repo/LOG.old
# while testing npm5
package-lock.json
yarn.lock

42
.travis.yml Normal file
View File

@ -0,0 +1,42 @@
language: node_js
cache: npm
stages:
- check
- test
- cov
node_js:
- '10'
os:
- linux
- osx
script: npx nyc -s npm run test:node -- --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
jobs:
include:
- stage: check
script:
- npx aegir commitlint --travis
- npx aegir dep-check -- -i wrtc -i electron-webrtc
- npm run lint
- stage: test
name: chrome
addons:
chrome: stable
script:
- npx aegir test -t browser
- npx aegir test -t webworker
- stage: test
name: firefox
addons:
firefox: latest
script:
- npx aegir test -t browser -- --browsers FirefoxHeadless
- npx aegir test -t webworker -- --browsers FirefoxHeadless
notifications:
email: false

2
ci/Jenkinsfile vendored
View File

@ -1,2 +0,0 @@
// Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
javascript()

View File

@ -16,9 +16,7 @@
"test:browser": "aegir test -t browser",
"release": "aegir release -t node -t browser",
"release-minor": "aegir release --type minor -t node -t browser",
"release-major": "aegir release --type major -t node -t browser",
"coverage": "aegir coverage",
"coverage-publish": "aegir coverage --provider coveralls"
"release-major": "aegir release --type major -t node -t browser"
},
"repository": {
"type": "git",
@ -61,7 +59,7 @@
},
"devDependencies": {
"@nodeutils/defaults-deep": "^1.1.0",
"aegir": "^18.0.2",
"aegir": "^18.1.0",
"chai": "^4.2.0",
"chai-checkmark": "^1.0.1",
"cids": "~0.5.5",
@ -87,7 +85,6 @@
"pull-serializer": "~0.3.2",
"pull-stream": "^3.6.9",
"sinon": "^7.1.1",
"webrtcsupport": "^2.2.0",
"wrtc": "~0.3.2"
},
"contributors": [

View File

@ -12,7 +12,7 @@ const pull = require('pull-stream')
const parallel = require('async/parallel')
const goodbye = require('pull-goodbye')
const serializer = require('pull-serializer')
const w = require('webrtcsupport')
const wrtcSupport = self.RTCPeerConnection && ('createDataChannel' in self.RTCPeerConnection.prototype)
const tryEcho = require('./utils/try-echo')
const Node = require('./utils/bundle-browser')
@ -232,7 +232,7 @@ describe('transports', () => {
describe('webrtc-star', () => {
/* eslint-disable-next-line no-console */
if (!w.support) { return console.log('NO WEBRTC SUPPORT') }
if (!wrtcSupport) { return console.log('NO WEBRTC SUPPORT') }
let peer1
let peer2

View File

@ -1,84 +0,0 @@
/* eslint-env mocha */
'use strict'
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
const multiaddr = require('multiaddr')
const spawn = require('child_process').spawn
const path = require('path')
const pull = require('pull-stream')
const utils = require('./utils/node')
const createNode = utils.createNode
const echo = utils.echo
describe('Turbolence tests', () => {
let nodeA
let nodeSpawn
before((done) => {
createNode('/ip4/0.0.0.0/tcp/0', (err, node) => {
expect(err).to.not.exist()
nodeA = node
node.handle('/echo/1.0.0', echo)
node.start(done)
})
})
after((done) => nodeA.stop(done))
it('spawn a node in a different process', (done) => {
const filePath = path.join(__dirname, './spawn-libp2p-node.js')
nodeSpawn = spawn(filePath, { env: process.env })
let spawned = false
nodeSpawn.stdout.on('data', (data) => {
// console.log(data.toString())
if (!spawned) {
spawned = true
done()
}
})
/* eslint-disable-next-line no-console */
nodeSpawn.stderr.on('data', (data) => console.log(data.toString()))
})
it('connect nodeA to that node', (done) => {
const spawnedId = require('./test-data/test-id.json')
const maddr = multiaddr('/ip4/127.0.0.1/tcp/12345/p2p/' + spawnedId.id)
nodeA.dial(maddr, '/echo/1.0.0', (err, conn) => {
expect(err).to.not.exist()
const peers = nodeA.peerBook.getAll()
expect(Object.keys(peers)).to.have.length(1)
pull(
pull.values([Buffer.from('hey')]),
conn,
pull.collect((err, data) => {
expect(err).to.not.exist()
expect(data).to.eql([Buffer.from('hey')])
done()
})
)
})
})
it('crash that node, ensure nodeA continues going steady', (done) => {
// TODO investigate why CI crashes
setTimeout(() => nodeSpawn.kill('SIGKILL'), 1000)
// nodeSpawn.kill('SIGKILL')
setTimeout(check, 5000)
function check () {
const peers = nodeA.peerBook.getAll()
expect(Object.keys(peers)).to.have.length(1)
expect(nodeA._switch.connection.getAll()).to.have.length(0)
done()
}
})
})