Skip to content

Commit

Permalink
build: migrate to Yarn v1 from npm v7
Browse files Browse the repository at this point in the history
Why?
It was reported by other maintainers that yarn behaves much
better in corporate proxy/firewalled environments.

Future plans: Once Berry (Yarn v2) is stable, we should take
a look at migrating onto that one. I did give it a try this
time to see if their release candidate happened to be stable
enough but it was not unfortunately (there were dependency
resolution issues that lead the Yarn v2 not installing
certain runtime dependencies at all so v1 it is for now)

Also:
1. Made the CI not fail fast along the test matrix dimensions
2. Sequentialized the test:all script to always run one test at a time
hoping to get some additional insight into the flaky tests this way.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Jul 21, 2021
1 parent 291dd3b commit a3d84ec
Show file tree
Hide file tree
Showing 68 changed files with 22,188 additions and 286,319 deletions.
27 changes: 1 addition & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,18 @@ on:

jobs:
build:

runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}

strategy:
fail-fast: true
fail-fast: false
max-parallel: 1024
matrix:
os: [ubuntu-20.04]
node-version: [v12.22.3, v14.15.1, v16.2.0]
experimental: [false]
# include:
#
# # FIXME macOS does not work due to lack of docker support in GHA.
# https://github.community/t/why-is-docker-not-installed-on-macos/17017
# - os: macos-11.0 # macOS Big Sur 11.0
# node-version: v12.22.3
# experimental: true
# - os: macos-10.15 # macOS Catalina 10.15
# node-version: v12.22.3
# experimental: true
#
# # FIXME
# https://github.com/hyperledger/cactus/issues/171
# - os: windows-2019 # Windows Server 2019
# node-version: v12.22.3
# experimental: true

steps:
# FIXME: These do not work on mac OS as of 2020-12-09
# https://github.community/t/why-is-docker-not-installed-on-macos/17017
# - name: Set up QEMU (ARM64 docker images once we are ready)
# uses: docker/setup-qemu-action@v1.0.1

# - name: Set up Docker Buildx (ARM64 docker images once we are ready)
# uses: docker/setup-buildx-action@v1.0.3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.1.2
with:
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ build/
site/

.build-cache/*.tsbuildinfo

.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
2 changes: 2 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ The `npm run watch` script in action:
* WSL2 or any virtual machine running Ubuntu 20.04 LTS
* Git
* NodeJS 16, npm 7 (we recommend using the Node Version Manager (nvm) if available for your OS)
* Yarn
* `npm run install-yarn` (from within the project directory)
* Docker Engine
* Docker Compose

Expand Down
16 changes: 11 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Running unit tests only](#running-unit-tests-only)
- [Running integration tests only](#running-integration-tests-only)
- [What is npx used for?](#what-is-npx-used-for)
- [What's the equivalent of npx for Yarn?](#whats-the-equivalent-of-npx-for-yarn)
- [Debugging a test case](#debugging-a-test-case)
- [All-In-One Docker Images for Ledger Connector Plugins](#all-in-one-docker-images-for-ledger-connector-plugins)
- [Test Automation of Ledger Plugins](#test-automation-of-ledger-plugins)
Expand Down Expand Up @@ -389,6 +390,10 @@ place every node module (project dependencies) on the OS path or to install them
Read more about npx here: https://blog.npmjs.org/post/162869356040/introducing-npx-an-npm-package-runner
#### What's the equivalent of npx for Yarn?

Yarn itself. E.g. `npx lerna clean` becomes `yarn lerna clean`.

#### Debugging a test case

Open the `.vscode/template.launch.json` file and either copy it with a name of
Expand Down Expand Up @@ -509,14 +514,15 @@ Example:

```sh
# Adds "got" as a dependency to the cactus common package
# (which resides under the path of ./packages/cactus-common)
npm install got --save-exact --workspace ./packages/cactus-common
# Note that you must specify the fully qualified package name as present in
# the package.json file
yarn workspace @hyperledger/cactus-common add got --save-exact
```

You need to know which package of the monorepo will be using the package and then
run the `npm install` command with an additional parameter specifying the directory
of that package. See [adding-dependencies-to-a-workspace](https://docs.npmjs.com/cli/v7/using-npm/workspaces#adding-dependencies-to-a-workspace) from the official npm documentation
for further details and examples.
run the `yarn workspace` command with an additional parameters specifying the package
name and the dependency name.
See [Yarn Workspaces Documentation](https://classic.yarnpkg.com/en/docs/cli/workspace/) for the official Yarn documentation for further details and examples.

After adding new dependencies, you might need to [Reload VSCode Window After Adding Dependencies](#reload-vscode-window-after-adding-dependencies)

Expand Down
Loading

0 comments on commit a3d84ec

Please sign in to comment.