From 65e1a8072da73338ce552036ddbcf49e856dadf0 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 5 Jan 2022 08:07:10 +0100 Subject: [PATCH 1/2] chore: use semantic-release-monorepo --- .github/workflows/main.yml | 73 ++++++++++++++++--- package.json | 8 +- packages/libp2p-connection/package.json | 13 ++-- .../package.json | 11 ++- packages/libp2p-interfaces/package.json | 2 +- packages/libp2p-peer-id-factory/package.json | 19 +++-- packages/libp2p-peer-id/package.json | 17 +++-- packages/libp2p-pubsub/package.json | 21 +++--- packages/libp2p-topology/package.json | 2 +- 9 files changed, 117 insertions(+), 49 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e81d0c094..46b961a53 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,7 @@ jobs: run: | npm install npm run --if-present build - - run: npm run --if-present test:node -- --bail --cov + - run: npm run --if-present test:node - uses: codecov/codecov-action@v1 test-chrome: @@ -94,7 +94,34 @@ jobs: run: | npm install npm run --if-present build - - run: npm run --if-present test:browser -- -t browser -t webworker --bail + - run: npm run --if-present test:chrome + + test-chrome-webworker: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: actions/cache@v2 + id: cache + env: + CACHE_NAME: cache-node-modules + with: + path: | + ~/.npm + ./dist + ./node_modules + ./packages/*/dist + ./packages/*/node_modules + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: | + npm install + npm run --if-present build + - run: npm run --if-present test:chrome-webworker test-firefox: needs: check @@ -121,7 +148,34 @@ jobs: run: | npm install npm run --if-present build - - run: npm run --if-present test:browser -- -t browser -t webworker --bail -- --browser firefox + - run: npm run --if-present test:firefox + + test-firefox-webworker: + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - uses: actions/cache@v2 + id: cache + env: + CACHE_NAME: cache-node-modules + with: + path: | + ~/.npm + ./dist + ./node_modules + ./packages/*/dist + ./packages/*/node_modules + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }} + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: | + npm install + npm run --if-present build + - run: npm run --if-present test:firefox-webworker test-electron-main: needs: check @@ -148,7 +202,7 @@ jobs: run: | npm install npm run --if-present build - - run: npx xvfb-maybe npm run --if-present test:electron-main -- --bail + - run: npx xvfb-maybe npm run --if-present test:electron-main test-electron-renderer: needs: check @@ -175,12 +229,12 @@ jobs: run: | npm install npm run --if-present build - - run: npx xvfb-maybe npm run --if-present test:electron-renderer -- --bail + - run: npx xvfb-maybe npm run --if-present test:electron-renderer release: - needs: [test-node, test-chrome, test-firefox, test-electron-main] + needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-electron-main, test-electron-renderer] runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.author.name, 'Github Actions') + if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v2.4.0 with: @@ -206,11 +260,6 @@ jobs: npm install npm run --if-present build - run: | - git config --global user.email "actions@github.com" - git config --global user.name "Github Actions" - if [[ -n "${NPM_TOKEN}" ]]; then - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc - fi if [[ -n "${DOCKER_TOKEN}" ]] && [[ -n "${DOCKER_USERNAME}" ]]; then echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin fi diff --git a/package.json b/package.json index 5e215add6..08ca9dd4f 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,16 @@ "reset": "lerna run clean && rimraf ./node_modules ./package-lock.json packages/*/node_modules packages/*/package-lock.json packages/*/dist", "test": "lerna run test -- --", "test:node": "lerna run test:node -- --", - "test:browser": "lerna run test:browser -- --", + "test:chrome": "lerna run test:chrome -- --", + "test:chrome-webworker": "lerna run test:chrome-webworker -- --", + "test:firefox": "lerna run test:firefox -- --", + "test:firefox-webworker": "lerna run test:firefox-webworker -- --", "test:electron-main": "lerna run test:electron-main -- --", + "test:electron-renderer": "lerna run test:electron-renderer -- --", "build": "lerna run build", "lint": "lerna run lint", "dep-check": "lerna run dep-check", - "release": "lerna publish --canary --preid rc --dist-tag next --force-publish --yes" + "release": "semantic-release -e semantic-release-monorepo" }, "bugs": "https://github.com/libp2p/js-libp2p-interfaces/issues", "homepage": "https://github.com/libp2p/js-libp2p-interfaces#readme", diff --git a/packages/libp2p-connection/package.json b/packages/libp2p-connection/package.json index 23b32c3e5..269ef9027 100644 --- a/packages/libp2p-connection/package.json +++ b/packages/libp2p-connection/package.json @@ -24,12 +24,15 @@ "scripts": { "lint": "aegir lint", "dep-check": "aegir dep-check dist/src/**/*.js", - "pretest": "npm run build", "build": "tsc", + "pretest": "npm run build", "test": "aegir test -f ./dist/test/**/*.js", - "test:browser": "aegir test -t browser -f ./dist/test/**/*.js", - "test:node": "aegir test -t node -f ./dist/test/**/*.js", - "test:electron-main": "aegir test -t electron-main -f ./dist/test/**/*.js" + "test:chrome": "npm run test -- -t browser", + "test:chrome-webworker": "npm run test -- -t webworker", + "test:firefox": "npm run test -- -t browser -- --browser firefox", + "test:firefox-webworker": "npm run test -- -t webworker -- --browser firefox", + "test:node": "npm run test -- -t node --cov", + "test:electron-main": "npm run test -- -t electron-main" }, "repository": { "type": "git", @@ -52,7 +55,7 @@ }, "devDependencies": { "@libp2p/peer-id-factory": "^0.2.0", - "aegir": "^36.0.0" + "aegir": "^36.1.3" }, "exports": { ".": { diff --git a/packages/libp2p-interface-compliance-tests/package.json b/packages/libp2p-interface-compliance-tests/package.json index cfa18ac76..15c7f18ff 100644 --- a/packages/libp2p-interface-compliance-tests/package.json +++ b/packages/libp2p-interface-compliance-tests/package.json @@ -25,9 +25,12 @@ "build": "tsc", "pretest": "npm run build", "test": "aegir test -f ./dist/test/**/*.js", - "test:browser": "aegir test -t browser -f ./dist/test/**/*.js", - "test:node": "aegir test -t node -f ./dist/test/**/*.js", - "test:electron-main": "aegir test -t electron-main -f ./dist/test/**/*.js" + "test:chrome": "npm run test -- -t browser", + "test:chrome-webworker": "npm run test -- -t webworker", + "test:firefox": "npm run test -- -t browser -- --browser firefox", + "test:firefox-webworker": "npm run test -- -t webworker -- --browser firefox", + "test:node": "npm run test -- -t node --cov", + "test:electron-main": "npm run test -- -t electron-main" }, "repository": { "type": "git", @@ -54,7 +57,7 @@ "@multiformats/multiaddr": "^10.1.1", "abort-controller": "^3.0.0", "abortable-iterator": "^3.0.0", - "aegir": "^36.0.0", + "aegir": "^36.1.3", "chai": "^4.3.4", "chai-checkmark": "^1.0.1", "delay": "^5.0.0", diff --git a/packages/libp2p-interfaces/package.json b/packages/libp2p-interfaces/package.json index 086ff1c2e..6124b9521 100644 --- a/packages/libp2p-interfaces/package.json +++ b/packages/libp2p-interfaces/package.json @@ -42,7 +42,7 @@ "multiformats": "^9.4.10" }, "devDependencies": { - "aegir": "^36.0.0" + "aegir": "^36.1.3" }, "exports": { ".": { diff --git a/packages/libp2p-peer-id-factory/package.json b/packages/libp2p-peer-id-factory/package.json index 3544e85d5..7fa926df9 100644 --- a/packages/libp2p-peer-id-factory/package.json +++ b/packages/libp2p-peer-id-factory/package.json @@ -33,17 +33,20 @@ ] }, "scripts": { + "lint": "aegir lint", + "dep-check": "aegir dep-check dist/src/**/*.js", + "build": "tsc", "pretest": "npm run build", "test": "aegir test -f ./dist/test/**/*.js", - "test:browser": "aegir test -t browser -f ./dist/test/**/*.js", - "test:node": "aegir test -t node -f ./dist/test/**/*.js", - "test:electron-main": "aegir test -t electron-main -f ./dist/test/**/*.js", - "lint": "aegir ts -p check && aegir lint", - "build": "tsc", + "test:chrome": "npm run test -- -t browser", + "test:chrome-webworker": "npm run test -- -t webworker", + "test:firefox": "npm run test -- -t browser -- --browser firefox", + "test:firefox-webworker": "npm run test -- -t webworker -- --browser firefox", + "test:node": "npm run test -- -t node --cov", + "test:electron-main": "npm run test -- -t electron-main", "build:proto": "npm run build:proto:js && npm run build:proto:types", "build:proto:js": "pbjs -t static-module -w es6 --es6 -r libp2p-peer-id --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/proto.js ./src/proto.proto", - "build:proto:types": "pbts -o src/proto.d.ts src/proto.js", - "dep-check": "aegir dep-check dist/src/**/*.js dist/test/**/*.js" + "build:proto:types": "pbts -o src/proto.d.ts src/proto.js" }, "keywords": [ "IPFS" @@ -61,7 +64,7 @@ }, "homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-peer-id-factory#readme", "devDependencies": { - "aegir": "^36.0.1", + "aegir": "^36.1.3", "util": "^0.12.3" }, "dependencies": { diff --git a/packages/libp2p-peer-id/package.json b/packages/libp2p-peer-id/package.json index 497f2f3c5..842f81b8b 100644 --- a/packages/libp2p-peer-id/package.json +++ b/packages/libp2p-peer-id/package.json @@ -21,14 +21,17 @@ } }, "scripts": { + "lint": "aegir lint", + "dep-check": "aegir dep-check dist/src/**/*.js", + "build": "tsc", "pretest": "npm run build", "test": "aegir test -f ./dist/test/**/*.js", - "test:browser": "aegir test -t browser -f ./dist/test/**/*.js", - "test:node": "aegir test -t node -f ./dist/test/**/*.js", - "test:electron-main": "aegir test -t electron-main -f ./dist/test/**/*.js", - "lint": "aegir ts -p check && aegir lint", - "build": "tsc", - "dep-check": "aegir dep-check dist/src/**/*.js dist/test/**/*.js" + "test:chrome": "npm run test -- -t browser", + "test:chrome-webworker": "npm run test -- -t webworker", + "test:firefox": "npm run test -- -t browser -- --browser firefox", + "test:firefox-webworker": "npm run test -- -t webworker -- --browser firefox", + "test:node": "npm run test -- -t node --cov", + "test:electron-main": "npm run test -- -t electron-main" }, "keywords": [ "IPFS" @@ -46,7 +49,7 @@ }, "homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-peer-id#readme", "devDependencies": { - "aegir": "^36.0.1" + "aegir": "^36.1.3" }, "dependencies": { "@libp2p/interfaces": "^0.2.0", diff --git a/packages/libp2p-pubsub/package.json b/packages/libp2p-pubsub/package.json index e9bf16802..279ecefa6 100644 --- a/packages/libp2p-pubsub/package.json +++ b/packages/libp2p-pubsub/package.json @@ -26,20 +26,23 @@ "scripts": { "lint": "aegir lint", "dep-check": "aegir dep-check dist/src/**/*.js", - "build": "npm run build:types && npm run build:copy-proto-files", - "build:types": "tsc", + "build": "tsc", + "postbuild": "npm run build:copy-proto-files", + "pretest": "npm run build", + "test": "aegir test -f ./dist/test/**/*.js", + "test:chrome": "npm run test -- -t browser", + "test:chrome-webworker": "npm run test -- -t webworker", + "test:firefox": "npm run test -- -t browser -- --browser firefox", + "test:firefox-webworker": "npm run test -- -t webworker -- --browser firefox", + "test:node": "npm run test -- -t node --cov", + "test:electron-main": "npm run test -- -t electron-main", "build:proto": "npm run build:proto:rpc && npm run build:proto:topic-descriptor", "build:proto:rpc": "pbjs -t static-module -w es6 -r libp2p-pubsub-rpc --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/message/rpc.js ./src/message/rpc.proto", "build:proto:topic-descriptor": "pbjs -t static-module -w es6 -r libp2p-pubsub-topic-descriptor --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/message/topic-descriptor.js ./src/message/topic-descriptor.proto", "build:proto-types": "npm run build:proto-types:rpc && npm run build:proto-types:topic-descriptor", "build:proto-types:rpc": "pbts -o src/message/rpc.d.ts src/message/rpc.js", "build:proto-types:topic-descriptor": "pbts -o src/message/topic-descriptor.d.ts src/message/topic-descriptor.js", - "build:copy-proto-files": "cp src/message/*.js dist/src/message && cp src/message/*.d.ts dist/src/message", - "pretest": "npm run build", - "test": "aegir test -f ./dist/test/**/*.js", - "test:browser": "aegir test -t browser -f ./dist/test/**/*.js", - "test:node": "aegir test -t node -f ./dist/test/**/*.js", - "test:electron-main": "aegir test -t electron-main -f ./dist/test/**/*.js" + "build:copy-proto-files": "cp src/message/*.js dist/src/message && cp src/message/*.d.ts dist/src/message" }, "repository": { "type": "git", @@ -74,7 +77,7 @@ "devDependencies": { "@types/bl": "^5.0.2", "@types/debug": "^4.1.7", - "aegir": "^36.0.0", + "aegir": "^36.1.3", "protobufjs": "^6.10.2", "util": "^0.12.4" }, diff --git a/packages/libp2p-topology/package.json b/packages/libp2p-topology/package.json index def2de55b..9621871b2 100644 --- a/packages/libp2p-topology/package.json +++ b/packages/libp2p-topology/package.json @@ -43,7 +43,7 @@ "err-code": "^3.0.1" }, "devDependencies": { - "aegir": "^36.0.0" + "aegir": "^36.1.3" }, "exports": { ".": { From 6507e1b3fb49c1f00fdac60e3d2e111673a6836c Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 5 Jan 2022 08:20:48 +0100 Subject: [PATCH 2/2] chore: lower concurrency --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 08ca9dd4f..219be2126 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,14 @@ "private": true, "scripts": { "reset": "lerna run clean && rimraf ./node_modules ./package-lock.json packages/*/node_modules packages/*/package-lock.json packages/*/dist", - "test": "lerna run test -- --", - "test:node": "lerna run test:node -- --", - "test:chrome": "lerna run test:chrome -- --", - "test:chrome-webworker": "lerna run test:chrome-webworker -- --", - "test:firefox": "lerna run test:firefox -- --", - "test:firefox-webworker": "lerna run test:firefox-webworker -- --", - "test:electron-main": "lerna run test:electron-main -- --", - "test:electron-renderer": "lerna run test:electron-renderer -- --", + "test": "lerna run --concurrency 1 test -- --", + "test:node": "lerna run --concurrency 1 test:node -- --", + "test:chrome": "lerna run --concurrency 1 test:chrome -- --", + "test:chrome-webworker": "lerna --concurrency 1 run test:chrome-webworker -- --", + "test:firefox": "lerna run --concurrency 1 test:firefox -- --", + "test:firefox-webworker": "lerna run --concurrency 1 test:firefox-webworker -- --", + "test:electron-main": "lerna run --concurrency 1 test:electron-main -- --", + "test:electron-renderer": "lerna run --concurrency 1 test:electron-renderer -- --", "build": "lerna run build", "lint": "lerna run lint", "dep-check": "lerna run dep-check",