From 82ca74656956744c5d9fcb7c4de2b4828b71d3e6 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Thu, 24 Aug 2023 12:51:34 -0600 Subject: [PATCH 1/7] ci(getting-started): run (but ignore) checks with `npm` and `npx` --- .github/workflows/integration.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 4abcbe4cefe..f604c41d8d0 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -43,10 +43,7 @@ jobs: strategy: fail-fast: false matrix: - cli: [link-cli, local-npm] - # Mark a failure of `local-npm` as a successful result - # TODO: remove when `local-npm` job is fixed - continue-on-error: ${{ matrix.cli == 'local-npm' }} + cli: [link-cli, local-npm/npm, local-npm/npx, local-npm/yarn] timeout-minutes: 40 steps: - uses: actions/checkout@v3 @@ -102,7 +99,7 @@ jobs: echo "AGORIC_CMD=[\"$HOME/bin/agoric\"]" >> $GITHUB_ENV - name: Start local NPM registry - if: ${{ matrix.cli == 'local-npm' }} + if: ${{ startsWith(matrix.cli, 'local-npm') }} run: | tmp_registry_log=`mktemp` dist_tag=agblah @@ -135,16 +132,31 @@ jobs: fi # Install the Agoric CLI on this machine's $PATH. - yarn global add agoric@$dist_tag > $GITHUB_ENV echo 'AGORIC_START_OPTIONS=["--rebuild"]' >> $GITHUB_ENV - echo 'AGORIC_CMD=["agoric"]' >> $GITHUB_ENV + echo "AGORIC_CMD=$AGORIC_CMD" >> $GITHUB_ENV - name: run agoric-cli integration-test working-directory: ./packages/agoric-cli run: yarn integration-test + # TODO(mfig): remove this `continue` line when the next Endo release + # (after 2023-08-23) is incorporated in Agoric SDK. + continue-on-error: ${{ startsWith(matrix.cli, 'local-npm/np') }} env: AGORIC_INIT_OPTIONS: '["--dapp-branch=${{steps.get-branch.outputs.result}}"]' # Try to avoid hitting a pessimal Actions output rate-limitation. From a59b9355e7de83259fd939dcef1525b2fc1910dd Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Fri, 25 Aug 2023 13:52:46 -0600 Subject: [PATCH 2/7] chore(deployment): properly set `packageJson.name` --- packages/agoric-cli/src/sdk-package-names.js | 2 +- packages/deployment/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/agoric-cli/src/sdk-package-names.js b/packages/agoric-cli/src/sdk-package-names.js index 6d5ac1e649e..a4371b52d2d 100644 --- a/packages/agoric-cli/src/sdk-package-names.js +++ b/packages/agoric-cli/src/sdk-package-names.js @@ -13,6 +13,7 @@ export default [ "@agoric/cosmic-swingset", "@agoric/cosmos", "@agoric/deploy-script-support", + "@agoric/deployment", "@agoric/ertp", "@agoric/eslint-config", "@agoric/governance", @@ -27,7 +28,6 @@ export default [ "@agoric/solo", "@agoric/sparse-ints", "@agoric/spawner", - "@agoric/ssh-node", "@agoric/stat-logger", "@agoric/store", "@agoric/swing-store", diff --git a/packages/deployment/package.json b/packages/deployment/package.json index f0d20e1f130..17243ee4d78 100644 --- a/packages/deployment/package.json +++ b/packages/deployment/package.json @@ -1,5 +1,5 @@ { - "name": "@agoric/ssh-node", + "name": "@agoric/deployment", "version": "3.0.0", "description": "Set up Agoric public chain nodes", "type": "module", From 793426002565f246f75c5551b5749ef7446cd888 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Fri, 25 Aug 2023 13:54:32 -0600 Subject: [PATCH 3/7] ci(getting-started): break out `registry.sh` --- .github/workflows/integration.yml | 69 +------------ scripts/registry.sh | 154 ++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 64 deletions(-) create mode 100755 scripts/registry.sh diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f604c41d8d0..0d9992da650 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - cli: [link-cli, local-npm/npm, local-npm/npx, local-npm/yarn] + cli: [link-cli/yarn, registry/yarn, registry/npm, registry/npx] timeout-minutes: 40 steps: - uses: actions/checkout@v3 @@ -92,75 +92,16 @@ jobs: - run: yarn install --frozen-lockfile - run: yarn build - - name: Link Agoric CLI from SDK - if: ${{ matrix.cli == 'link-cli' }} - run: | - yarn link-cli "$HOME/bin/agoric" - echo "AGORIC_CMD=[\"$HOME/bin/agoric\"]" >> $GITHUB_ENV - - name: Start local NPM registry - if: ${{ startsWith(matrix.cli, 'local-npm') }} + if: ${{ startsWith(matrix.cli, 'registry') }} run: | - tmp_registry_log=`mktemp` - dist_tag=agblah - - nohup npx verdaccio@^5.4.0 &>$tmp_registry_log & - # Wait for `verdaccio` to boot - grep -q 'http address' <(tail -f $tmp_registry_log) - - # Set registry to local registry - npm set registry http://localhost:4873 - yarn config set registry http://localhost:4873 - - # Login so we can publish packages - npx npm-cli-login@^1.0.0 -u user -p password -e user@example.com \ - -r http://localhost:4873 --quotes - - npm whoami - - # Publish the packages to our local service. - # without concurrency until https://github.com/Agoric/agoric-sdk/issues/8091 - yarn lerna publish --concurrency 1 --conventional-prerelease --canary --exact \ - --dist-tag=$dist_tag --preid=dev-$(git rev-parse --short=7 HEAD) \ - --no-push --no-verify-access --yes - - # Git dirty check. - if [[ -n "$(git status --porcelain)" ]]; then - echo "Git status is dirty, aborting." - git status - exit 1 - fi - - # Install the Agoric CLI on this machine's $PATH. - AGORIC_CMD='["agoric"]' - case "${{ matrix.cli }}" in - */npm) - npm install -g agoric@$dist_tag > $GITHUB_ENV - echo 'AGORIC_START_OPTIONS=["--rebuild"]' >> $GITHUB_ENV - echo "AGORIC_CMD=$AGORIC_CMD" >> $GITHUB_ENV + scripts/registry.sh bg-publish ${{ matrix.cli }} - name: run agoric-cli integration-test - working-directory: ./packages/agoric-cli - run: yarn integration-test + run: scripts/registry.sh test ${{ matrix.cli }} ${{steps.get-branch.outputs.result}} # TODO(mfig): remove this `continue` line when the next Endo release # (after 2023-08-23) is incorporated in Agoric SDK. - continue-on-error: ${{ startsWith(matrix.cli, 'local-npm/np') }} - env: - AGORIC_INIT_OPTIONS: '["--dapp-branch=${{steps.get-branch.outputs.result}}"]' - # Try to avoid hitting a pessimal Actions output rate-limitation. - SOLO_MAX_DEBUG_LENGTH: '1024' + continue-on-error: ${{ startsWith(matrix.cli, 'registry/np') }} - name: notify on failure if: > diff --git a/scripts/registry.sh b/scripts/registry.sh new file mode 100755 index 00000000000..eede424205e --- /dev/null +++ b/scripts/registry.sh @@ -0,0 +1,154 @@ +#! /bin/bash + +thisdir=$(cd -- "$(dirname "$0")" >/dev/null && pwd) + +set -ueo pipefail + +# Report, export, and write an environment variable into "$GITHUB_ENV" if set. +persistVar() { + echo "$1=$2" + eval "export $1=\$2" + test -z "${GITHUB_ENV-}" || { + echo "$1=$2" >> "$GITHUB_ENV" + } +} + +runRegistry() { + # shellcheck disable=SC2155 + export HOME="$(mktemp -d -t registry-home.XXXXX)" + export PATH="$thisdir:$PATH" + + # Kill `verdaccio` when the script exits + trap 'kill $(cat "$HOME/verdaccio.pid")' EXIT + + ( + cd "$HOME" + echo "Starting Verdaccio in background..." + : > verdaccio.log + nohup npx verdaccio@^5.4.0 &>verdaccio.log & + echo $! > verdaccio.pid + + # Wait for `verdaccio` to boot + grep -q 'http address' <(tail -f verdaccio.log) + + # Set registry to local registry + npm set registry http://localhost:4873 + yarn config set registry http://localhost:4873 + + # Login so we can publish packages + npx npm-cli-login@^1.0.0 -u user -p password -e user@example.com \ + -r http://localhost:4873 --quotes + + npm whoami + ) 1>&2 +} + +publish() { + export DISTTAG=agblah + case $1 in + manual*) + flags=--no-git-tag-version + ;; + *) + flags=--canary + ;; + esac + + # Publish the packages to our local service. + # without concurrency until https://github.com/Agoric/agoric-sdk/issues/8091 + yarn lerna publish --concurrency 1 --conventional-prerelease $flags --exact \ + --dist-tag="$DISTTAG" --preid=dev"-$(git rev-parse --short=7 HEAD)" \ + --no-push --no-verify-access --yes + + # Use the locally-installed dist-tag. + persistVar REGISTRY_HOME "$HOME" + persistVar REGISTRY_DISTTAG "$DISTTAG" +} + +integrationTest() { + # Install the Agoric CLI on this machine's $PATH. + case $1 in + link-cli | link-cli/*) + yarn link-cli "$HOME/bin/agoric" + persistVar AGORIC_CMD "[\"$HOME/bin/agoric\"]" + ;; + */npm) + npm install -g "agoric@$DISTTAG" + persistVar AGORIC_CMD '["agoric"]' + ;; + */npx) + # Install on demand. + persistVar AGORIC_CMD "[\"npx\",\"agoric@$DISTTAG\"]" + ;; + *) + yarn global add "agoric@$DISTTAG" + persistVar AGORIC_CMD '["agoric"]' + ;; + esac + + test -z "${DISTTAG-}" || { + persistVar AGORIC_INSTALL_OPTIONS "[\"$DISTTAG\"]" + } + persistVar AGORIC_START_OPTIONS '["--rebuild"]' + persistVar AGORIC_INIT_OPTIONS "[\"--dapp-branch=$2\"]" + + ( + cd "$thisdir/../packages/agoric-cli" + + # Try to avoid hitting a pessimal Actions output rate-limitation. + SOLO_MAX_DEBUG_LENGTH=1024 \ + yarn integration-test + ) +} + +export CI=true +case ${1-} in +ci) + runRegistry + publish "${2-manual}" + integrationTest "${2-manual}" "${3-main}" + ;; + +bg) + runRegistry + echo "Publish packages using '$0 publish'" + trap - EXIT + echo "HOME=$HOME" + echo "pid=$(cat "$HOME/verdaccio.pid")" + ;; + +bg-publish) + runRegistry + trap - EXIT + publish "${2-registry}" + + # Git dirty check. + if [[ -n "$(git status --porcelain)" ]]; then + echo "Git status is dirty, aborting." + git status + exit 1 + fi + ;; + +publish) + publish "${2-manual}" + echo "Run getting-started integration test with '$0 test'" + ;; + +test) + test -z "${REGISTRY_HOME-}" || export HOME="$REGISTRY_HOME" + test -z "${REGISTRY_DISTTAG-}" || export DISTTAG="$REGISTRY_DISTTAG" + integrationTest "${2-manual}" "${3-main}" + ;; + +*) + runRegistry + echo "Publish packages using '$0 publish'" + # Kill `verdaccio` and remove HOME when the command shell exits + trap 'kill "$(cat "$HOME/verdaccio.pid")"; rm -rf "$HOME"' EXIT + if test $# -eq 0; then + set -- bash + fi + "$@" + ;; +esac From ce1235ff902777e8f58e99c1f23337b3ea35b0be Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Fri, 25 Aug 2023 14:58:11 -0600 Subject: [PATCH 4/7] chore: patch lerna for prettier removing `resolveConfig.sync` --- patches/@lerna+version+5.6.2.patch | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 patches/@lerna+version+5.6.2.patch diff --git a/patches/@lerna+version+5.6.2.patch b/patches/@lerna+version+5.6.2.patch new file mode 100644 index 00000000000..d88fe07a6cf --- /dev/null +++ b/patches/@lerna+version+5.6.2.patch @@ -0,0 +1,33 @@ +diff --git a/node_modules/@lerna/version/lib/git-add.js b/node_modules/@lerna/version/lib/git-add.js +index d24f8ca..9b9b38d 100644 +--- a/node_modules/@lerna/version/lib/git-add.js ++++ b/node_modules/@lerna/version/lib/git-add.js +@@ -24,12 +24,12 @@ function resolvePrettier() { + return resolvedPrettier; + } + +-function maybeFormatFile(filePath) { ++async function maybeFormatFile(filePath) { + const prettier = resolvePrettier(); + if (!prettier) { + return; + } +- const config = resolvedPrettier.resolveConfig.sync(filePath); ++ const config = await resolvedPrettier.resolveConfig(filePath); + try { + const input = fs.readFileSync(filePath, "utf8"); + fs.writeFileSync(filePath, resolvedPrettier.format(input, { ...config, filepath: filePath }), "utf8"); +@@ -44,11 +44,11 @@ function maybeFormatFile(filePath) { + * @param {{ granularPathspec: boolean; }} gitOpts + * @param {import("@lerna/child-process").ExecOpts} execOpts + */ +-function gitAdd(changedFiles, gitOpts, execOpts) { ++async function gitAdd(changedFiles, gitOpts, execOpts) { + let files = []; + for (const file of changedFiles) { + const filePath = slash(path.relative(execOpts.cwd, path.resolve(execOpts.cwd, file))); +- maybeFormatFile(filePath); ++ await maybeFormatFile(filePath); + if (gitOpts.granularPathspec) { + files.push(filePath); + } From 4daee1a37432540d1bc3de75341263e1d92de0ac Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Fri, 25 Aug 2023 11:02:17 -0600 Subject: [PATCH 5/7] chore(builders): add missing `tsconfig.build` --- packages/builders/tsconfig.build.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 packages/builders/tsconfig.build.json diff --git a/packages/builders/tsconfig.build.json b/packages/builders/tsconfig.build.json new file mode 100644 index 00000000000..d005fe6d8f2 --- /dev/null +++ b/packages/builders/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": [ + "./tsconfig.json", + "../../tsconfig-build-options.json" + ], + "exclude": [ + "scripts", + "test", + "**/exports.js", + ] +} From dd6a214f14872ace503f52f1888bf5a8e3184666 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Fri, 25 Aug 2023 11:02:49 -0600 Subject: [PATCH 6/7] chore: add empty `CHANGELOG.md` files --- packages/boot/CHANGELOG.md | 0 packages/builders/CHANGELOG.md | 0 packages/network/CHANGELOG.md | 0 packages/vm-config/CHANGELOG.md | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 packages/boot/CHANGELOG.md create mode 100644 packages/builders/CHANGELOG.md create mode 100644 packages/network/CHANGELOG.md create mode 100644 packages/vm-config/CHANGELOG.md diff --git a/packages/boot/CHANGELOG.md b/packages/boot/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/builders/CHANGELOG.md b/packages/builders/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/network/CHANGELOG.md b/packages/network/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/vm-config/CHANGELOG.md b/packages/vm-config/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d From dd2873ddcea63b8174ea47bef8d92df483f7b12e Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Fri, 25 Aug 2023 12:13:10 -0600 Subject: [PATCH 7/7] chore(inter-protocol): do not publish bundles to NPM --- packages/inter-protocol/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/inter-protocol/package.json b/packages/inter-protocol/package.json index b195c72c839..c73f2818318 100644 --- a/packages/inter-protocol/package.json +++ b/packages/inter-protocol/package.json @@ -63,7 +63,6 @@ "import-meta-resolve": "^2.2.1" }, "files": [ - "bundles", "scripts", "src/", "exported.js",