Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[In Progress] Internal: lerna migration #4067

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ jobs:
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-unit_test-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}

- name: Install and Build (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
npm install --workspaces --ignore-scripts
npm run compile

- name: Install and Build (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
run: |
npm ci --ignore-scripts
npx lerna bootstrap --hoist --nohoist='zone.js'
npm ci --workspaces --ignore-scripts
npm run compile

- name: Build Docs
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
args: "./**/*.md"
ignore: './CHANGELOG.md ./experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos ./experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos ./packages/exporter-trace-otlp-grpc/protos ./packages/exporter-trace-otlp-proto/protos'

- name: restore lerna
- name: restore npm cache
id: cache
uses: actions/cache@v3
with:
Expand All @@ -48,10 +48,9 @@ jobs:
key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04142022

# On a cache miss, install dependencies
- name: Bootstrap
- name: Install dependencies
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
npm install --workspaces --ignore-scripts

- name: Lint
run: |
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/peer-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install lerna
run: npm install -g lerna

- name: Install semver
run: npm install semver

- name: Check API dependency semantics
working-directory: packages
run: lerna run peer-api-check
run: npm run peer-api-check
80 changes: 28 additions & 52 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,26 @@ jobs:

- run: npm install -g npm@latest

- name: restore lerna
- name: Restore Cache
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022
# other directories if you use workspaces
key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json') }}-04292022

- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
- name: Install Dependencies
run: npm install

- name: Build 🔧
run: |
npm run compile
run: npm run compile

- name: Unit tests
run: |
# TODO(legendecas): webpack https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
# TODO(legendecas): webpack https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesu
nsupported
if [ "${{ matrix.node_version }}" = "18" ]; then
export NODE_OPTIONS=--openssl-legacy-provider
fi
Expand All @@ -74,23 +69,17 @@ jobs:

- run: npm install -g npm@latest

- name: restore lerna
- name: Restore Cache
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: node-windows-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}
key: node-windows-tests-${{ runner.os }}-${{ hashFiles('package.json') }}

- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
- name: Install Dependencies
run: npm install

- name: Build 🔧
run: |
Expand All @@ -99,6 +88,7 @@ jobs:

- name: Unit tests
run: npm run test

browser-tests:
runs-on: ubuntu-latest
env:
Expand All @@ -111,69 +101,60 @@ jobs:
with:
node-version: 16

- name: restore lerna
- name: Restore Cache
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: browser-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022
key: browser-tests-${{ runner.os }}-${{ hashFiles('package.json') }}

- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
- name: Install Dependencies
run: npm install

- name: Build 🔧
run: |
npm run compile
run: npm run compile

- name: Unit tests
run: npm run test:browser

- name: Report Coverage
run: npm run codecov:browser

webworker-tests:
runs-on: ubuntu-latest
env:
NPM_CONFIG_UNSAFE_PERM: true
steps:
- name: Checkout
uses: actions/checkout@v3.5.3

- uses: actions/setup-node@v3
with:
node-version: 16

- name: restore lerna
- name: Restore Cache
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: webworker-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022
key: webworker-tests-${{ runner.os }}-${{ hashFiles('package.json') }}

- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
- name: Install Dependencies
run: npm install

- name: Build 🔧
run: |
npm run compile
run: npm run compile

- name: Unit tests
run: npm run test:webworker

- name: Report Coverage
run: npm run codecov:webworker

api-eol-node-test:
strategy:
fail-fast: false
Expand Down Expand Up @@ -201,9 +182,4 @@ jobs:

- name: Test
working-directory: ./api
# running test:eol as node 8 is not supported anymore by the version of nyc we use, as we don't report coverage
# for this step we leave it out.
# Details: nyc requires istanbul-lib-report, which silently dropped support for Node.js v8 when going from
# 3.0.0 to 3.0.1 by requiring make-dir@^4.0.0 to fix https://github.com/advisories/GHSA-c2qf-rxjj-qqgw.
# make-dir does not support Node.js v8 anymore.
run: npm run test:eol
60 changes: 33 additions & 27 deletions .github/workflows/w3c-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,51 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

steps:
- uses: actions/setup-node@v3
with:
node-version: '16'

- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
- uses: actions/checkout@v3

- name: Lint changelog file
uses: avto-dev/markdown-lint@v1
with:
config: "/lint/config/changelog.yml"
args: "./CHANGELOG.md"

- name: Lint markdown files
uses: avto-dev/markdown-lint@v1
with:
args: "./**/*.md"
ignore: './CHANGELOG.md ./experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos ./experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos ./packages/exporter-trace-otlp-grpc/protos ./packages/exporter-trace-otlp-proto/protos'

- name: restore npm cache
id: cache
uses: actions/cache@v3
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-w3c_integration-${{ hashFiles('**/package.json') }}
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04142022

- name: Install and Bootstrap (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
# On a cache miss, install dependencies
- name: Install dependencies
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --scope=propagation-validation-server --include-dependencies
npm install --workspaces --ignore-scripts

- name: Install and Bootstrap (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
- name: Lint
run: |
npm ci --ignore-scripts
npx lerna bootstrap --hoist --scope=propagation-validation-server --include-dependencies

- name: Generate version.ts files
run: lerna run version
npm run lint
npm run lint:examples

- name: Build 🔧
run: npm run compile
working-directory: ./integration-tests/propagation-validation-server

- name: Run W3C Test harness
run: ./integration-tests/tracecontext-integration-test.sh
- name: Lint doc files
run: |
npm run compile
NODE_OPTIONS=--max-old-space-size=6144 npm run docs
npm run docs:test
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,14 @@ Please also see [GitHub workflow](https://github.com/open-telemetry/community/bl

- [NPM](https://npmjs.com)
- [TypeScript](https://www.typescriptlang.org/)
- [lerna](https://github.com/lerna/lerna) to manage dependencies, compilations, and links between packages. Most lerna commands should be run by calling the provided npm scripts.
- [MochaJS](https://mochajs.org/) for tests
- [eslint](https://eslint.org/)

Most of the commands needed for development are accessed as [npm scripts](https://docs.npmjs.com/cli/v6/using-npm/scripts). It is recommended that you use the provided npm scripts instead of using `lerna run` in most cases.
Most of the commands needed for development are accessed as [npm scripts](https://docs.npmjs.com/cli/v6/using-npm/scripts).

### Install dependencies

This will install all dependencies for the root project and all modules managed by `lerna`. By default, a `postinstall` script will run `lerna bootstrap` automatically after an install. This can be avoided using the `--ignore-scripts` option if desired.
This will install all dependencies for the root project and all modules managed by `npm`.

```sh
npm install
Expand Down
2 changes: 0 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../",
"codecov:webworker": "nyc report --reporter=json && codecov -f coverage/*.json -p ../",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../",
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
"compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"docs": "typedoc",
"docs:deploy": "gh-pages --dist docs/out",
Expand Down Expand Up @@ -77,7 +76,6 @@
"karma-mocha-webworker": "1.3.0",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"lerna": "7.1.4",
"memfs": "3.5.3",
"mocha": "10.2.0",
"nyc": "15.1.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-tracer-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/api": "^1.0.2",
"@opentelemetry/api": "1.0.2",
"@opentelemetry/exporter-jaeger": "0.25.0",
"@opentelemetry/resources": "0.25.0",
"@opentelemetry/semantic-conventions": "0.25.0",
Expand Down
18 changes: 9 additions & 9 deletions examples/grpc-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.3.7",
"@opentelemetry/api": "^1.0.2",
"@opentelemetry/exporter-jaeger": "^1.0.1",
"@opentelemetry/exporter-zipkin": "^1.0.1",
"@opentelemetry/instrumentation": "^0.27.0",
"@opentelemetry/instrumentation-grpc": "^0.27.0",
"@opentelemetry/resources": "^1.0.1",
"@opentelemetry/semantic-conventions": "^1.0.1",
"@opentelemetry/sdk-trace-base": "^1.0.1",
"@opentelemetry/sdk-trace-node": "^1.0.1",
"@opentelemetry/api": "1.0.2",
"@opentelemetry/exporter-jaeger": "1.0.1",
"@opentelemetry/exporter-zipkin": "1.0.1",
"@opentelemetry/instrumentation": "0.27.0",
"@opentelemetry/instrumentation-grpc": "0.27.0",
"@opentelemetry/resources": "1.0.1",
"@opentelemetry/semantic-conventions": "1.0.1",
"@opentelemetry/sdk-trace-base": "1.0.1",
"@opentelemetry/sdk-trace-node": "1.0.1",
"google-protobuf": "^3.9.2"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/grpc-js",
Expand Down
2 changes: 1 addition & 1 deletion examples/http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/api": "1.3.0",
"@opentelemetry/exporter-jaeger": "1.15.2",
"@opentelemetry/exporter-zipkin": "1.15.2",
"@opentelemetry/instrumentation": "0.41.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/https/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/api": "1.0.0",
"@opentelemetry/exporter-jaeger": "1.15.2",
"@opentelemetry/exporter-zipkin": "1.15.2",
"@opentelemetry/instrumentation": "0.41.2",
Expand Down
Loading