mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-27 07:51:35 +00:00
chore: minor fixes and github ci
This commit is contained in:
67
.github/workflows/main.yml
vendored
Normal file
67
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
name: ci
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: yarn
|
||||||
|
- run: yarn lint
|
||||||
|
- run: yarn build
|
||||||
|
- uses: gozala/typescript-error-reporter-action@v1.0.4
|
||||||
|
- run: yarn aegir dep-check -- -i aegir
|
||||||
|
- uses: ipfs/aegir/actions/bundle-size@master
|
||||||
|
name: size
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
test-node:
|
||||||
|
needs: check
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
node: [12, 14]
|
||||||
|
fail-fast: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
- run: yarn
|
||||||
|
- run: npx nyc --reporter=lcov npm run test:node -- --bail
|
||||||
|
- uses: codecov/codecov-action@v1
|
||||||
|
test-chrome:
|
||||||
|
needs: check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: yarn
|
||||||
|
- run: yarn aegir test -t browser -t webworker
|
||||||
|
test-firefox:
|
||||||
|
needs: check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: yarn
|
||||||
|
- run: yarn aegir test -t browser -t webworker -- --browsers FirefoxHeadless
|
||||||
|
test-electron-main:
|
||||||
|
needs: check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: yarn
|
||||||
|
- run: npx xvfb-maybe yarn aegir test -t electron-main --bail
|
||||||
|
test-electron-renderer:
|
||||||
|
needs: check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: yarn
|
||||||
|
- run: npx xvfb-maybe yarn aegir test -t electron-renderer --bail
|
59
.travis.yml
59
.travis.yml
@ -1,59 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
cache: npm
|
|
||||||
stages:
|
|
||||||
- check
|
|
||||||
- test
|
|
||||||
- cov
|
|
||||||
|
|
||||||
node_js:
|
|
||||||
- 'lts/*'
|
|
||||||
- '14'
|
|
||||||
|
|
||||||
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 build --bundlesize
|
|
||||||
# Remove pull libs once ping is async
|
|
||||||
- npx aegir dep-check -- -i pull-handshake -i pull-stream
|
|
||||||
- npm run lint
|
|
||||||
- npm run test:types
|
|
||||||
|
|
||||||
- stage: test
|
|
||||||
name: chrome
|
|
||||||
addons:
|
|
||||||
chrome: stable
|
|
||||||
script:
|
|
||||||
- npx aegir test -t browser -t webworker
|
|
||||||
|
|
||||||
- stage: test
|
|
||||||
name: firefox
|
|
||||||
addons:
|
|
||||||
firefox: latest
|
|
||||||
script:
|
|
||||||
- npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless
|
|
||||||
|
|
||||||
- stage: test
|
|
||||||
name: interop
|
|
||||||
script:
|
|
||||||
- cd node_modules/interop-libp2p
|
|
||||||
- npm install
|
|
||||||
- LIBP2P_JS=${TRAVIS_BUILD_DIR}/src/index.js npx aegir test -t node --bail
|
|
||||||
|
|
||||||
- stage: test
|
|
||||||
if: type = pull_request
|
|
||||||
name: example - auto-relay
|
|
||||||
script:
|
|
||||||
- cd examples
|
|
||||||
- npm install
|
|
||||||
- npm run test -- auto-relay
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
@ -71,7 +71,7 @@
|
|||||||
"it-pipe": "^1.1.0",
|
"it-pipe": "^1.1.0",
|
||||||
"it-protocol-buffers": "^0.2.0",
|
"it-protocol-buffers": "^0.2.0",
|
||||||
"libp2p-crypto": "^0.18.0",
|
"libp2p-crypto": "^0.18.0",
|
||||||
"libp2p-interfaces": "libp2p/js-libp2p-interfaces#feat/add-types",
|
"libp2p-interfaces": "libp2p/js-libp2p-interfaces#feat/add-types-with-post-install",
|
||||||
"libp2p-utils": "^0.2.2",
|
"libp2p-utils": "^0.2.2",
|
||||||
"mafmt": "^8.0.0",
|
"mafmt": "^8.0.0",
|
||||||
"merge-options": "^2.0.0",
|
"merge-options": "^2.0.0",
|
||||||
@ -98,7 +98,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nodeutils/defaults-deep": "^1.1.0",
|
"@nodeutils/defaults-deep": "^1.1.0",
|
||||||
"abortable-iterator": "^3.0.0",
|
"abortable-iterator": "^3.0.0",
|
||||||
"aegir": "^29.1.0",
|
"aegir": "^29.2.0",
|
||||||
"chai-bytes": "^0.1.2",
|
"chai-bytes": "^0.1.2",
|
||||||
"chai-string": "^1.5.0",
|
"chai-string": "^1.5.0",
|
||||||
"delay": "^4.3.0",
|
"delay": "^4.3.0",
|
||||||
|
@ -54,7 +54,6 @@ class TransportManager {
|
|||||||
throw errCode(new Error('There is already a transport with this key'), codes.ERR_DUPLICATE_TRANSPORT)
|
throw errCode(new Error('There is already a transport with this key'), codes.ERR_DUPLICATE_TRANSPORT)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const transport = new Transport({
|
const transport = new Transport({
|
||||||
...transportOptions,
|
...transportOptions,
|
||||||
libp2p: this.libp2p,
|
libp2p: this.libp2p,
|
||||||
|
@ -7,7 +7,6 @@ const log = Object.assign(debug('libp2p:upgrader'), {
|
|||||||
const errCode = require('err-code')
|
const errCode = require('err-code')
|
||||||
const Multistream = require('multistream-select')
|
const Multistream = require('multistream-select')
|
||||||
const { Connection } = require('libp2p-interfaces/src/connection')
|
const { Connection } = require('libp2p-interfaces/src/connection')
|
||||||
const ConnectionStatus = require('libp2p-interfaces/src/connection/status')
|
|
||||||
const PeerId = require('peer-id')
|
const PeerId = require('peer-id')
|
||||||
const { pipe } = require('it-pipe')
|
const { pipe } = require('it-pipe')
|
||||||
const mutableProxy = require('mutable-proxy')
|
const mutableProxy = require('mutable-proxy')
|
||||||
@ -223,8 +222,7 @@ class Upgrader {
|
|||||||
let connection
|
let connection
|
||||||
|
|
||||||
if (Muxer) {
|
if (Muxer) {
|
||||||
// Create the muxer
|
// @ts-ignore Create the muxer
|
||||||
// @ts-ignore
|
|
||||||
muxer = new Muxer({
|
muxer = new Muxer({
|
||||||
// Run anytime a remote stream is created
|
// Run anytime a remote stream is created
|
||||||
onStream: async muxedStream => {
|
onStream: async muxedStream => {
|
||||||
@ -270,7 +268,7 @@ class Upgrader {
|
|||||||
// Wait for close to finish before notifying of the closure
|
// Wait for close to finish before notifying of the closure
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
if (connection.stat.status === ConnectionStatus.OPEN) {
|
if (connection.stat.status === 'open') {
|
||||||
await connection.close()
|
await connection.close()
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -1,21 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "./node_modules/aegir/src/config/tsconfig.aegir.json",
|
"extends": "./node_modules/aegir/src/config/tsconfig.aegir.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist",
|
"outDir": "dist"
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"noImplicitReturns": false,
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"noImplicitThis": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"noUnusedLocals": true,
|
|
||||||
"noUnusedParameters": false,
|
|
||||||
"strictFunctionTypes": true,
|
|
||||||
"strictNullChecks": true,
|
|
||||||
"strictPropertyInitialization": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"strict": true,
|
|
||||||
"alwaysStrict": true,
|
|
||||||
"stripInternal": true
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src"
|
"src"
|
||||||
|
Reference in New Issue
Block a user