Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ jobs:
- name: Verify registry installation
run: |
version=${RELEASE_TAG#v}
for attempt in {1..30}; do
if npm view "@createitv/agc-cli@$version" version 2>/dev/null | grep -Fx "$version"; then
break
fi
if test "$attempt" -eq 30; then
echo "@createitv/agc-cli@$version was not visible after 5 minutes" >&2
exit 1
fi
echo "Waiting for npm to finish processing @createitv/agc-cli@$version ($attempt/30)..."
sleep 10
done
npm install --global "@createitv/agc-cli@$version" --prefix "$RUNNER_TEMP/npm-install" --ignore-scripts
"$RUNNER_TEMP/npm-install/bin/agc" version | tee "$RUNNER_TEMP/npm-version.txt"
grep -F "$version" "$RUNNER_TEMP/npm-version.txt"
14 changes: 14 additions & 0 deletions scripts/test_npm_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ def test_missing_version_does_not_turn_npm_json_error_into_integrity(self):
"the workflow must only treat an sha512 integrity as published",
)

def test_registry_verification_waits_for_new_package_processing(self):
workflow = NPM_WORKFLOW.read_text(encoding="utf-8")

self.assertIn(
"for attempt in {1..30}",
workflow,
"npm says newly published packages may take a few minutes to become available",
)
self.assertIn(
'npm view "@createitv/agc-cli@$version" version',
workflow,
"the retry must wait for the exact version before installing",
)


if __name__ == "__main__":
unittest.main()
Loading