Skip to content

Commit

Permalink
ci(agd-builder): fix double-install problem
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Apr 15, 2024
1 parent d83a582 commit 010f2bc
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 149 deletions.
9 changes: 6 additions & 3 deletions .github/actions/restore-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,27 @@ runs:
sudo apt-get install libbsd-dev
fi
# Replace the Endo packages with the ones built from the checked-out branch.
cp -a package.json package.json.orig
if test -e ~/endo; then
scripts/get-packed-versions.sh ~/endo | scripts/resolve-versions.sh
fi
yarn install
if ! cmp -s <(git cat-file blob HEAD:package.json) package.json; then
if ! cmp -s package.json.orig package.json; then
# In the event that the package.json has been modified by Endo
# replacements, we need to have a yarn-installed.sum that matches
# the unmodified package.json. As long as we don't explicitly `yarn
# install` anywhere other than in this action and in the bin/agd
# script, we should be able to reuse even Endo-overridden built caches
# successfully.
git checkout HEAD -- package.json
mv package.json.orig package.json
else
rm -f package.json.orig
fi
if test -e ~/endo; then
# Stage the redirected `yarn install` consequences.
git add package.json yarn.lock
git add yarn.lock
${{ inputs.keep-endo }} || rm -rf ~/endo
fi
shell: bash
Expand Down
34 changes: 33 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,39 @@
},
"resolutions": {
"**/protobufjs": "^7.2.6",
"**/@typescript-eslint/typescript-estree": "^7.2.0"
"**/@typescript-eslint/typescript-estree": "^7.2.0",
"**/@endo/base64": "file:/Users/michael/agoric/endo/packages/base64/endo-base64-v1.0.4-b5e6ee9c88571eb23532a95abecca4bad29fb0cb.tgz",
"**/@endo/bundle-source": "file:/Users/michael/agoric/endo/packages/bundle-source/endo-bundle-source-v3.2.2-329556d0120a8a5b4d7915f02eb49a1a667ee724.tgz",
"**/@endo/captp": "file:/Users/michael/agoric/endo/packages/captp/endo-captp-v4.1.1-2bed481ced26b0fb1f88aca4e33807622016045b.tgz",
"**/@endo/check-bundle": "file:/Users/michael/agoric/endo/packages/check-bundle/endo-check-bundle-v1.0.6-ae76a76da2393223e945845f8583427c045c6ea7.tgz",
"**/@endo/cjs-module-analyzer": "file:/Users/michael/agoric/endo/packages/cjs-module-analyzer/endo-cjs-module-analyzer-v1.0.4-6f4da5593127b6bac6468c2e3af2674665a8abff.tgz",
"**/@endo/common": "file:/Users/michael/agoric/endo/packages/common/endo-common-v1.2.1-2a45262d1e50a184de12c4f55626fa9d53e88abb.tgz",
"**/@endo/compartment-mapper": "file:/Users/michael/agoric/endo/packages/compartment-mapper/endo-compartment-mapper-v1.1.4-6f346b8e9ac0169c10e281c997778689e82586e8.tgz",
"**/@endo/env-options": "file:/Users/michael/agoric/endo/packages/env-options/endo-env-options-v1.1.3-fc279f9d5f9749ca2c7527fae0db48821790334a.tgz",
"**/@endo/errors": "file:/Users/michael/agoric/endo/packages/errors/endo-errors-v1.2.1-21fdea7feebc7599528a540036247886836a3df0.tgz",
"**/@endo/eslint-plugin": "file:/Users/michael/agoric/endo/packages/eslint-plugin/endo-eslint-plugin-v2.1.2-4ff87539d8ddbc7597e5b35a473124206430c49a.tgz",
"**/@endo/evasive-transform": "file:/Users/michael/agoric/endo/packages/evasive-transform/endo-evasive-transform-v1.1.1-370fbcc8170e6d748f84735498506e1ecce61048.tgz",
"**/@endo/eventual-send": "file:/Users/michael/agoric/endo/packages/eventual-send/endo-eventual-send-v1.2.1-520bed91c2e70703b8f6e18965d84ab0a7632ded.tgz",
"**/@endo/exo": "file:/Users/michael/agoric/endo/packages/exo/endo-exo-v1.4.0-e14cd752bf46af622a315d81272e87c536b0af84.tgz",
"**/@endo/far": "file:/Users/michael/agoric/endo/packages/far/endo-far-v1.1.1-2d83cd055324f02b4d674a77be52fcaf97ca1012.tgz",
"**/@endo/import-bundle": "file:/Users/michael/agoric/endo/packages/import-bundle/endo-import-bundle-v1.1.1-83af45e533cc61b57f8e938bff74c0b43a1dc795.tgz",
"**/@endo/init": "file:/Users/michael/agoric/endo/packages/init/endo-init-v1.1.1-4eb8def7b99c3cf6838b8d3b0ccfe558a0817c48.tgz",
"**/@endo/lockdown": "file:/Users/michael/agoric/endo/packages/lockdown/endo-lockdown-v1.0.6-19260cd4efa2687d05a386c9a4a1104dcae5c5dc.tgz",
"**/@endo/lp32": "file:/Users/michael/agoric/endo/packages/lp32/endo-lp32-v1.1.1-05d4e3285ab287d06022be96edf262e720112497.tgz",
"**/@endo/marshal": "file:/Users/michael/agoric/endo/packages/marshal/endo-marshal-v1.4.1-7f64de44b539b19d65c0fa51191fbf26b22a00f0.tgz",
"**/@endo/memoize": "file:/Users/michael/agoric/endo/packages/memoize/endo-memoize-v1.1.1-ec27fcc55cc2b4eea47327c3e10135622002cf48.tgz",
"**/@endo/nat": "file:/Users/michael/agoric/endo/packages/nat/endo-nat-v5.0.6-3adbd6f925ad8f5c995ad936a1e944772db867ef.tgz",
"**/@endo/netstring": "file:/Users/michael/agoric/endo/packages/netstring/endo-netstring-v1.0.6-a121eb28019ec6a706bfa65d5b06a903d81a9539.tgz",
"**/@endo/pass-style": "file:/Users/michael/agoric/endo/packages/pass-style/endo-pass-style-v1.3.1-b6f632e471800df2e61fda182c8b9b6d32017a1c.tgz",
"**/@endo/patterns": "file:/Users/michael/agoric/endo/packages/patterns/endo-patterns-v1.3.1-db00512e2e338acb73a4466b6f5f21d34ef7cc20.tgz",
"**/@endo/promise-kit": "file:/Users/michael/agoric/endo/packages/promise-kit/endo-promise-kit-v1.1.1-8dd3ab7dabf163cf5229655626d38eee45fec63b.tgz",
"**/@endo/ses-ava": "file:/Users/michael/agoric/endo/packages/ses-ava/endo-ses-ava-v1.2.1-d4fcd1a13c0a6246a0227bfa927608bd7b5fe005.tgz",
"**/ses": "file:/Users/michael/agoric/endo/packages/ses/ses-v1.4.1-34737160cef0f7f62528bbb2c02017fa91fbbe24.tgz",
"**/@endo/static-module-record": "file:/Users/michael/agoric/endo/packages/static-module-record/endo-static-module-record-v1.1.1-5e6c61abaf3dc4ce8d5233671936532217f0475a.tgz",
"**/@endo/stream-node": "file:/Users/michael/agoric/endo/packages/stream-node/endo-stream-node-v1.1.1-8f0f3b329c03b822467e64e96bc84c1e81247571.tgz",
"**/@endo/stream": "file:/Users/michael/agoric/endo/packages/stream/endo-stream-v1.2.1-92132f35e2dcef01c93e4535b5836ad31e428bb9.tgz",
"**/@endo/where": "file:/Users/michael/agoric/endo/packages/where/endo-where-v1.0.4-140af336888e4d9dc2c49f1b81e9de87ab740edf.tgz",
"**/@endo/zip": "file:/Users/michael/agoric/endo/packages/zip/endo-zip-v1.0.4-9d312324e02996a179e752343f1730e6cc22a624.tgz"
},
"engines": {
"node": "^18.12 || ^20.9"
Expand Down
8 changes: 6 additions & 2 deletions scripts/agd-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ GVM_URL=${GVM_URL-https://github.com/devnw/gvm/releases/download/latest/gvm}
NVM_GIT_REPO=${NVM_GIT_REPO-https://github.com/nvm-sh/nvm.git}

STAMPS=node_modules/.cache/agoric/stamps
LST="ls -lT"

real0=$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")
thisdir=$(cd "$(dirname -- "$real0")" > /dev/null && pwd -P)
Expand Down Expand Up @@ -130,6 +131,7 @@ $do_not_build || (
)
test -z "$src" || {
echo "At least $src is newer than $stamp"
$LST "$src" "$stamp" || true
$do_not_build
} || (
# Run this build in another subshell in case we had to modify the path.
Expand Down Expand Up @@ -192,7 +194,8 @@ $do_not_build || (

src=$(find "${files[@]}" "${print[@]}" | head -1 || true)
test -z "$src" || {
echo "At least $src is newer than node_modules"
echo "At least $src is newer than $stamp"
$LST "$src" "$stamp" || true
rm -f "$STAMPS/yarn-built"
lazy_yarn install
}
Expand All @@ -216,7 +219,8 @@ $do_not_build || (
files=("$GOLANG_DIR/build/"*agcosmosdaemon.h)
src=$(find "${files[@]}" "${print[@]}" | head -1 || true)
test -z "$src" || {
echo "At least $src is newer than gyp bindings"
echo "At least $src is newer than $stamp"
$LST "$src" "$stamp" || true
(cd "$GOLANG_DIR" && lazy_yarn build:gyp)
}
fi
Expand Down
Loading

0 comments on commit 010f2bc

Please sign in to comment.