-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8250 from Agoric/mfig-ci-npx
ci(getting-started): run (but ignore) checks with `npm` and `npx`
- Loading branch information
Showing
11 changed files
with
207 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/yarn, registry/yarn, registry/npm, registry/npx] | ||
timeout-minutes: 40 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -95,60 +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: ${{ 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 [email protected] \ | ||
-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. | ||
yarn global add agoric@$dist_tag </dev/null | ||
# Use the locally-installed dist-tag. | ||
echo "AGORIC_INSTALL_OPTIONS=[\"$dist_tag\"]" >> $GITHUB_ENV | ||
echo 'AGORIC_START_OPTIONS=["--rebuild"]' >> $GITHUB_ENV | ||
echo 'AGORIC_CMD=["agoric"]' >> $GITHUB_ENV | ||
scripts/registry.sh bg-publish ${{ matrix.cli }} | ||
- name: run agoric-cli integration-test | ||
working-directory: ./packages/agoric-cli | ||
run: yarn integration-test | ||
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' | ||
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, 'registry/np') }} | ||
|
||
- name: notify on failure | ||
if: > | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": [ | ||
"./tsconfig.json", | ||
"../../tsconfig-build-options.json" | ||
], | ||
"exclude": [ | ||
"scripts", | ||
"test", | ||
"**/exports.js", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,6 @@ | |
"import-meta-resolve": "^2.2.1" | ||
}, | ||
"files": [ | ||
"bundles", | ||
"scripts", | ||
"src/", | ||
"exported.js", | ||
|
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] \ | ||
-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 |