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

chore: yarn workspaces #5701

Draft
wants to merge 13 commits into
base: 4.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/black_box_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: ${{ matrix.node }}
cache: yarn
- run: corepack enable
- run: yarn
- run: tar -czf /tmp/web3-${{ matrix.node }}.js.tar.gz --exclude="./.git" ./
- uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -45,6 +46,7 @@ jobs:
name: web3-${{ matrix.node }}.js.tar.gz
path: /tmp
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: corepack enable
- run: |
yarn test:blackbox:${{ matrix.backend }}:${{ matrix.mode }}
shell: bash
34 changes: 21 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: yarn
- run: yarn
- run: corepack enable
- run: yarn install
- run: tar -czf /tmp/web3-${{ matrix.node }}.js.tar.gz --exclude="./.git" ./
- uses: actions/upload-artifact@v3
with:
Expand All @@ -39,6 +40,7 @@ jobs:
with:
name: web3-14.js.tar.gz
path: /tmp
- run: corepack enable
- run: tar -xf /tmp/web3-14.js.tar.gz -C ./
- run: yarn lint

Expand All @@ -48,12 +50,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 14, 16 ]
node: [14, 16]
steps:
- uses: actions/download-artifact@v3
with:
name: web3-${{ matrix.node }}.js.tar.gz
path: /tmp
- run: corepack enable
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: yarn build:web

Expand All @@ -70,6 +73,7 @@ jobs:
name: web3-${{ matrix.node }}.js.tar.gz
path: /tmp
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: corepack enable
- run: yarn test:unit

integration:
Expand All @@ -91,6 +95,7 @@ jobs:
name: web3-${{ matrix.node }}.js.tar.gz
path: /tmp
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: corepack enable
- run: yarn test:e2e:${{ matrix.backend }}:${{ matrix.mode }}
shell: bash

Expand All @@ -104,15 +109,16 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [ 14, 16 ]
node: [14, 16]
backend: [ 'geth' ]
mode: [ 'ipc' ]
steps:
- uses: actions/download-artifact@v3
with:
name: web3-${{ matrix.node }}.js.tar.gz
path: /tmp
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: corepack enable
- run: yarn test:e2e:${{ matrix.backend }}:${{ matrix.mode }}
shell: bash

Expand All @@ -133,12 +139,13 @@ jobs:
name: web3-${{ matrix.node }}.js.tar.gz
path: /tmp
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: npm install --no-package-lock --no-save --force cypress
- run: corepack enable
- name: Cypress run
uses: cypress-io/github-action@v4
# temporarily until fix is merged upstream
uses: cypress-io/github-action@v5
with:
install: false
command: yarn test:e2e:ganache:ws:${{ matrix.browser }}
command: yarn run test:e2e:ganache:ws:${{ matrix.browser }}
cache-key: node-v${{ matrix.node }}-on-${{ matrix.browser }}-hash-${{ hashFiles('yarn.lock') }}

build-docs:
Expand All @@ -149,9 +156,10 @@ jobs:
matrix:
node: [ 16 ]
steps:
- uses: actions/download-artifact@v3
with:
name: web3-${{ matrix.node }}.js.tar.gz
path: /tmp
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: yarn build:docs
- uses: actions/download-artifact@v3
with:
name: web3-${{ matrix.node }}.js.tar.gz
path: /tmp
- run: tar -xf /tmp/web3-${{ matrix.node }}.js.tar.gz -C ./
- run: corepack enable
- run: yarn build:docs
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ tmp/

# Incubed (in3) nodelist
packages/web3/.in3/

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-engines.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-engines",
factory: function (require) {
var plugin=(()=>{var P=Object.create,f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var b=n=>f(n,"__esModule",{value:!0});var i=n=>{if(typeof require!="undefined")return require(n);throw new Error('Dynamic require of "'+n+'" is not supported')};var T=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},V=(n,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of N(e))!Y.call(n,t)&&t!=="default"&&f(n,t,{get:()=>e[t],enumerable:!(r=R(e,t))||r.enumerable});return n},s=n=>V(b(f(n!=null?P(j(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var U={};T(U,{default:()=>q});var o=s(i("@yarnpkg/core")),c;(function(r){r.Yarn="Yarn",r.Console="Console"})(c||(c={}));var h=class{constructor(e){this.throwWrongEngineError=(e,r)=>{let t=this.formatErrorMessage(e,r);this.throwError(t)};this.throwError=e=>{switch(this.errorReporter){case c.Yarn:this.reportYarnError(e);break;case c.Console:default:this.reportConsoleError(e);break}};this.reportYarnError=e=>{throw new o.ReportError(o.MessageName.UNNAMED,e)};this.reportConsoleError=e=>{console.error(e),process.exit(1)};this.formatErrorMessage=(e,r)=>{let{configuration:t}=this.project,p=o.formatUtils.applyStyle(t,o.formatUtils.pretty(t,this.engine,"green"),2),g=o.formatUtils.pretty(t,e,"cyan"),d=o.formatUtils.pretty(t,r,"cyan"),w=`The current ${p} version ${g} does not satisfy the required version ${d}.`;return o.formatUtils.pretty(t,w,"red")};this.project=e.project,this.errorReporter=e.errorReporter}};var m=s(i("fs")),y=s(i("path")),l=s(i("semver")),k=s(i("@yarnpkg/fslib")),a=s(i("@yarnpkg/core"));var v=class extends h{constructor(){super(...arguments);this.resolveNvmRequiredVersion=()=>{let{configuration:e,cwd:r}=this.project,t=(0,y.resolve)(k.npath.fromPortablePath(r),".nvmrc"),p=a.formatUtils.applyStyle(e,a.formatUtils.pretty(e,this.engine,"green"),2);if(!(0,m.existsSync)(t)){this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The .nvmrc file does not exist.`,"red"));return}let g=(0,m.readFileSync)(t,"utf-8").trim();if((0,l.validRange)(g))return g;let d=a.formatUtils.pretty(e,".nvmrc","yellow");this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The ${d} file contains an invalid semver range.`,"red"))}}get engine(){return"Node"}verifyEngine(e){let r=e.node;r!=null&&(r===".nvmrc"&&(r=this.resolveNvmRequiredVersion()),(0,l.satisfies)(process.version,r,{includePrerelease:!0})||this.throwWrongEngineError(process.version.replace(/^v/i,""),r.replace(/^v/i,"")))}};var x=s(i("semver")),E=s(i("@yarnpkg/core"));var u=class extends h{get engine(){return"Yarn"}verifyEngine(e){let r=e.yarn;r!=null&&((0,x.satisfies)(E.YarnVersion,r,{includePrerelease:!0})||this.throwWrongEngineError(E.YarnVersion,r))}};var C=n=>e=>{if(process.env.PLUGIN_YARN_ENGINES_DISABLE!=null)return;let{engines:r={}}=e.getWorkspaceByCwd(e.cwd).manifest.raw,t={project:e,errorReporter:n};[new v(t),new u(t)].forEach(g=>g.verifyEngine(r))},S={hooks:{validateProject:C(c.Yarn),setupScriptEnvironment:C(c.Console)}},q=S;return U;})();
return plugin;
}
};