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

monorepo: replace lerna with npm workspaces #1395

Merged
merged 6 commits into from
Aug 11, 2021
Merged
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
15 changes: 9 additions & 6 deletions .github/workflows/block-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Block-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the latest version of actions/setup-node does this automatically for you. I haven't tried that yet, but looks promising.

https://github.com/actions/setup-node#caching-packages-dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, nice, thanks! that does look a lot simpler. let me give it a try.

path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:block
- name: Update to npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:block
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/blockchain-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Blockchain-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:blockchain
- name: Update to npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:blockchain

# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand Down
30 changes: 18 additions & 12 deletions .github/workflows/client-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Client-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:client
- name: Use npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:client
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand Down Expand Up @@ -76,17 +79,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Client-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:client
- name: Use npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:client
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run test:cli -- --network=${{matrix.network}} --syncmode=${{matrix.syncmode}} --transports rlpx
15 changes: 9 additions & 6 deletions .github/workflows/common-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Common-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:common
- name: Use npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:common
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/devp2p-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Devp2p-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:devp2p
- name: Use npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:devp2p
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/e2e-hardhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: E2e-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: |
**/node_modules

- name: Use npm v7 for workspaces support
run: npm i -g npm@7

# Build if cache is restored
- run: npm run build
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'

# Otherwise, run install (which also runs bootstrap and build)
# Otherwise, run install (which also runs build)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'

Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/ethash-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Ethash-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:ethash
- name: Use npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:ethash
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/node-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ jobs:
with:
submodules: recursive

- name: Use npm v7 for workspaces support
run: npm i -g npm@7

- run: npm install
- run: npm run build

- name: Test Block
run: npm run test
Expand Down
32 changes: 19 additions & 13 deletions .github/workflows/trie-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Trie-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:trie
- name: Update to npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:trie
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand All @@ -71,17 +74,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Trie-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

- name: Update to npm v7 for workspaces support
run: npm i -g npm@7

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:trie
# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:trie

# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run benchmarks | tee output.txt
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/tx-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Tx-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:tx
- name: Update to npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:tx
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/util-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ jobs:
uses: actions/cache@v2
id: cache
with:
key: Util-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
key: cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
path: '**/node_modules'

# Installs root dependencies, ignoring Bootstrap All script.
# Bootstraps the current package only
- run: npm install --ignore-scripts && npm run bootstrap:util
- name: Update to npm v7 for workspaces support
run: npm i -g npm@7

# Installs dependencies and builds all packages (if cache hit failed)
- run: npm install
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}

# Builds current package and the ones it depends from.
- run: npm run build:util
# Builds fresh packages (if cache hit succeeded)
- run: npm run build --workspaces
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ${{github.workspace}}

- run: npm run coverage
Expand Down
Loading